gpt4 book ai didi

amazon-web-services - cloudformation,创建更改时出错 : set Parameter 'ami' must be one of AllowedValues

转载 作者:行者123 更新时间:2023-12-03 07:33:53 24 4
gpt4 key购买 nike

我正在尝试在 CloudFormation 中创建一个堆栈。当我完成该流程并填充字段时,系统会要求我输入 AMI。

我键入实例 ID,但在下一个屏幕上我收到以下错误消息:

There was an error creating this change set Parameter 'ami' must be one of AllowedValues

我不确定这里需要什么类型的参数。除了 ID 之外,我还应该输入什么?

查看 AMI 详细信息,我发现 AMI 已设置为私有(private)。它不与任何帐户或组织共享。这就是它不起作用的原因吗?

我尝试在 Google 上搜索该错误消息,但没有找到任何相关内容。

谢谢

模板:

{

"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"}

} ]

}

}

}

}

最佳答案

    "ami" : {

"Description": "ami of instance",

"Type" : "AWS::EC2::Image::Id",

"AllowedValues" : [

"ami-00000000","ami-00000000", "ami-00000000"

]

}

无论您提供什么值作为 ami 参数的值,都需要是AllowedValues 之一。由于AllowedValues 中的所有ID 均无效,因此可以安全地假设您没有提供这些值之一。删除AllowedValues 约束(或更正列表)可以解决此问题:

    "ami" : {

"Description": "ami of instance",

"Type" : "AWS::EC2::Image::Id"

}

关于amazon-web-services - cloudformation,创建更改时出错 : set Parameter 'ami' must be one of AllowedValues,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70774064/

24 4 0