# AWS EC2 Automation

## Launch Template in EC2

A Launch Template in Amazon EC2 is a configuration resource that simplifies and standardizes the process of launching EC2 instances. It allows you to define a set of instance settings, such as the AMI, instance type, security groups, and other parameters, in a single template. This template can then be used to launch multiple instances with the same configuration, making it easier to maintain consistency and manage your instances.

## Instance Type

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.

If you want dive deeper into ec2 and it's instance type, here is the official documentation [link](https://aws.amazon.com/ec2/instance-types/)

## Amazon Machine Image (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.

# To-day'z task

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

for creating a launch template first you need to launch a instance and the make a template out of it , so for today's task you have to first launch a instance with the userdata script so for this you may follow the day 39 blog where we have done the same

today we are starting for creating a launch template from that ec2 instance.

for creating a template go to ec2 dashboard

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696483819372/0b811539-b6fc-43cc-b178-ba4d1fa031be.png align="center")

make sure instance is up and running.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696485654953/0c2c5d01-6bf1-48d8-a04e-06399ae71572.png align="center")

it will redirect to launch template dashboard and a select source instance will be attached which mean that the template will inherit all the configuration of the choosen instance.

enter the template name and the description.

check the summary and click on "Create launch template."

once the template is created it will reflect here

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696485865942/cb5004bf-5be9-4cf6-8fcc-8eb06841d887.png align="center")

here we have successfully created the launch template

### Create 3 Instances using Launch Template, there must be an option that shows number of instances to be launched ,can you find it? :)

let's complete this task also here

now to create a instance from the template follow this steps

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696486162688/a864480c-aaba-4a77-b654-e44b2990bc0e.png align="center")

once you click all the template configuration will be inherited by a instance

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696486251180/98d562e8-5ed2-4167-8d2f-cfc2cd45aaa0.png align="center")

you can also modify the template here like if you want to change the instance type and many more configuration , you can modify it here .

now according to the task we need to run three instance at the same time form this template so for this follow this step

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696486396177/08bb18e1-a9cf-41f6-9de4-a9e52bc1c00e.png align="center")

select the number of instance you want

now click on launch instance...

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1696487202424/ad29f41c-36e3-4c6b-b577-d79dc011541e.png align="center")

and that's it, we have successfully created the launch template and after that we also tested that template and created the three template out of it .

Happy learning....spread love

follow me on LinkedIn.
