amazon-web-services - 当自定义命名资源需要替换时,CloudFormation 无法更新堆栈
问题描述
我有一个 CloudFormation 模板,它创建了一个启动配置:
Resources:
# Launch Configuration for the instances in the Atoscaling Group
LaunchConfiguration:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
AssociatePublicIpAddress: false
ImageId: !Ref EC2AMI
InstanceType: !Ref EC2InstanceType
KeyName: !Ref EC2Key
IamInstanceProfile: !ImportValue EC2RoleInstanceProfileARN
LaunchConfigurationName: jxt-private-asg-launch-config
SecurityGroups:
- !ImportValue PrivateSecurityGroupId
当我尝试更新堆栈时,出现以下错误:
当自定义命名资源需要替换时,CloudFormation 无法更新堆栈
我通过 TeamCity 运行此脚本,因此用户不可能每次都更改启动配置的名称。我能做些什么来摆脱这个错误?
解决方案
一种解决方案可以是省略,LaunchConfigurationName
因为它不是强制性的。
复制自AWS::AutoScaling::LauncConfiguration 文档:
启动配置的名称。此名称在每个区域的每个账户中必须是唯一的。[...]
更新要求:更换
您面临的问题是您进行了更改,需要更换启动配置。通常,CloudFormation 会创建一个新资源(以防现有资源无法更新),将任何依赖资源指向新资源,然后删除旧资源。但是,如果资源使用静态名称,则此操作将失败,因为它与文档中提到的唯一名称约束冲突。
推荐阅读
- c# - 在 ASP.NET 中设置日常工作
- windows - Windows 10 平板电脑上的 Windows 窗体应用程序?
- angular - nGINX / Angular 4 HTTP 第一次加载性能
- javascript - 不是 googlemaps api javascript 中的函数错误
- mysql - 如何在 Jasper 上显示多行数据
- ios - Swinject 容器注册失败
- c++ - Qt将应用程序对齐到屏幕的左上角
- elasticsearch - 将日志从 kafka 传输到 elasticsearch
- ios - 将 forwardIcon 添加到以编程方式创建的 UIButton
- php - TYPO3 TCA 值作为流体上的变量