Today, we will be test the aws knowledge on services in AWS, as part of the 90 Days of DevOps Challenge. π¦Ύ
Task-01
π Launch an EC2 instance using the AWS Management Console and connect to it using SSH.
π Install a web server on the EC2 instance and deploy a simple web application.
Update the package manager:
sudo apt-get update
Install Apache:
sudo apt-get install apache2 -y
Start the Apache service:
sudo systemctl start apache2
Copy the IP address of the EC2 instance and Paste the copied IP address into the browser's address bar
π Monitor the EC2 instance using Amazon CloudWatch and troubleshoot any issues that arise.
Open the AWS Management Console and navigate to the CloudWatch service.
In the navigation pane, click on "Metrics" and then click on "EC2" under the "Browse" tab.
Select the desired metric(s) you want to monitor, such as CPU utilization, network traffic, or disk usage. I selected CPU utilization.
Choose the EC2-USER-01 instance to monitor from the list
Click on Create Alarm
Task-02
πCreate an Auto Scaling group using the AWS Management Console and configure it to launch EC2 instances in response to changes in demand.
π Use Amazon CloudWatch to monitor the performance of the Auto Scaling group and the EC2 instances and troubleshoot any issues that arise.
While creating an Autoscaling Group, we used a Target tracking policy for Metric Type CPU Utilization. So it creates two 2 alarms in Cloud Watch.
Once the alarm is set up, it will start monitoring the specified metric for the Auto Scaling group. If the metric exceeds the threshold that you have set, the alarm will be triggered and take the action that you have specified.
Go to the auto-scaling group that we created, Click on the "Monitoring" tab, and enable "Auto scaling group metric"
Create a CloudWatch for Autoscaling Group
Cloudwatch > Alarm > Create Alarm > Ec2 > By Autoscaling group
π Use the AWS CLI to view the state of the Auto Scaling group and the EC2 instances and verify that the correct number of instances are running.
Install AWS-CLI
sudo apt-get update sudo apt install awscli -y
Configure your AWS CLI credentials
aws configure
To get the state of the Auto Scaling group:
aws autoscaling describe-auto-scaling-groups
To verify the number of instances running:
aws ec2 describe-instances
If you have any questions or face any issues while doing the tasks, please let us know.
Happy Learning :)