CloudFormation - LaunchTemplate for Elastic Beanstalk Environment

1

I am trying to replace Launch Configuration by Launch Template for Elastic Beanstalk environment in cloudFormation stack. The namespaces in https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html do not list Launch Template. I want to create Elastic Beanstalk environment with Launch Template for auto scaling group, and EC2 instance using cloudFormation stack. May I know how do I achieve this?

1 Answer
0
Accepted Answer

Hi There If you have an existing Elastic Beanstalk environment launched using Launch Configurations, there is nothing you need to do. See this Stackoverflow article with a quote from AWS Support: https://stackoverflow.com/questions/74647624/change-elastic-beanstalk-environment-from-launch-configuration-to-launch-templat

If you are launching a new ElasticBeanstalk environment using CloudFormation, EB will automatically use a Launch Template. You do not need to specify this in your CloudFormation template. See https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-launchtemplates.html

profile pictureAWS
EXPERT
Matt-B
answered a year ago
profile picture
EXPERT
reviewed a month ago
  • We are using aws:autoscaling:launchconfiguration namespace to configure things like InstanceType, SSHSourceRestriction, etc.

    When creating a NEW eb environment, A Launch configuration is still getting created. Once we add DisableIMDSv1 option to the cloudformation, a launch template is created instead of launch configuration.

    Questions:

    1. Can we continue to use "aws:autoscaling:launchconfiguration" namespace to configure things like InstanceType, SSHSourceRestriction ?
    2. Will there be a namespace like "aws:autoscaling:launchtemplate" in the future?
  • A year later I'm still seeing the same thing as @Max-85: If you create a new stack based on the latest elastic beanstalk example template, you'll still get an AWS::AutoScaling::LaunchConfiguration instead of a launch template.

    The docs for aws:autoscaling:launchconfiguration say:

    The instances that are used for your environment are created using either an Amazon EC2 launch template or an Auto Scaling group launch configuration resource. The following options work with both of these resource types.

    And it turns out you can use these options to configure a launch template, but you'll need to disable IMDSv1 expliticly in your cloudformation template, as follows (in the OptionSettings for the AWS::ElasticBeanstalk::ConfigurationTemplate):

    Properties:
      ...
      - Namespace: aws:autoscaling:launchconfiguration
        OptionName: DisableIMDSv1
        Value: true

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions