微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

遇到不受支持的属性版本

如何解决遇到不受支持的属性版本

当我尝试运行此 CloudFormation 模板时,在 GitlabRunnerASG 上收到错误“遇到不受支持属性版本”:

        "Resources": {
        "GitlabRunnerASG": {
            "Type": "AWS::AutoScaling::AutoScalingGroup","Properties": {
                "AvailabilityZones": {
                    "Ref": "subnetASGAZ"
                },"LaunchTemplate": {             
                  "LaunchTemplateId": {
                    "Ref":"MyLaunchTemplate"
                   }
                },"Version": {
                  "Fn::GetAtt":[
                    "MyLaunchTemplate","LatestVersionNumber"
                    ]
                },"VPCZoneIdentifier": {
                    "Ref": "subnetIds"
                },"MaxSize": {
                    "Ref": "NumberOfInstances"
                },"MinSize": {
                    "Ref": "NumberOfInstances"
                },"MyLaunchTemplate": {
            "Type": "AWS::EC2::LaunchTemplate","Properties": {
              "LaunchTemplateName":{"Fn::Sub":"${AWS::StackName}-launch-template"},"LaunchTemplateData": {             
                "SecurityGroups": {
                    "Ref": "SecurityGroupName"
                },"InstanceType": {
                    "Ref": "EC2Type"
                },"ImageId": {
                    "Ref": "RunnerAMIId"
                },"IamInstanceProfile": {
                    "Arn":{"Fn::GetAtt": ["MyIamInstanceProfile","Arn"]}
                },"BlockDeviceMappings": [
                    {
                        "DeviceName": "/dev/xvda","Ebs": {
                            "DeleteOnTermination": true,"VolumeSize": {
                                "Ref": "EC2HardDriveSize"
                            },"VolumeType": "gp2"
                        }
                    }
                ],"UserData": {
                    "Fn::Base64": {
                        "Fn::Sub": ""
                    }
                }
              }
            }
        }

解决方法

AWS::AutoScaling::AutoScalingGroup 没有 getAnimals() 属性。也许这应该是 getInstitution() 的一部分?

,

建议尝试使用 CloudFormation Linter 中的 VSCode 在创作模板以及自动完成和文档链接时内联查看其中一些错误:

Visual Studio Code extension

[cfn-lint] E3003: Property Version missing at Resources/GitlabRunnerASG/Properties/LaunchTemplate
[cfn-lint] E3002: Invalid Property Resources/GitlabRunnerASG/Properties/Version

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。