Venketraman
venket's b log

venket's b log

Create Launch template for AWS EC2 - Simplify your work

Venketraman
·Sep 7, 2021·

2 min read

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.

image.png

  • Open EC2 Console in AWS. then goto launch template under instance section.

image.png

  • Create the launch template

image.png

  • Enter the launch template name and version description. Then add the template tag.

image.png

  • 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.

image.png

  • Select your key pair ,VPC and Security Group in this screen.

image.png

  • Select the Volume size and type.if you want additional volume you can add here. then click advanced details.

image.png

  • 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.

image.png

  • Now we can see the created launch template in the launch template console.

image.png

  • In the EC2 dashboard launch instance option drop down we can see the other option launch instance from template.

image.png

  • Select the Launch template you want to launch and select the version also.

image.png

image.png

image.png

image.png

  • Now you can see the Instance in the EC2 dashboard.

image.png

  • Just check the servers public IP in browser.

image.png

  • See the content that you are entered in user data.

image.png

Did you find this article valuable?

Support Venketraman by becoming a sponsor. Any amount is appreciated!

Learn more about Hashnode Sponsors
 
Share this