amazon-web-services - 如何修复与 AWS::CloudFormation::Init 一起创建 EC2 的 cloudformation 模板
问题描述
我正在使用 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--)
解决方案
这里使用的 AMI 是 ami-06b382aba6c5a4f2c,用于 64 位 Arm。实例类型族为 t2。ami-06b382aba6c5a4f2c 支持的实例系列是 a1。
如果您想使用 AMZ linux 2,请使用为 64 位 (x86) 架构构建的 AMI ami-0de53d8956e8dcf80。
简而言之,将 ImageId 更改为 'ami-0de53d8956e8dcf80'
希望这可以帮助..
推荐阅读
- css - 如何为除了最后一个元素之外的每个元素制作响应方块,它必须与其他元素具有相同的高度?
- node.js - 如何将存储在 POST 中的变量访问到 GET 函数中?
- python - 如何在 Python 中做柯里化函数
- python - 为什么我的 Python 用户输入代码认为输入不正确
- sharepoint - SharePoint Online 文档库结构:文件夹与文档库与许多网站
- ruby-on-rails - 尽管明确设置了无限 TTL,但 Google Cloud Storage 仍为请求的资产设置了到期日期
- javascript - 如何访问由 d3.groups 产生的内部数组?
- amazon-s3 - 如何克服 AWS Glue 作业中的 Spark“设备上没有剩余空间”错误
- spring-boot - 如何在 Spring Boot JPA 中通过 ID 保存 ManyToOne 属性
- javascript - 预加载器不会消失