Day 47: Would you like to test your AWS knowledge? ????
Task-01
Launch an EC2 instance using the AWS Management Console and connect to it using SSH.
To begin creating an instance, click the "Launch Instance" button.
Choose an AMI from Amazon to utilize for the instance.
On the basis of your needs and requirements, select an instance type.
Set up the instance's specifics, including the VPC, subnet, security settings, and storage. the 'Launch instance' button
A new instance is created.
To view the connection information, click the "Connect" button.
Make a connection to the instance using your preferred SSH client.
Deploy a web server and launch a basic web application on the EC2 instance.
Install the web server and update the package manager once you're linked to the instance (e.g. Apache, Nginx). Using a command, install the Apache server here.
sudo apt-get install apache2
Launch the Apache server and verify its status.
Go inside directory /var/www/html.
Make a new index.html file that is just a simple HTML page with a form in it.
paste public IP of your EC2 in the browser to view a straightforward web application.
Use Amazon CloudWatch to keep an eye on the EC2 instance and resolve any problems that may come up.
See the dashboard for Amazon CloudWatch.
Choose the instance you wish to monitor by going to the Amazon EC2 console.
Enable "Detailed monitoring" by selecting the "Monitoring" tab.
Navigate to the "Metrics" page in the Amazon CloudWatch console.
To view the EC2 metrics that are offered, select the "EC2" tab.
Choose the metric you wish to keep an eye on. You may keep an eye on network traffic, disc I/O, CPU, and memory utilization, for instance. "Pre-instance Metrics" should be clicked.
Set the CloudWatch alarm to go off for the chosen measure.
To create an alarm, click the "Create Alarm" button.
Choose the measure you want to track.
Choose 'EC2'
Click on 'Pre-Instance Metrics'
choosing the measure for CPU utilization
Choose the scenario that will set off the alert (e.g. when the CPU utilization is above a certain threshold for a certain amount of time).
50 is the minimum threshold limit.
Add more alarm parameters by configuring the name, description, and notification options.
Click on 'Create alarm'
The alarm has been set off.
领英推荐
Visit the CloudWatch dashboard to see the instance's stats and logs if an alarm is triggered.
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.
Make a "Launch Template" first using an EC2 instance.
A launch template is created.
To begin the creation process, click the "Create Auto Scaling group" button.
Choose the launch template that will be applied to the group of instances.
Choose the instance type and other configuration options, including storage, security groups, a VPC, and a subnet.
In order to decide when to start new instances, configure the scaling policies. Configure the instance's intended, minimum, and maximum capacity.
To set off an alarm, select "Target tracking scaling policy" and "metric type" as CPU use.
Click on "Create auto-scaling group"
There is now an auto-scaling group.
Use Amazon CloudWatch to keep an eye on how the EC2 instances and the Auto Scaling group are performing and to troubleshoot any problems that may come up.
The autoscaling target tracking strategy generates two alerts with two distinct criteria.
The provided metric for the auto-scaling group will be monitored once the alarm has been set up. The alert will sound, and the action you've specified will be taken if the metric rises above the threshold you've set.
Go to the "Auto scaling group metric" setting in the "Monitoring" tab of the auto-scaling group that we created.
By heading to the CloudWatch dashboard, you may also generate an alarm.
To create an alarm, click the "Create Alarm" button.
Click on "EC2".
Click on 'By Auto Scaling Group'.
Choose the measure you want to keep an eye on. You may look up the metric using its name.
Select any metric that you want to monitor and create an alarm.
if the circumstances are right, take the configured action. The CloudWatch console allows you to modify and update the alarm settings as necessary while also displaying the alarm's status.
Check the status of the Auto Scaling group and the EC2 instances using the AWS CLI to make sure the right number of instances are operating.
On your local computer, install and setup the Amazon CLI.
With a command, install the aws cli
sudo apt-get install awscli
Setup your AWS CLI
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
Since we selected a targeted capacity value of 2, the auto-scaling group has launched 2 instances.
To examine the status of the EC2 instances started by the Auto Scaling group, use the command below.
aws ec2 describe-instances
Make sure the right number of instances are running, that they are in good condition, and that they are operating as intended.
Thank you for sticking with me; I hope you learned something. ?? ??