CloudFormation:模板的Outputs块中的未解析资源依赖项[Ec2Instance]

时间:2018-10-24 07:28:57

标签: json amazon-web-services amazon-ec2 amazon-cloudformation

我正在尝试使用cloudFormation模板创建EC2实例。 我为此编写了以下JSON,并尝试使用CloudFormation“将模板上传到Amazon S3”中的选项上传json。 但是上传JSON之后,我得到了错误:

  

模板验证错误:模板的Outputs块中未解决的资源依赖性[Ec2Instance]。

请告知我这里出了什么问题?

{
    "Description": "Create an EC2 instance running the latest amazon Linux AMI.",
    "Parameters": {
        "KeyPair": {
            "Description": "The EC2 key Pair to allow SSH access to the instance",
            "Type": "String"
        }
    },
    "Resources": {
        "EC2Instance": {
            "Properties": {
                "ImageId": "ami-9d23aeea",
                "InstanceType": "t2.micro",
                "KeyName": {
                    "Ref": "KeyPair"
                }
            },
            "Type": "AWS::EC2::Instance"
        }
    },
    "Outputs": {
        "InstanceId": {
            "Description": "The InstanceId of newly created EC2 instance",
            "Value": {
                "Ref": "Ec2Instance"
            }
        }
    },
    "AWSTemplateFormatVersion": "2010-09-09"
}

1 个答案:

答案 0 :(得分:1)

我认为您刚刚打错字了。资源列表中的EC2Instance和输出中的Ec2Instance