#90DaysOfDevOps Challenge - Day 47 - Test Knowledge on AWS

#90DaysOfDevOps Challenge - Day 47 - Test Knowledge on AWS

Welcome to Day 47 of the #90DaysOfDevOps Challenge. In today's session, we will put our AWS knowledge to the test and explore some hands-on exercises to deepen our understanding of AWS services. We will focus on two tasks: launching an EC2 instance and creating an Auto Scaling group. Let's dive in!

Task 1: Launch an EC2 Instance and Deploy a Web Application

Step 1: Launch an EC2 instance using the AWS Management Console

  • Log in to the AWS Management Console.

  • Navigate to the EC2 service.

  • Click on "Launch Instances" and follow the wizard to configure your instance.

  • Select the desired instance type, security group, and other settings.

  • Choose an appropriate Amazon Machine Image (AMI) for your web server.

  • Review your configuration and launch the instance.

Step 2: Connect to the EC2 instance using your preferred method

Step 3: Install a web server and deploy a simple web application

  • Update the package manager on your EC2 instance.

      sudo apt update
    
  • Install a web server of your choice (e.g., Apache, Nginx). You can test it by accessing the public IP Address of the EC2 instance once installed.

      sudo apt install apache2
    

  • Deploy a simple website index.html to the appropriate directory /var/www/html

      <!DOCTYPE html>
      <html>
      <head>
          <title>Esteban Moreno - #90daysofdevopschallenge</title>
      </head>
      <body>
          <h1>Esteban Moreno - #90daysofdevopschallenge</h1>
          <p>Welcome to my simple website.</p>
      </body>
      </html>
    
  • Test the web application by accessing the public IP address of your EC2 instance in a web browser.

Step 4: Monitor the EC2 instance using Amazon CloudWatch

  • Go to the Amazon CloudWatch service in the AWS Management Console.

  • Create a new CloudWatch dashboard.

  • Add widgets to monitor key metrics of your EC2 instance, such as CPU utilization, network traffic, and disk usage.

  • Set up CloudWatch alarms to receive notifications when certain thresholds are exceeded.

  • Monitor the performance of your EC2 instance and troubleshoot any issues that arise.

Task 2: Create an Auto Scaling Group and Monitor Performance

Step 1: Create an Auto Scaling group using the AWS Management Console

  • Navigate to the Auto Scaling service in the AWS Management Console.

  • Click on "Create Auto Scaling group" and follow the wizard to configure your group. A template of the existing EC2 is required to create an ASG.

  • Navigate to the existing EC2 instance and create a template

  • Specify the desired capacity, instance type, and other settings.

  • Set up scaling policies based on demand or schedule.

  • Configure the desired monitoring and health checks for your instances.

Step 2: Use Amazon CloudWatch to monitor the performance of the Auto Scaling group

  • You can navigate to the Monitoring section of the Auto Scaling Group to view the monitored metrics.

  • You can add the above metrics to the dashboard created earlier.

  • Set up CloudWatch alarms to receive notifications using the available metrics.

  • Monitor the performance of your Auto Scaling group and troubleshoot any issues that arise.

Step 3: Use the AWS CLI to view the state of the Auto Scaling group and the EC2 instance

  • Install the AWS CLI on your local machine if you haven't already.

      sudo apt install awscli
    
  • Configure the AWS CLI with your AWS credentials.

      aws configure
    
  • Use the AWS CLI commands to view the state of your Auto Scaling group, such as the number of instances running and the scaling activities.

      aws autoscaling describe-auto-scaling-groups
    

  • Verify that the correct number of instances are running and that the Auto Scaling group is functioning as expected.

      aws ec2 describe-instances
    

Congratulations! You have completed the tasks for Day 47 of the #90DaysOfDevOps Challenge. By launching an EC2 instance, deploying a web application, creating an Auto Scaling group, and monitoring the performance using Amazon CloudWatch, you have gained valuable hands-on. Stay tuned for a new AWS service on day 48.

Did you find this article valuable?

Support Esteban Moreno by becoming a sponsor. Any amount is appreciated!