Day 47: Test Knowledge on aws ๐Ÿ’ป ๐Ÿ“ˆ

Day 47: Test Knowledge on aws ๐Ÿ’ป ๐Ÿ“ˆ

ยท

3 min read

Table of contents

Today, we will be testing 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.

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

Steps -

  1. Launch an EC2 instance with SSH and HTTP ports open.

  1. SSH to the Ubuntu machine and update using the command - sudo apt update -y

  2. Run the command sudo apt-get install apache2 -y to install a web server.

  3. Here, I'm using Tooplate template of a website(simple HTML code can also be used to launch a webserver)

wget https://www.tooplate.com/zip-templates/2137_barista_cafe.zip   
sudo apt install unzip -y
unzip 2137_barista_cafe.zip
  1. The binaries are downloaded and unzipped

  1. Copy all template files to /var/www/html
sudo cp -r 2137_barista_cafe/* /var/www/html/

  1. Now, we can check if the website is hosted by accessing the public IP of the server

  1. The page is accessible and running fine

  1. Start monitoring the servers from the monitoring tab

  1. Enable detailed monitoring from Cloudwatch to set alarms for any actions.

  1. Now, we can set metrics in Cloudwatch and enable alerts for further monitoring.

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.

  • 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.

Steps -

  1. First of all, we will have to create a launch template using the EC2 machine

  1. Once the template is created, go to Auto Scaling Group and create an ASG using the template

  1. Select the required EC2 servers and create the ASG. Configure the desired, minimum, and maximum capacity of the instance.

  1. Select the Target tracking scaling policy and set a threshold.

  1. As soon as the ASG is set, we will see two new instances running as per the selected desired capacity.

  1. Go to Cloudwatch and we should have two alarms created(which we created while creating the ASG)

  1. Enable the Cloudwatch monitoring for metrics collection.

  1. Now, we need to validate the ASG from CLI, and install awscli using below command-
sudo apt-get install awscli
  1. Configure the AWS CLI

  1. Run the below command to check the ASG details from CLI -
aws autoscaling describe-auto-scaling-groups --region=us-east-1

  1. Run the below command to describe ec2 instances from CLI
aws ec2 describe-instances --region=us-east-1

  1. Here, we can see the alarm was triggered when the utilization crossed the threshold.

Thank you :)

ย