You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

创建AWS Elastic Beanstalk应用时如何规避AWSEBAutoScalingLaunchConfiguration错误?

Elastic Beanstalk环境启动失败问题解决

问题背景

创建运行在64bit Amazon Linux 2023/4.3.8上的Docker版AWS Elastic Beanstalk应用,采用以下配置:

  • IMDSv1 已禁用
  • 环境类型:单实例
  • 可用区:任意
  • 实例组合:按需实例
  • 实例类型:t3.micro
  • 按需基础数量:0
  • 代理服务器:nginx

但环境启动失败,报错如下:

  1. 创建Auto Scaling启动配置失败: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, Request ID: e4a071d6-34d4-411f-92da-6d19cf888015)
  2. CloudFormation堆栈awseb-e-ex3sx4wzyp-stack创建失败,原因是AWSEBAutoScalingLaunchConfiguration资源创建失败
  3. CloudFormation提示Resource AWSEBAutoScalingGroup does not exist for stack awseb-e-ex3sx4wzyp-stack

已为用户添加autoscaling:CreateLaunchConfiguration权限,但问题仍存在。

核心原因

AWS已逐步淘汰Auto Scaling启动配置(Launch Configuration),部分区域已完全禁止创建启动配置,而Elastic Beanstalk默认仍尝试使用启动配置,触发了服务级限制,该限制无法通过添加权限绕过。

解决步骤

1. 通过配置文件强制使用启动模板

在应用根目录创建.ebextensions文件夹,新建launch-template-override.config文件,内容如下:

Resources:
  AWSEBAutoScalingLaunchConfiguration:
    Type: AWS::AutoScaling::LaunchTemplate
    Properties:
      LaunchTemplateName: !Sub ${AWSEBEnvironmentName}-lt
      LaunchTemplateData:
        ImageId: !Ref AWSEBImageId
        InstanceType: !Ref AWSEBInstanceType
        SecurityGroups: !Ref AWSEBSecurityGroups
        IamInstanceProfile: !Ref AWSEBInstanceProfile
        UserData: !Base64 !Ref AWSEBUserData

2. 清理现有失败环境

在AWS控制台删除当前处于CREATE_FAILED状态的Elastic Beanstalk环境和对应的CloudFormation堆栈,避免残留资源干扰后续部署。

3. 重新部署应用

将包含.ebextensions文件夹的应用代码重新打包,上传到Elastic Beanstalk并创建新环境,保持原有配置(单实例、t3.micro等)即可。

额外说明

  • 启动模板是AWS当前推荐的Auto Scaling实例配置方式,功能比启动配置更丰富
  • 管理员权限已足够创建启动模板,无需额外添加权限

内容的提问来源于stack exchange,提问作者Przemek

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 01:27:09