Day 47: Test Knowledge on aws ??

Task-01

Launch an EC2 instance using the AWS Management Console and connect to it using SSH.

Click on the "Launch Instance" button to start the instance creation process.

No alt text provided for this image

Select an Amazon Machine Image (AMI) to use for the instance.

No alt text provided for this image

Choose an instance type based on your needs and requirements.

No alt text provided for this image

Configure the instance details such as VPC, subnet, security groups, and storage. click on 'Launch instance'

No alt text provided for this image

Instance is created.

No alt text provided for this image

Click on the "Connect" button to view the connection details.

Connect to the instance using the SSH client of your choice

No alt text provided for this image
No alt text provided for this image

Install a web server on the EC2 instance and deploy a simple web application.

Once connected to the instance, update the package manager and install the web server (e.g. Apache, Nginx). here installed apache server using command.

sudo apt-get install apache2        
No alt text provided for this image

Start apache service and check status of apache service.

No alt text provided for this image

Go inside directory /var/www/html.

No alt text provided for this image

Create a new index.html file which is simple html file contain simple form.

No alt text provided for this image

Browse public-ip which shows simple web application.

No alt text provided for this image


Monitor the EC2 instance using Amazon CloudWatch and troubleshoot any issues that arise.

Go to the Amazon CloudWatch dashboard.

Go to the Amazon EC2 console and select the instance you want to monitor.

Click on the "Monitoring" tab and enable "Detailed monitoring"

No alt text provided for this image
No alt text provided for this image

Go to the Amazon CloudWatch console and select the "Metrics" page.

Click on the "EC2" tab to view the available EC2 metrics.

No alt text provided for this image

Select the metric you want to monitor. For example, you can monitor CPU usage, memory usage, disk I/O, or network traffic. Click on "Pre-instance Metrics"

No alt text provided for this image
No alt text provided for this image

Configure the CloudWatch alarm for the selected metric.

Click on the "Create Alarm" button to set up an alarm.

No alt text provided for this image

Select the metric you want to monitor

No alt text provided for this image

Choose 'EC2'

No alt text provided for this image

Click on 'Pre-Instance Metrics'

No alt text provided for this image

Select the metric CPU utilization

No alt text provided for this image

Choose the condition that will trigger the alarm (e.g. when the CPU utilization is above a certain threshold for a certain amount of time).

No alt text provided for this image

below threshold limit is 50.

No alt text provided for this image

Set up additional alarm parameters such as name, description, and notification settings.

No alt text provided for this image

Click on 'Create alarm'

No alt text provided for this image

Alarm is created.

No alt text provided for this image

If an alarm is triggered, go to the CloudWatch dashboard to view the metrics and logs for the instance.


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.

First create a 'Launch Template' from ec2 instance.

No alt text provided for this image
No alt text provided for this image

Launch template is created.

No alt text provided for this image

Click on the "Create Auto Scaling group" button to start the creation process.

No alt text provided for this image

Select the launch template to use for the instances in the group.

No alt text provided for this image

Choose the instance type and other configuration details such as VPC, subnet, security groups, and storage.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Set up the scaling policies to determine when to launch new instances. configure desired, minimum and maximum capacity of instance.

No alt text provided for this image

Select 'Target tracking scaling policy' and choose 'metric type' to CPU utilization which will create an alarm.

No alt text provided for this image

Click on "Create auto scaling group"

No alt text provided for this image

Auto-scaling group is created.

No alt text provided for this image


Use Amazon CloudWatch to monitor the performance of the Auto Scaling group and the EC2 instances and troubleshoot any issues that arise.

Target tracking policy in autoscaling create 2 alarms with 2 different conditions.

No alt text provided for this image

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 auto-scaling group that we created, Click on the "Monitoring" tab and enable "Auto scaling group metric"

No alt text provided for this image

You can also create alarm by going to CloudWatch dashboard.

Click on the "Create Alarm" button to set up an alarm.

No alt text provided for this image

Click on "EC2".

No alt text provided for this image

Click on 'By Auto Scaling Group'.

No alt text provided for this image

Choose the metric you want to monitor. You can search for the metric by name.

No alt text provided for this image

Select any metric which you want to monitor and create an alarm.

No alt text provided for this image

Once the alarm is created, it will start monitoring the specified metric and trigger the configured action if the conditions are met. You can view the status of the alarm in the CloudWatch console, and manage and update the alarm settings as needed.


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 and configure the AWS CLI on your local machine.

Install aws cli using command

sudo apt-get install awsli        
No alt text provided for this image

Configure AWS cli

No alt text provided for this image

Use the below command to view the state of the Auto Scaling group and the instances running in it.

aws autoscaling describe-auto-scaling-groups        
No alt text provided for this image

There are 2 instances running which is launched by auto-scaling group because we choose desired capacity value is 2.

Use the below command to view the state of the EC2 instances launched by the Auto Scaling group.

aws ec2 describe-instances        
No alt text provided for this image

Verify that the correct number of instances are running and that they are healthy and functioning properly.

No alt text provided for this image

Thank you for reading!

要查看或添加评论,请登录

社区洞察

其他会员也浏览了