![](/img/trans.png)
[英]AWS CloudFormation template “Launch configuration name not found”
[英]Use latest launch template version in AWS Cloudformation
我正在编写一个 cloudformation (cf) 模板来配置一个自动扩展组,我提前准备了启动模板并希望使用最新版本。
我将 LaunchTemplateId 作为参数获取,但我不确定如何使用最新的午餐模板版本。
我的 cf 模板如下所示:
---
AWSTemplateFormatVersion: 2010-09-09
Description: Create Auto Scaling Group with 2 min, 2 desired, 4 max
Parameters:
...
TemplateID:
Description: Lunch Template for ASG EC2s
Type: String
Default: lt-xxxxxxxxxxxxxxxx
Resources:
ASG:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
...
LaunchTemplate:
LaunchTemplateId: !Ref TemplateID
Version: !GetAtt
- !Ref TemplateID
- LatestVersionNumber
...
但是当我运行 taskcat 进行测试时,我总是得到这个 linting 错误:
[错误]:在以下位置检测到问题:/Users/zaidafaneh/Desktop/RealBlocks/repos/cloudformation-temaplates/templates/saas/asg.yml
[错误]:第 23 行 [1010] [GetAtt 参数验证] 资源 ASG 的 GetAtt TemplateID.LatestVersionNumber 无效
我正在考虑使用 Lambda 自定义资源作为解决方法,但我觉得它太多了。 有没有办法通过cloudformation做到这一点?
!GetAtt
仅适用于在模板中创建的资源,您不能使用它来获取参数的属性。
要实现所需的工作流程,您必须:
!GetAtt
)如果启动模板是使用另一个 CloudFormation 模板创建的,那么还有第三个选项:
!GetAtt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.