Enterprise Java

AWS Launch Configuration Tutorial

In this tutorial, we’ll learn about launch configurations in Amazon AWS and how to use the AWS EC2 console to create an AWS Launch configuration.

1. Introduction

A launch configuration, as the name says, is a template for configuring instances. An Amazon EC2 Auto Scaling group uses a launch configuration to launch EC2 instances. These instances are configured in line with the configurations defined in the template.

2. Create a Launch Configuration

When you create a launch configuration, you should specify an Amazon Machine Image (AMI), to launch the instance. Additionally, we must provide the instance type, a key pair, security groups, and a block device mapping.

In AWS, a launch configuration can be created either using the Amazon EC2 console or AWS CLI or even from a running EC2 instance. In this tutorial, we’ll see the steps to create an AWS launch configuration using the EC2 console.

2.1. Create a Launch Configuration from EC2 Console

You can follow the below steps to create a new launch configuration using the AWS EC2 console.

  1. Access the Amazon EC2 console at https://console.aws.amazon.com/ec2/
  2. On the left navigation pane, in the “Auto Scaling” menu, click on  Launch Configurations.
  3. Click on Create launch configuration and in the next screen, enter a name for your launch configuration.
  4. In the AMI dropdown, choose a suitable AMI or search for an AMI by its ID. You can go through the Amazon Machine Images(AMI) tutorial for more information.
  5. To get an ID of an Amazon AMI, follow the below steps:
    • Access the Amazon EC2 console at https://console.aws.amazon.com/ec2/
    • On the left navigation pane, in the “Instances” menu, click on instances and then on Launch instances.
    • On this page, under the Quick Start tab, you can search for the desired AMI by name and note its ID displayed next to the AMI name.
  6. In the Instance type section, click on Choose instance type and select a hardware configuration for the instances created by this launch configuration. You can also search for a configuration based on different properties e.g. vCPUs, Memory, Storage, etc.
  7. The next section is “Additional configuration“, which allows adding further optional configurations. These configurations allow to:
    • Request Spot instances, with an optional maximum price specification per instance per hour.
    • Optionally attach an IAM role with the instances.
    • Enable detailed monitoring of the instances with Amazon CloudWatch.
    • Optionally launch an EBS optimized instance.
    • Choose a Kernel ID, RAM disk ID, metadata version, etc.
    • Specify user data to configure an instance when it’s launched or after it has started, by running a configuration script.
    • Optionally, assign a public IP address for the instances.
  8. You can skip the Storage (volumes) section if you do not require any additional storage. However, if you wish to attach a volume in addition to the volumes specified by the AMI, click on Add new volume and provide values for the properties DevicesSnapshotSizeVolume typeIOPSThroughputDelete on termination, and Encrypted.
  9. In the Security Groups section, you can select a security group to be assigned to the newly launched instances. You can either create a new security group or select an existing one. Make sure to have a TCP Rule created in the security group to allow SSH connections on port 22.
  10. In the next section Key Pair (login), you can either create a new key pair, choose an existing key pair or proceed without a key pair. If you choose to create a new Key Pair, give it a valid name and click on Download key pair to download the key pair to your local computer for accessing the instances created.

    It is of importance to note that you must download the private key (*.pem) file before proceeding and save it securely in an easily accessible location. It’s not possible to download the file later after it is created.

    Additionally, do not proceed without a key pair, if you wish to connect your instances in the future.

  11. The final step is to select the Acknowledge checkbox and click on the Create launch configuration button.

3. Summary

In this tutorial, we learned about the launch configuration in AWS and its importance. We also discussed the steps you should follow to create an AWS launch configuration to launch EC2 instances.

Anmol Deep

Anmol Deep is a senior engineer currently working with a leading identity security company as a Web Developer. He has 8 years of programming experience in Java and related technologies (including functional programming and lambdas) , Python, SpringBoot, Restful architectures, shell scripts, and databases relational(MySQL, H2) and nosql solutions (OrientDB and MongoDB). He is passionate about researching all aspects of software development including technology, design patterns, automation, best practices, methodologies and tools, and love traveling and photography when not coding.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button