Jus*_*tin 1 amazon-web-services aws-cloudformation
尝试部署嵌套的 Cloudformation 堆栈。如果我硬编码TemplateURL如下,工作正常-
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MyStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.eu-west-1.amazonaws.com/my-bucket/my-template.yml
Run Code Online (Sandbox Code Playgroud)
但是一旦我开始在TemplateURL例如内进行任何字符串替换
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MyStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub "https://s3.#{AWS::Region}.amazonaws.com/my-bucket/my-template.yml"
Run Code Online (Sandbox Code Playgroud)
然后在部署时我得到 -
AWS::CloudFormation::Stack | CREATE_FAILED | TemplateURL must be an Amazon S3 URL.
Run Code Online (Sandbox Code Playgroud)
I have tried different flavours of !Sub and Fn::Sub, and with using custom defined variables rather than AWS::Region, but always the same result :-/
What am I doing wrong here ?? TIA.
You should use ${AWS::Region} instead of #{AWS::Region} (dollar sign instead of hashtag)
A string with variables that AWS CloudFormation substitutes with their associated values at runtime. Write variables as ${MyVarName} [...]
来源:https : //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html
| 归档时间: |
|
| 查看次数: |
422 次 |
| 最近记录: |