Skip to content

Elastic Beanstalk Environment Creation Failing Due to Launch Configuration Restrictions (probably!)

0

I'm trying to create a new Elastic Beanstalk environment but consistently running into failures related to launch templates. I've tried both the AWS Console and CLI approaches, following the official documentation at https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.CreateApp.html, but encountering the same issues.

Environment Details:

  • Platform: Corretto 17 running on 64bit Amazon Linux 2/3.7.10
  • Environment Type: SingleInstance
  • Region: us-east-1

Error Message:

Creating Auto Scaling launch configuration failed Reason: Resource handler returned message: "The Launch Configuration creation operation is not available in your account. Use launch templates to create configuration templates for your Auto Scaling groups. (Service: AutoScaling, Status Code: 400)" I've also attached a screenshot. The same thing happens no matter I create from GUI or CLI.

What I've Tried: Creating through AWS Console following the getting started guide Creating through AWS CLI with various option settings including launch template configurations Ex:

aws elasticbeanstalk create-environment \
    --application-name weshop-application \
    --environment-name weshop-prod \
    --solution-stack-name "64bit Amazon Linux 2 v3.7.10 running Corretto 17" \
    --option-settings \
      "Namespace=aws:autoscaling:asg,OptionName=MinSize,Value=1" \
      "Namespace=aws:autoscaling:asg,OptionName=MaxSize,Value=1" \
      "Namespace=aws:ec2:instances,OptionName=InstanceTypes,Value=t2.micro" \
      "Namespace=aws:ec2:vpc,OptionName=VPCId,Value=vpc-0f4ca0f3d5-------" \
      "Namespace=aws:ec2:vpc,OptionName=Subnets,Value=subnet-0089b62048e----,subnet-0b5529a-----" \
      "Namespace=aws:ec2:vpc,OptionName=ELBSubnets,Value=subnet-0089b62048e----,subnet-0b5529a3e18-----" \
      "Namespace=aws:elasticbeanstalk:environment,OptionName=EnvironmentType,Value=SingleInstance" \
      "Namespace=aws:elasticbeanstalk:application:environment,OptionName=SERVER_PORT,Value=8081" \
      "Namespace=aws:autoscaling:launchtemplate,OptionName=LaunchTemplateVersion,Value=1"
Attempted to configure launch template settings as suggested in the error message

Current Behavior:

  • Environment initially shows as "Successfully launched"
  • Shortly after, the CloudFormation stack fails with CREATE_FAILED state
  • Environment health transitions to "No Data" with no instances
  • Auto Scaling group fails to create due to launch configuration restrictions

Questions:

  1. What is the correct configuration needed to use launch templates with Elastic Beanstalk?
  2. Are there specific option settings required when using launch templates?
  3. Is there documentation specifically addressing launch template configuration for Elastic Beanstalk?

Any guidance would be greatly appreciated.

Errors on my console

4 Answers
0

The issue you're experiencing is related to AWS phasing out launch configurations in favor of launch templates. Starting October 1, 2024, new AWS accounts and existing accounts in regions where they don't already have an environment will only be able to create Elastic Beanstalk environments using launch templates.

To resolve this issue and successfully create your Elastic Beanstalk environment, you need to explicitly configure your environment to use launch templates instead of launch configurations. Here are the steps to address your questions:

  1. To use launch templates with Elastic Beanstalk, you need to set at least one of the following options in your environment configuration:

    • Set the RootVolumeType to gp3
    • Include gp3 in BlockDeviceMappings
    • Set DisableIMDSv1 to true
    • Set EnableSpot to true
  2. Yes, specific option settings are required when using launch templates. Here's an example of how you can modify your CLI command to include the necessary options:

    aws elasticbeanstalk create-environment \
        --application-name weshop-application \
        --environment-name weshop-prod \
        --solution-stack-name "64bit Amazon Linux 2 v3.7.10 running Corretto 17" \
        --option-settings \
          "Namespace=aws:autoscaling:launchconfiguration,OptionName=RootVolumeType,Value=gp3" \
          "Namespace=aws:ec2:instances,OptionName=DisableIMDSv1,Value=true" \
          ... (your other option settings)
    

    Adding one of these options will signal Elastic Beanstalk to use launch templates instead of launch configurations.

  3. While there isn't specific documentation solely addressing launch template configuration for Elastic Beanstalk, AWS has provided information about this transition in their documentation. You can find details about the transition to launch templates, including the required options and permissions, in the Elastic Beanstalk documentation.

Additionally, ensure that your IAM user or role has the necessary permissions for working with launch templates. These permissions include:

  • ec2:RunInstances
  • ec2:CreateLaunchTemplate
  • ec2:CreateLaunchTemplateVersions
  • ec2:DeleteLaunchTemplate
  • ec2:DeleteLaunchTemplateVersions
  • ec2:DescribeLaunchTemplate
  • ec2:DescribeLaunchTemplateVersions

If you're using a custom IAM policy, make sure to add these permissions. Alternatively, you can use the AdministratorAccess-AWSElasticBeanstalk managed user policy, which includes the necessary permissions.

By implementing these changes, you should be able to successfully create your Elastic Beanstalk environment using launch templates.
Sources
Launch Templates - AWS Elastic Beanstalk
Modifying the resources that Elastic Beanstalk creates for your environment - AWS Elastic Beanstalk
Creating Elastic Beanstalk environments with the AWS CLI - AWS Elastic Beanstalk

answered 10 months ago
EXPERT
reviewed 10 months ago
  • The CLI command is itself incorrect. It does not specify the Launch Template but Launch Config, I think. I used very similar commands from AI but did not work.

0

Launch configurations have/are beeing deprecated

Please use launch templates instead

EXPERT
answered 10 months ago
0

Thank you for your answer. I am using https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.ec2.console.html tutorial, but there's no similarity between the images and description provided vs what I see on my AWS console.

Also, when I try to create a new environment, I do not have an option as mentioned here to specify a launch template during the environment creation. Please see attached.

No option to specify launch template option

AWS Support need your attention as many of your tutorials seem to be falling apart from the changes you are rolling out!

answered 10 months ago
0

Hello.

Why not try running it from the EB CLI instead of the AWS CLI?
When executing, please try using ".ebextensions" as described in the article below.
https://repost.aws/articles/ARlR3V5zdsTTWrHs2mh2oThw/how-to-use-launch-templates-with-elasticbeanstalk-s-autoscaling

EXPERT
answered 10 months ago

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.