【发布时间】:2019-09-22 21:32:29
【问题描述】:
我正在使用 cloudformation 模板部署堆栈,该模板使用 cloud-init 部分创建 EC2。当我部署它时,我收到以下错误消息:
The following resource(s) failed to create: [EC2Instance]. .
The requested configuration is currently not supported. Please check the documentation for supported configurations.
如果我删除“元数据”部分,一切正常并创建一个 EC2。元数据部分可能配置错误,我无法弄清楚是什么。
我将此文档用作参考 -> https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html
AWSTemplateFormatVersion: 2010-09-09
Resources:
EC2Instance:
Type: 'AWS::EC2::Instance'
Metadata:
AWS::CloudFormation::Init:
configSets:
config:
- "config1"
- "config2"
config1:
commands:
test:
command: "echo \"hello from config 1\" > test.txt"
config2:
commands:
test:
command: "echo \"hello from config 2\" > test.txt"
Properties:
InstanceType: "t2.small"
ImageId: "ami-06b382aba6c5a4f2c"
SecurityGroupIds:
- "sg-123456"
SubnetId: "subnet-123456"
KeyName: "my-example-key"
我希望创建 EC2 实例,但我收到以下错误消息:
The requested configuration is currently not supported. Please check the documentation for supported configurations. (Service: AmazonEC2; Status Code: 400; Error Code: Unsupported; Request ID: --Redacted--)
【问题讨论】:
-
@AlexHarvey 是的,这就是整个模板。堆栈是否为您成功创建?
-
@AlexHarvey 就是这么做的。那也没有用:(
-
@AlexHarvey 什么对我有用:如果我删除“元数据”部分并保持其他所有内容完好无损,它也可以工作(即使 EBS 和 IAM 位在我的原始文件中完好无损)模板)什么不起作用:如果我添加“元数据”部分,则无法创建 EC2
-
谢谢。我再次对其进行了编辑,以仅显示我认为的 minimal, complete, verifiable 示例。你能检查我最简单的版本是否也会产生错误吗?
标签: amazon-web-services amazon-ec2 amazon-cloudformation