我正在运行一个AWS CloudFormation堆栈,该堆栈带有一些参数,并与其他AWS资源一起启动EC2实例。将参数输入到EC2实例的用户数据中,并基于此参数对驻留在EC2实例上的Web应用程序进行动态更改。
UserData:
Fn::Base64:
Fn::Join:
- ""
-
- "#!/bin/bash \n"
- "sh website-conf/website_mysql_config.sh "
- " -c \""
-
Ref: "CompanyName"
Run Code Online (Sandbox Code Playgroud)
如上面的示例所示,CompanyName是传递给userdata脚本的许多参数之一。问题是,当更新任何一个或多个参数时,CloudFormation不会检测到该参数,而是引发此错误。
因此,为了更新堆栈,我必须编辑堆栈并对ASG进行更改,以便CloudFormation“看到”更改并执行堆栈更新。
有没有办法在更新参数时强制CFN更新堆栈?
amazon-ec2 amazon-web-services aws-cloudformation autoscaling