Day 40:  AWS EC2 Automation 🚀🔥

Day 40: AWS EC2 Automation 🚀🔥

Automation in EC2:

Amazon EC2, or Amazon Elastic Compute Cloud, can give you secure, reliable, high-performance, and cost-effective computing infrastructure to meet demanding business needs.

Launch template in AWS EC2:

  • You can make a launch template with the configuration information you need to start an instance. You can save launch parameters in launch templates so you don't have to type them in every time you start a new instance.
  • For example, a launch template can have the AMI ID, instance type, and network settings that you usually use to launch instances.
  • You can tell the Amazon EC2 console to use a certain launch template when you start an instance.

Instance Types:

Amazon EC2 has a large number of instance types that are optimized for different uses. The different combinations of CPU, memory, storage and networking capacity in instance types give you the freedom to choose the right mix of resources for your apps. Each instance type comes with one or more instance sizes, so you can adjust your resources to meet the needs of the workload you want to run.

AMI:

An Amazon Machine Image (AMI) is an image that AWS supports and keeps up to date. It contains the information needed to start an instance. When you launch an instance, you must choose an AMI. When you need multiple instances with the same configuration, you can launch them from a single AMI.

Task1:

Create a launch template with Amazon Linux 2 AMI and t2.micro instance type with Jenkins and Docker setup.

  • Open the Amazon EC2 interface.
  • Choose "Launch Templates" from the left navigation pane.
  • Choose "Create launch template" to start.

No alt text provided for this image

  • Give the launch template a name on the "Create a launch template" tab.

No alt text provided for this image

  • Choose "Amazon Linux 2" under "Amazon Machine Image (AMI)"

No alt text provided for this image

  • For "Instance type", choose "t2.micro"

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

  • Paste the user data script for installing Jenkins and Docker in the "User data" field of the "Advanced Details" section.

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

  • Choose "Create launch template" to start. The produced template is shown below.

No alt text provided for this image

Build 3 instances using the Launch Template; can you locate the option that displays the number of instances to be launched?

  • To use the launch template to launch three instances
  • Choose "Launch instance from templates" in the left navigation pane of the Amazon EC2 dashboard.

No alt text provided for this image

  • Choose the newly built launch template.

No alt text provided for this image

  • Enter the desired number of instances in the "Number of instances" field on the right side. Choose the other setup options, such as VPC, subnet, security group, and so forth, as desired.
  • To start the instances, select "Launch instances."

No alt text provided for this image

  • Three instances made from a template are seen.

No alt text provided for this image

You may take it a step further and make an auto-scaling group.

  • Choose "Auto Scaling Groups" from the left navigation pane.
  • "Create Auto Scaling Group" should be selected.

No alt text provided for this image

  • Give the auto-scaling group a name on the "Create Auto Scaling Group" page.
  • Choose the launch template we made earlier under "Launch Template."

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

  • Choose the VPC and subnet you want the instances to launch in under "Network".

No alt text provided for this image

  • Choose any option for "Load balancing" depending on your needs.

No alt text provided for this image

  • Enter the desired capacity for the auto-scaling group on the "Group Size" tab, for example, 2.

No alt text provided for this image

  • You can select to set up scaling strategies for "Scaling policies" based on several metrics like CPU use, network in/out, and others. Choose the tracking policy for the policy objective.

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

  • To build the auto-scaling group, select "Create Auto Scaling Group".

No alt text provided for this image

  • An autoscaling group is created.

No alt text provided for this image

  • Based on the launch template and parameters you specified, the auto-scaling group will launch the required number of instances within a short while. The auto-scaling group launched the two new instances below.

No alt text provided for this image

If you have read this far, please leave your thoughtful comments. I sincerely appreciate you taking the time to do so.🚀🔥👇🎉

To view or add a comment, sign in

More articles by Vinay Kumar

  • DevOps Project - 4 🚀🔥

    Project Description The project aims to deploy a web application using Docker Swarm, a container orchestration tool…

    7 Comments
  • DevOps Project 3 🚀🔥

    Project Description The project involves hosting a static website using an AWS S3 bucket. Amazon S3 is an object…

    3 Comments
  • DevOps Project -2 🚀🔥

    Project Description The project is about automating the deployment process of a web application using Jenkins and its…

  • Day 80: DevOps Project 1 🚀🔥

    Project Description The project aims to automate the building, testing, and deployment process of a web application…

    2 Comments
  • Day 73 - Setup Grafana on AWS EC2 Instance 🚀🚀

    Task: Set up grafana in your local environment on AWS EC2. Go to the AWS console and Launch an EC2 instance To enable…

  • Day 72 - Grafana 🚀🚀

    What is Grafana? No matter where your metrics are kept, Grafana is an open-source data visualization and monitoring…

    4 Comments
  • Day71 - Terraform Interview Questions 🚀🚀

    1. What is Terraform and how it is different from other IaaC tools? HashiCorp's Terraform is an Infrastructure as Code…

  • Day 70 - Terraform Modules 🚀🚀

    Modules are containers for multiple resources that are used together. A module consists of a collection of .

    4 Comments
  • Day 69 - Meta-Arguments in Terraform ✅🚀

    When you define a resource block in Terraform, by default, this specifies one resource that will be created. To manage…

    4 Comments
  • Day 65 - Terraform Resources 🚀🔥

    Understanding Terraform Resources A resource in Terraform represents a component of your infrastructure, such as a…

    2 Comments

Insights from the community

Others also viewed

Explore topics