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?

Shalini
已提問 1 年前檢視次數 426 次
1 個回答
0
已接受的答案

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
專家
Matt-B
已回答 1 年前
profile picture
專家
已審閱 1 個月前
  • 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

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南