Change Elastic Beanstalk environment from Launch Configuration to Launch Template

1.4k views Asked by At

The Elastic Beanstalk docs say:

Web server environments have ... one of the following two resources.

  • AWSEBAutoScalingLaunchConfiguration (AWS::AutoScaling::LaunchConfiguration) – The launch configuration attached to your environment's Auto Scaling group.

  • AWSEBEC2LaunchTemplate (AWS::EC2::LaunchTemplate) – The Amazon EC2 launch template used by your environment's Auto Scaling group.

AWS is in the process of deprecating Launch Configurations, as Launch Templates are strictly more featured. In particular, AWS has sent a notice to customers saying:

After December 31, 2022 no new Amazon Elastic Compute Cloud (Amazon EC2) instance types will be added to launch configurations.

How do I convert an Elastic Beanstalk environment that is currently using a Launch Configuration to use a Launch Template instead?

2

There are 2 answers

4
Thomas On

I was in this exact position. I connected with AWS support and the answer I received is that launch configurations being used in Elastic beanstalk apps will be migrated automatically behind the scenes. So if your only launch configurations are generated as part of an elastic beanstalk then you have nothing to do, and the notice only applies to configurations created outside of Elastic Beanstalk.

1
cgon On

I have contacted AWS support about this issue. As of December 31 2022 AWS will deprecate launch configurations. So we have to use launch templates instead of launch configurations. And this is their response.


Firstly, the current guidance is that no action will be needed on your end regarding the launch configuration deprecation. Beanstalk will use launch configurations when needed, and will automatically use launch templates for new instances and newer features as needed. However, I will be sure to update you if this guidance changes.

However, if you wish to change your Elastic Beanstalk environments to make use of launch templates instead of a launch configuration, I suggest to enable the 'Disable IMDSv1' option in your EB environments configuration [2]. IMDS is instance metadata service and is used by code to access instance metadata. Disabling IMDSv1 requires using Amazon EC2 launch templates. When you configure this feature during environment creation or updates, Elastic Beanstalk attempts to configure your environment to use Amazon EC2 launch templates (if the environment isn't using them already).If you have custom scripts which communicates with the IMDSv1 endpoint, then you will need to ensure those are migrated to the newer IMDSv2 [3].

Additionally, please note that this may introduce some downtime while the configuration changes are being applied to the environment. I recommend creating a new environment and performing a Blue/Green deployment [4] to minimize this potential downtime. Please test this is in your non production and proceed to production based on the results in non-production.

Please refer the provided documentation and let me know if you need any help.

References:

[1] Managing environments - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.html

[2] Configuring IMDS using the Elastic Beanstalk console - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-ec2-imds.html#environments-cfg-ec2-imds.console

[3] IMDSv2 - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html

[4] Blue/Green deployments with Elastic Beanstalk - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.CNAMESwap.html