Create Launch template for AWS EC2 - Simplify your work
Play this article
Launch Templates
A launch template is similar to a launch configuration, in that it specifies instance configuration information. It includes the ID of the Amazon Machine Image (AMI), the instance type, a key pair, security groups, and other parameters used to launch EC2 instances. However, defining a launch template instead of a launch configuration allows you to have multiple versions of a launch template.
Here I am going to explain how to create the Launch template.
- Open EC2 Console in AWS. then goto launch template under instance section.
- Create the launch template
- Enter the launch template name and version description. Then add the template tag.
Select the AMI Name from the drop down.here you can select any operations system image that is available in amazon market place.you can also choose your own custom image.
Then select the Instance type.
- Select your key pair ,VPC and Security Group in this screen.
- Select the Volume size and type.if you want additional volume you can add here. then click advanced details.
- Enter Your custom User data here. I have enter the userdata to install the nginx webservice.
#!/bin/bash
apt update
apt install -y nginx
service nginx restart
systemctl enable nginx
echo "<h1>Hello Shivam</h1>" > /var/www/html/index.html
- Then finally create launch template.
- Now we can see the created launch template in the launch template console.
- In the EC2 dashboard launch instance option drop down we can see the other option launch instance from template.
- Select the Launch template you want to launch and select the version also.
- Now you can see the Instance in the EC2 dashboard.
- Just check the servers public IP in browser.
- See the content that you are entered in user data.