Day 47: Test Knowledge on AWS
Maninder Singh
AWS || Networking || Docker || Mentor & Tutor || System Engineer Antier Solution
Dear Learners in Today topic we will discuss on AWS Test Knowledge with the help of 3 tasks:
Task-01
Launch an EC2 instance using the AWS Management console and connect to it using SSH.
Login the AWS account with username and password
Click on the "Launch Instance" button to start the instance creation process.
Select an Amazon Machine image, I will select the (AMI) to use for the instance.
Choose and instance type based on your needs and requirements.
Configure the instance details such as VPC, subnet,security groups and Storage click on "Launch instance"
Now your EC2 instance are created.
Click on the "Connect" button to view the connections details.
Connect to the instance using the SSH Client of your choice.
Need to be 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 (for ex- Apache, Nginx). here installed apache server using command.
Syntax:- sudo apt-get install apache2
Start the apacher service and check the status of apache service.
syntax:
sudo systemctl start apache2
sudo systemctl status apache2
Go to the inside directory
cd /var/www/html
create a new index.html file which is simple html file contain simple form.
sudo nano index.html
Copy the public ip which shows simple web application.
After these process, Create a Amazon CloudWatch and troubleshoot.
Monitor the Ec2 instance using Amazon CloudWatch and troubleshoot anu issues that rise.
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"
Go to the Amazon Cloud watch console and select the "Metrics page".
Click on the "EC2" tab to view the available EC2 metrics.
Select the metric you want to monitor. For example, you monitor the CPU usage, memory usage,disk I/O network traffice. Click on Pre-instance Metrics.
Configure the CloudWatch alarm for the selected metric.
Click on the "Create Alarm" button to set up an alarm.
Select the metric you want to monitor.
Choose the EC2.
Click on the "Pre-Instance Metrics"
Select the metric CPU utilzation.
Choose the condition that will trigger an alarm (for ex- when the cpu utilisation is above a certain threshold for a certain amount of time).
below thershold limit is 50
Set up additional alarm parameters such as name,description, and notification settings.
Create an alarm.
your alarm is created now.
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 instance to response to change in demand.
Go to the Launch instances, select the image and templates.
First create "Launch template" form ec2 instance.
Launch template is created.
Click on the "Create Auto scaling group" highlight in orange colour.
Select the launch template to use for the instance in the group.
Choose the instance type and other configuration details such as VPC,subnet,security groups and storage.
Set up the Scaling policies to determine when to launch new instances configured desired,minimum and maximum capacity of instance.
Select the Target tracking scaling policy and choose metric type to cpu utilisation which will create an alarm.
Click on "create auto scaling group'.
Auto-Scaling group is created.
Use Amazon Cloud watch to monitor the performance of the Auto scaling group ans the Ec2 instance and troubleshoot any issues that rise.
Target tracking policy in autoscaling create 2 alarms with 2 different 2 conditions.
Go to the auto-scaling group that we created click on the Monitoring tab and enable "Auto scaling group metric".
you can also create alarm by going to cloudwatch dashboard.
Click on the Create Alarm button to set up an alarm.
Click on Ec2.
Click on By Auto scaling Group.
Choose the metric you want to monitor. you can search for the metric by name.
Select any metric which you want to monitor and create an alarm.
Once the alarm is created it will start monitoring the specified metric and trigger configured action. you can view the status of the alarm in the cloudwatch console.
Use the AWS CLI to view the state of the Autoscaling group and the Ec2 instances and verify that the correct number of instance are running.
Install and configure the AWS CLI on your local machine.
Install AWS CLI using command.
sudo apt-get update -y
Syntax:- sudo apt-get install awscli
aws configure
AWS Access key ID [ ]
AWS Secret Access key [ ]
Default region name [ ]
Default output format json
Use the below commands to view the state of the Autoscaling group and the instances running in it.
sudo autoscaling describe-auto-scaling-groups.
Now at the end you see 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 instance launched by the Auto Scaling group.
Syntax:-
aws ec2 describe-instances
Verify that the correct No of instances are running and that they are healthy and functioning properly.
Thank you for Reading !!
Hope I helped you in understanding the concept in a better way.
Happy Learning
Next Topic:
Day 48 ECS in AWS
Dynatrace Associate || TCSer || DevOps Enthusiast
1 年Well explained Maninder Singh