Table of contents
- Launch template in AWS EC2:
- Instance Types:
- General Purpose
- Compute Optimized
- Memory Optimized
- Storage Optimized
- AMI:
- Task1:
- Create a launch template with Amazon Linux 2 AMI and t2.micro instance type with Jenkins and Docker setup (You can use the Day 39 User data script for installing the required tools.
- Create 3 Instances using Launch Template, there must be an option that shows number of instances to be launched ,can you find it? :)
- You can go one step ahead and create an auto-scaling group.
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 optimised 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.
General Purpose
General purpose instances provide a balance of compute, memory and networking resources, and can be used for a variety of diverse workloads. These instances are ideal for applications that use these resources in equal proportions such as web servers and code repositories.
Compute Optimized
Compute Optimized instances are ideal for compute bound applications that benefit from high performance processors. Instances belonging to this category are well suited for batch processing workloads, media transcoding, high performance web servers, high performance computing (HPC), scientific modeling, dedicated gaming servers and ad server engines, machine learning inference and other compute intensive applications.
Memory Optimized
Memory optimized instances are designed to deliver fast performance for workloads that process large data sets in memory.
Storage Optimized
Storage optimized instances are designed for workloads that require high, sequential read and write access to very large data sets on local storage. They are optimized to deliver tens of thousands of low-latency, random I/O operations per second (IOPS) to applications.
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 (You can use the Day 39 User data script for installing the required tools.
Create 3 Instances using Launch Template, there must be an option that shows number of instances to be launched ,can you find it? :)
You can go one step ahead and create an auto-scaling group.
Go to the Amazon EC2 console and click on "Launch Templates"
Create template with User data script as snaps are attached below:
Advanced setting and User data written the below template to install docker/jenkins under same template so that for every instance we do not need to install it separately as we can launch the instances from same template.
#!/bin/bash
yum update -y
yum install -y java-1.8.0-openjdk-devel
amazon-linux-extras install docker -y
service docker start
usermod -a -G docker ec2-user
systemctl enable docker.service
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum upgrade -y && yum install -y jenkins
systemctl start jenkins.service
systemctl enable jenkins.service
Once successfully created the template now as per requirements number of instances can be created from same template.
Action---launch instance from template
Create Autoscaling group by using same template.
Now, navigate to the EC2 Dashboard and you can see 6 servers,Autoscaling has scaled up 3 instances as we provided desired/max limit of 3 under configurations.
Conclusion:
Created template with Jenkins/docker installation in same script from same template created 3 instances so that for every instance you do not need to configure/write the script separately and created autoscaling group for the same and again scaled up few more instances with this.
Thank you for reading!! Hope you find this helpful.
#day40#90daysofdevops#devopscommunity#
Always open for suggestions..!!