A launch template, in that it specifies instance configuration information. Amazon Machine Image (AMI) Instance type Key pair Security gro...
A launch template, in that it specifies instance configuration information.
- Amazon Machine Image (AMI)
- Instance type
- Key pair
- Security groups
- Other parameters used to launch EC2 instances.
Step 1: Create EC2 instance
- OS: Ubuntu 18.05
- Instance type: t2.micro
- Security Group: WebServer(port 22,80 are opened)
- userdata:
#!/bin/bash
sudo susudo apt updatesudo apt install apache2 -ysudo echo "<h1>Testing the Launch Template app </h1>" > /var/www/html/index.html
Step 2: Verify Instance get created with Apache installed and in the running state
sudo su
systemctl status apache2
Take Public IP address of Ec2 instance and check on browser.
Step 3: Create an AMI from EC2 instance.
Select Ec2 instance
Action-->Image and Tempates ---> Image
Image :- apacheimg
Step 4: Verify Image get created
Images--->AMIs
Step 5: Create a Template from this image
Instances---> Launch Template
Click on Create Template
Launch Template Name: ApacheTemplate
Template Version: Prod
Applicaiton and OS Images AMIs: apacheimg
Instance type: t2.micro
key pair: vdevops
Security Group: Webserver
Click on Create launch Tempate
Step 6: Create Ec2 instance from Template
Select the template ApacheTemplate
Action--> Launch Instance from template
Review the template settings
Launch Instance
Step 7: Verify the Instance is created and apache is installed with a modified index.html file
COMMENTS