What are Launch templates?
Launch templates help you Streamline, simplify, and standardize instance launches. By creating a launch template it allows you to create a saved instance configuration that can be reused, shared, and launched at a later time.
Launch templates ensure best practices are used across the organization. As we are aware, one particular organization might be dealing with the same sort of server production environment. Also, the organization might have to spin up the same production environment for its customers or different sub-branches inside. So using launch templates we can minimize steps to provision instances.
Also, the auto-scaling will help during the AWS auto-scaling inside your EC2 fleets. Launch templates can be automatically passed to an Auto Scaling group. So we should understand a clear idea about launch configuration.
In this KB we are focusing on the step by step procedure of creating your very first Launch template.
1’st step: How to reach the “Launch Template” section in your AWS console.
- Login to your AWS console.
- Navigate to EC2 dashboard.
- Under the instance-section finds Launch Template and select the same.
- Create Launch template.
2’nd Step: Name your first Launch Template using “Launch template name and description”.
- Launch template name: Update your launch template name.
- Template version description: Update a version of the template. Eg: prod-v1
- Auto Scaling guidance: Select if you are using autoscaling, it will provide guidance to help me set up a template that I can use with EC2 Auto Scaling
3’rd Step: How to attach the “Amazon machine image (AMI)” to your Launch Template
- From the AMI session select the AMI which you wish to assign to your Launch template from the drop-down menu.
4’th Step: How to choose Instance type for your Launch template.
- Select the instance type which you wish to associate with your launch template from the drop-down menu.
5th Step: Assign your Key pair to instances which you create using this Launch template.
- You can either create a new keypair or you can assign an existing keypair to your launch template.
- Use the drop-down menu to select the existing one.
- Use the Create new key pair option left to drop-down section to create a new keypair.
6th Step: How to isolate your servers using “Network settings”.
- You can attach this to your VPC using a VPC session.
- Select the security group under your VPS using the drop-down list.
7th Step: How to add additional Storage volumes.
- Please give details asked for creating additional volume for instance created using the template.
- We can use the existing snapshot to create this volume.
8’th Step: Advanced configuration
- The advanced configuration will allow you to set different configurations for your template. So please verify each one and select if you need.
- An important step is the metadata session. Please note that using this option, we can write bootstrap script here. Once the server is created, the bootstrap script will be initiated.
Okay, now we have created our first launch template. Using this launch template we can create our servers during the instance creation. Also, I have updated before, we can use this along with the auto-scaling group.
Thanks for your time reading this. Please proceed with creating your 1st Launch template….
Is Launch template same as launch configuration?
No, launch configurations are used with Auto Scaling Groups. A launch template is used to lauch an instance using the aws EC2 console.
How to assign Amazon machine image (AMI) to your Launch Template
From the AMI session select the AMI which you wish to assign to your Launch template.