Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Create a Launch Configuration
2.1.
Console
2.2.
AWS CLI
3.
EC2 Instance
3.1.
Create a Launch Configuration using an EC2 instance
3.2.
Console
3.3.
AWS CLI
4.
Change the Launch Configuration (Auto Scaling group)
4.1.
Console
4.2.
AWS CLI
4.3.
Tools for Windows PowerShell
5.
Configure instance tenancy with a launch configuration
5.1.
AWS CLI
6.
FAQs
6.1.
Can we edit the launch configuration AWS?
6.2.
What configurations are required to release a new EC2 example?
6.3.
Where is the option for the Auto Scaling as launch config available in the AWS management Console?
6.4.
What is launch configuration in AWS?
7.
Conclusion
Last Updated: Mar 27, 2024
Easy

Launching Configurations in AWS EC2 Auto Scaling

Author Amit Kumar
0 upvote
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

Introduction

In this weblog, we will find a magical way to create a launching configuration in AWS EC2 Auto Scaling and learn how to change the launch configuration and increase your knowledge about configuring instance tenancy with a launch configuration. The Get Start with Amazon EC2 Auto Scaling tutorial introduces the numerous building blocks utilised in launching configuration in AWS.

Create a Launch Configuration

When creating a launch configuration, you must specify data approximately the EC2 times to launch. Include the Amazon Machine Image (AMI), instance kind, key pair, protection businesses, and block device mapping. Alternatively, you can create a release configuration using attributes from a strolling EC2 example. For extra information, see Create a launch configuration using an EC2 instance.

Console

1. Select the Amazon EC2 console at Amazon EC2.
 

2. On the navigation pane, underneath Auto Scaling, choose Launch Configurations.
 

3. In the navigation bar, pick out your AWS Region.
 

4. Choose to Create a release configuration and input a name to your release configuration.
 

5. For Amazon Machine Image (AMI), choose an AMI. To discover a particular AMI, you could find a suitable AMI, note its ID, and enter the ID as you try to find the basis. To get the ID of the Amazon Linux 2 AMI:

  • Select the Amazon EC2 console at Amazon EC2.
  • In the navigation pane, below Instances, select Instances, and then pick Launch times.
  • On the Quick Start tab of the Select an Amazon Machine Image internet page, phrase the ID of the AMI next to Amazon Linux 2 AMI (HVM).
     

6. For Instance kind, select a hardware configuration for your times.
 

7. Under Additional configuration, take note of the following fields:

  • For Purchasing opportunity, you could pick out Request Spot Instances to request Spot Instances on the Spot charge, capped at the On-Demand fee. You may specify a maximum rate in line with the example hour in your Spot Instance.
     
  • Choose a feature to associate with the instances for the IAM example profile. See IAM's position for programs on  Amazon EC2 instances for more facts.
     
  • (Optional) For Monitoring, choose whether to permit the times to publish metric statistics at 1-minute intervals to Amazon CloudWatch via allowing specific monitoring. Additional expenses practice. For more critical data, see Configure tracking for Auto Scaling instances.
     
  • (Optional) For Advanced info, User statistics, you may specify man or woman data to configure an instance inside the release course or run a configuration script after the sample begins.
     
  • (Optional) For Advanced info, IP cope with kind, choose whether or not or not to assign a public IP cope with to the group's instances. If you no longer set a value, the default is to apply the automobile-assign public IP settings of the subnets that your instances are released into.
     

8. (Optional) For Storage (volumes), if you don't need more storage, you may pass this phase. Otherwise, to specify volumes to connect to the times similar to the books unique with the aid of the AMI, select Add new quantity. Then select the favoured options and corresponding values for Devices, Snapshot, Size, Volume kind, IOPS, Throughput, Delete on termination, and Encrypted.
 

9. For Security companies, create or pick the protection organisation to companion with the organisation's times. If you depart, the Create a brand new safety organisation choice is decided on, and a default SSH rule is configured for Amazon EC2 instances strolling Linux. A default RDP rule is configured for Amazon EC2 times walking Windows.
 

10. For Key pair (login), pick a choice underneath Key Pair options. You could select it properly if you've already configured an Amazon EC2 example key pair. If you do not have an Amazon EC2 example key pair, select Create a new critical team and deliver it a recognisable name. Choose Download key pair to download the key pair on your laptop. Important, if you need to hook up with your instances, do not choose-out. Proceed without a key pair.
 

11. Select the acknowledgement, take a look at a field and then pick out Create launch configuration.

AWS CLI

To create a launch configuration, use the command line. You can use one of the following commands:

  • create-launch-configuration (AWS CLI)
     
  • New-ASLaunchConfiguration (AWS Tools for Windows PowerShell)
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

EC2 Instance

There are differences between growing a launch configuration from scratch and growing a launch configuration from a present EC2 example. When creating a release configuration from scratch, you specify the photo ID, instance type, non-obligatory assets (such as storage gadgets), and non-compulsory settings (like monitoring). When you create a release configuration from taking walks instance, Amazon EC2 Auto Scaling derives attributes for the release configuration from the desired model. Features are also derived from the block device mapping for the AMI from which the instance became released, ignoring any more block gadgets brought after launch. When you create a release configuration using a walking illustration, you can override the subsequent attributes with the aid of specifying them as a part of the identical request: AMI, block devices, key pair, instance profile, instance type, kernel, example tracking, placement tenancy, ramdisk, protection corporations, Spot (max) charge, patron records, whether the instance has a public IP deal with, and whether the model is EBS-optimized. 

Create a Launch Configuration using an EC2 instance

To make a launch configuration, use the attributes of a current EC2 model, and specify the ID of the example.

Console

You can use the console to create a release configuration and an Auto Scaling group from a strolling EC2 example and add the instance to the new Auto Scaling group. For extra records, see Attach EC2 instances on your Auto Scaling company.

AWS CLI

Select the  create-launch-configuration command to create a launch configuration from an example using identical attributes as the instance. Any block devices delivered after launch are omitted.

AWS autoscaling create-launch-configuration --launch-configuration-name my-lc-from-instance --instance-id i-a8e09d9c

 

We can use the following describe-launch-configurations command to describe the release configuration and verify that its attributes are healthful like the ones of the instance.

AWS autoscaling describe-launch-configurations --launch-configuration-names my-lc-from-instance

 

The following is an example response.

{
    "LaunchConfigurations": [
        {
            "UserData": null,
            "EbsOptimized": false,
            "LaunchConfigurationARN": "arn",
            "InstanceMonitoring": {
                "Enabled": false
            },
            "ImageId": "ami-05355a6c",
            "CreatedTime": "2014-12-29T16:14:50.382Z",
            "BlockDeviceMappings": [],
            "KeyName": "my-key-pair",
            "SecurityGroups": [
                "sg-8422d1eb"
            ],
            "LaunchConfigurationName": "my-lc-from-instance",
            "KernelId": "null",
            "RamdiskId": null,
            "InstanceType": "t1.micro",
            "AssociatePublicIpAddress": true
        }
    ]
}

Change the Launch Configuration (Auto Scaling group)

An Auto Scaling organisation is related to one release configuration at a time, and also, you can't regulate a released design after you've erected it. To change the launch ordering for an Auto Scaling organisation, use a present release configuration because of the concept of a modern-day release configuration. Then, update the Auto Scaling group to apply the ultra-modern release configuration.

Console

  1. Open the Amazon EC2 console with the help of this given link  (https://console.Aws.Amazon.Com/ec2/).
     
  2. On the navigation pane below Auto Scaling, pick Launch Configurations.
     
  3. Select the launch configuration and pick Actions. Copy the launch configuration. This unit up a trendy launch configuration with identical alternatives to the proper; however, "Copy" was added to the name.
     
  4. On the Copy Launch Configuration web page, edit the configuration options as desired and select out to Create launch configuration.
     
  5. On the navigation pane, beneath Auto Scaling, choose out Auto Scaling Groups.
     
  6. Select the take a look at a field next to the Auto Scaling organisation.
     
  7. A break up-pane opens up at the bottom of the page, displaying information approximately the chosen agency.
     
  8. On the Details tab, pick out Launch configuration, Edit.
     
  9. For Launch configuration, pick out the brand new release configuration.
     
  10. When you have been given complete, pick out Update.

AWS CLI

  1. Describe the current release configuration and the usage of the describe-launch-configurations command.
     
  2. Create a brand new launch configuration using the create-launch-configuration command.
     
  3. Update the Auto Scaling institution's launch configuration with the replace-automobile-scaling-group command with the --launch-configuration-names parameter.

Tools for Windows PowerShell

  1. Explain the present-day release configuration with the use of the Get-ASLaunchConfiguration command.
     
  2. Make a new launch configuration using the New-ASLaunchConfiguration command.
     
  3. Update the launch configuration for the Auto Scaling group with the usage of the Update-ASAutoScalingGroup command with the -LaunchConfigurationName parameter.

Configure instance tenancy with a launch configuration

Tenancy defines how EC2 times are allotted across physical hardware and impacts pricing. There are three tenancy alternatives to be had:

  • Shared (default) — Multiple AWS debts may additionally proportion the equal physical hardware.
     
  • Dedicated Instance (dedicated) — Your instance runs on single-tenant hardware.
     
  • Dedicated Host (host) — Your example runs on a physical server with EC2 instance ability entirely committed for your use, a far-flung server with configurations that you can control.

AWS CLI

Use the subsequent create-release-configuration command to generate a release configuration that sets the release configuration tenancy to commit.

AWS autoscaling create-launch-configuration --launch-configuration-name my-launch-config --placement-tenancy dedicated --image-id 

 

We can use the following describe-release-configurations command to affirm the example placement tenancy of the launch configuration.

aws autoscaling describe-launch-configurations --launch-configuration-names my-launch-config

 

For example, output for a release configuration that creates Dedicated Instances. The PlacementTenancy parameter is only a part of the output for this command while you explicitly set the example placement tenancy.

{
    "LaunchConfigurations": [
        {
            "UserData": null,
            "EbsOptimized": false,
            "PlacementTenancy": "dedicated",
            "LaunchConfigurationARN": "arn",
            "InstanceMonitoring": {
                "Enabled": true
            },
            "ImageId": "ami-b5a7ea85",
            "CreatedTime": "2020-03-08T23:39:49.011Z",
            "BlockDeviceMappings": [],
            "KeyName": null,
            "SecurityGroups": [],
            "LaunchConfigurationName": "my-launch-config",
            "KernelId": null,
            "RamdiskId": null,
            "InstanceType": "m3.medium"
        }
    ]
}

FAQs

Can we edit the launch configuration AWS?

An Auto Scaling group is related to one release configuration at a time, and you can't regulate a launch configuration after you've created it. To exchange the launch configuration for an Auto Scaling institution, use a current launch configuration as the idea for a brand new release configuration.

What configurations are required to release a new EC2 example?

When you create a release configuration, you must specify facts about the EC2 times to release. Include the Amazon Machine Image (AMI), example kind, key pair, safety corporations, and block device mapping. Alternatively, you could create a release configuration using attributes from a jogging EC2 example.

Where is the option for the Auto Scaling as launch config available in the AWS management Console?

Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . On the navigation pane, under Auto Scaling, select Launch Configurations. In the navigation bar, select your AWS Region. Choose Create launch configuration, and make the launch configuration the usual way.

What is launch configuration in AWS?

A launch configuration is a template that an EC2 Auto Scaling organization makes use of to launch EC2 instances. When you create a release configuration, you specify records for the instances including the ID of the Amazon Machine Image (AMI), the example kind, a key pair, one or more safety corporations, and a block device mapping.

Conclusion

This blog discussed the concept of AWS EC2 Auto Scaling and one of the Launching Configurations offered by AWS EC2. We mentioned the significance of making and converting the configuration in AWS  in detail with the assistance of an instance application. 

We hope this blog has helped you beautify your information concerning Launching Configurations in AWS EC2 Auto Scaling.

To learn more, see Operating System, Unix File System, File System Routingand File Input/Output.

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and Algorithms, Competitive Programming, JavaScriptSystem Design, and many more! If you want to test your competency in coding, you may check out the mock test series and participate in the contests hosted on Coding Ninjas Studio! But if you have just started your learning process and are looking for questions asked by tech giants like Amazon, Microsoft, Uber, etc; you must look at the problems, interview experiences, and interview bundle for placement preparations.

Nevertheless, you may consider our paid courses to give your career an edge over others!

Do upvote our blogs if you find them helpful and engaging!

Happy Learning!

Previous article
Launching Templates in AWS EC2 Auto Scaling
Next article
AWS EC2 Auto Scaling
Live masterclass