Cloudformation错误:属性验证失败:[在{/}中遇到了不受支持的属性:[UserData]]

时间:2020-06-01 21:54:03

标签: amazon-web-services amazon-cloudformation

曾经尝试创建云形成模板。我一直在尝试使用UserData部分,并将模板简化为确定问题所在:

我收到错误消息:属性验证失败:[{/}中遇到了不受支持的属性:[UserData]]

这是我现在完全准系统的模板。我一定在做一些根本错误的事情。有人可以帮忙吗?

    {
    "AWSTemplateFormatVersion": "2010-09-09",
    "Metadata": {
        "AWS::CloudFormation::Designer": {
            "319ac38d-a9ea-4855-9a9a-4dc91f6ef092": {
                "size": {
                    "width": 60,
                    "height": 60
                },
                "position": {
                    "x": -310,
                    "y": 30
                },
                "z": 1,
                "embeds": []
            }
        }
    },
    "Resources": {
        "Cloud9Template": {
            "Type": "AWS::Cloud9::EnvironmentEC2",
            "Properties": {
                "UserData":{
                    "Fn::Base64" : {
                        "Fn::Join" : [ ",", [
                            "test",
                            "Hello World" ] ]
                    }
                },
                "AutomaticStopTimeMinutes": "45",
                "InstanceType": "t2.micro",
                "Name": {
                    "Ref": "AWS::StackName"
                }
            },
            "Metadata": {
                "AWS::CloudFormation::Designer": {
                    "id": "319ac38d-a9ea-4855-9a9a-4dc91f6ef092"
                },
                "AWS::CloudFormation::Init" : {
                    "sources" : {
                      "/home/ec2-user/environment/src" : <linktotarball>"
                    }
                }
            }
        }
    }
}

谢谢!

1 个答案:

答案 0 :(得分:0)

很遗憾,AWS::Cloud9::EnvironmentEC2 不支持 UserData,如其documentation所示。

换句话说,您不能在EnvironmentEC2资源的定义中使用UserData。