4

I want to replace the launch configuration with a launch template for my existing Elastic Beanstalk environment.

In the EC2 dashboard I created a launch template and selected it in the existing EB auto-scaling group. Now this works fine until I go into the EB dashboard and change the auto-scaling configuration:

enter image description here

This sets the previous launch configuration again, replacing the launch template I have set earlier.

How can I make sure the launch template is kept for the auto-scaling group, even when I change the config in the EB dashboard?

I would assume to set the launch template in the EB config and do a rolling update, but in the General Options of the EB config docs there is the aws:autoscaling:launchconfiguration option but no aws:autoscaling:launchtemplate.

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html

But when you google for "aws:autoscaling:launchtemplate" there are a few references to it.

Is EB config not compatible with launch templates yet?

2 Answers 2

2

Update 6 December 2022

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

1
  • One quick correction here, the top part (outside the quote from AWS) says that launch configs are being deprecated at the end of 2022, which is incorrect. The communication AWS sent out says that Launch Configs just aren't going to support newly released instance types starting in January, not that they're 100% going away.
    – Shahad
    Dec 12, 2022 at 16:58
1

According to AWS:

  • It is currently not possible to use Launch Templates for EB via CLI or EB dashboard.
  • AWS is already working on the feature.

As a workaround, I am manually setting the Launch Template for the auto-scaling group, and it works. Only when updating configurations through Elastic Beanstalk, the original Launch Configuration is set again and has to be manually replaced with the Launch Template.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .