amazon-web-services - 遇到不支持的属性版本
问题描述
当我尝试运行此 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": ""
}
}
}
}
}
解决方案
建议在VSCode中尝试CloudFormation Linter以在编写模板以及自动完成和文档链接时内联查看其中一些错误:
[cfn-lint] E3003: Property Version missing at Resources/GitlabRunnerASG/Properties/LaunchTemplate
[cfn-lint] E3002: Invalid Property Resources/GitlabRunnerASG/Properties/Version
推荐阅读
- angular - 使用 fontawesome 进行业力测试 - “@fortawesome/free-brands-svg-icons”:“^5.10.0”,在模板中会在控制台上引发错误
- flutter - 在颤动中将 List.toString() 转换为 List
- python - python中联系人的正则表达式
- sql-server - Need to ensure a hyphen between string
- ansible - Ansible kerberos auth : user account is failing to connect node
- go - PHP and Go RC4-Decrypt
- php - PHP - 从 foreach 中删除重复项
- angular - I have this error: this.authService.isAuthenticated is not a function
- docker - Can I Assign Pod to a NIC?
- java - 将 Ignite 与 mysql 一起用作第 3 方持久存储时,如何确保缓存键和对象 ID 相同