【发布时间】:2022-01-20 00:27:59
【问题描述】:
我正在尝试在 CloudFormation 中创建一个堆栈。当我完成该过程并填充字段时,系统会要求我输入 AMI。
我键入实例 ID,但在下一个屏幕上我收到以下错误消息:
There was an error creating this change set Parameter 'ami' must be one of AllowedValues
我不确定这里需要什么类型的参数。除了 ID 我还应该输入什么?
查看 AMI 详细信息,我看到 AMI 设置为私有。它不与任何帐户或组织共享。这就是它不起作用的原因吗?
我尝试用谷歌搜索该错误消息,但没有找到任何相关信息。
谢谢
模板:
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Template to create a Ubuntu grafana server",
"Parameters": {
"instanceName": {
"Description": "Ubuntu Grafana",
"Type": "String"
},
"Subnet": {
c
"Description": "The subnets where the instance is created.",
"Type": "AWS::EC2::Subnet::Id"
},
"securitygroup": {
"Description": "The subnets where workers can be created.",
"Type": "List<AWS::EC2::SecurityGroup::Id>"
},
"InstanceType": {
"Description": "EC2 instance type for the node instances",
"Type": "String",
"Default": "t3.micro",
"AllowedValues": [
"t3.micro", "t3.small", "t2.medium"
],
"ConstraintDescription": "Must be a valid EC2 instance type"
},
"KeyName": {
"Description": "The EC2 Key Pair to allow SSH access to the instances",
"Type": "AWS::EC2::KeyPair::KeyName"
},
"volumeSize": {
"Description": "Size of EBS volume in GB",
"Type": "Number"
},
"ami" : {
"Description": "ami of instance",
"Type" : "AWS::EC2::Image::Id",
"AllowedValues" : [
"ami-00000000","ami-00000000", "ami-00000000"
]
}
},
"Resources" : {
"masterinstance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"BlockDeviceMappings" : [ {
"DeviceName" : "/dev/sda1",
"Ebs" : {
"DeleteOnTermination" : "False",
"Encrypted" : "False",
"VolumeSize" : {"Ref": "volumeSize"},
"VolumeType" : "gp2"
}
}],
"ImageId" : {"Ref": "ami"},
"InstanceType" : {"Ref" : "InstanceType"},
"KeyName" : {"Ref": "KeyName"},
"SecurityGroupIds" : {"Ref" : "securitygroup"},
"SubnetId" : {"Ref": "Subnet"},
"Tags" : [ {
"Key" : "Name",
"Value" : {"Ref": "instanceName"}
} ]
}
}
}
}
【问题讨论】:
-
请分享 CloudFormation 模板,或至少部分内容
-
我刚弄好了,谢谢你的帮助@Paolo
-
您的问题不清楚。您希望用户输入 AMI ID 还是希望用户从一组 ID 中进行选择?
-
您可以在模板中找到“AllowedValues”并使用列表中的值。也许你没有提供真实的。
标签: amazon-web-services amazon-cloudformation amazon-ami