我正在使用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--)
答案 0 :(得分:2)
此处使用的AMI是ami-06b382aba6c5a4f2c,用于64位Arm。实例类型族是t2。 ami-06b382aba6c5a4f2c支持的实例族是a1。
如果要使用AMZ linux 2,请使用AMI ami-0de53d8956e8dcf80,它是为64位(x86)体系结构构建的。
简而言之,将ImageId更改为'ami-0de53d8956e8dcf80'
希望这会有所帮助。