【发布时间】:2018-09-23 14:27:18
【问题描述】:
您好,下面是我在 AWS 中创建启用了弹性 IP 的实例的模板。但是我不确定我哪里出错了。我已经通过在线 json 验证器验证了 json 仍然面临问题请帮助
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "My learning template",
"Parameters" : {
"KeyName": {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the web server",
"Type": "AWS::EC2::KeyPair::KeyName",
"Default" : "Myvirginiakey",
"ConstraintDescription" : "must be the name of an existing EC2 KeyPair."
},
"EC2InstanceType" : {
"Type" : "String",
"Default" : "t2.micro",
"AllowedValues" : ["t2.micro", "m1.small", "m1.large"],
"Description" : "Enter t2.micro, m1.small, or m1.large. Default is t2.micro."
}
},
"IPAddress" : {
"Type" : "AWS::EC2::EIP"
},
"IPAssoc" : {
"Type" : "AWS::EC2::EIPAssociation",
"Properties" : {
"InstanceId" : { "Ref" : "EC2Instance" },
"EIP" : { "Ref" : "IPAddress" }
}
},
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"UserData" : { "Fn::Base64" : { "Fn::Join" : [ "", [ "IPAddress=", {"Ref" : "IPAddress"}]]}},
"KeyName" : { "Ref" : "KeyName"},
"ImageId": "ami-0912f71e06545ad88",
"InstanceType" : { "Ref" : "EC2InstanceType"}
}
}
},
"Outputs" : {
}
}
错误信息是:
“无效的模板属性或属性”模板验证错误:无效的模板属性或属性 [IPAssoc, IPAddress]”
【问题讨论】:
标签: json amazon-web-services amazon-cloudformation