[英]Can I use "Fn::Join" in "Parameters" of AWS Cloudformation json template
[英]AWS CloudFormation: how can I use parameters to form strings?
我想要實現的是:
AWSTemplateFormatVersion: "2010-09-09"
Description: deploy a full stack
Parameters:
# Product Name:
ProductName:
Type: String
Default: 'Docloud'
Description: This is the string that will appear in the names of most resources.
# Environment Name:
EnvName:
Type: String
Default: 'test-2'
Description: This is the string that will appear in the names of most resources.
# EC2 instance:
InstanceName:
Type: String
# Default: 'Earth-test-1'
Default: 'Earth-${!ProductName}-${!EnvName}'
# load balancing
NLBName:
Type: String
Default: 'NLB-${!ProductName}-${!EnvName}'
Description: the name for Network Load Balancer
TargetGroupName:
Type: String
Default: 'TG-${!ProductName}-${!EnvName}'
Description: the name of the Target Group to which the traffic from the NLB goes
我想定義 2 個參數: ProductName
和EnvName
,然后這些變量將出現在整個模板中以自動形成字符串,例如'TG-${ ProductName}-${ EnvName}'
或'NLB-${ ProductName}-${ EnvName}'
,這樣一周后部署新棧時,只需要修改ProductName
和EnvName
。
我嘗試了幾件事,但無法達到上述目標。
現在使用 CloudFormation 可以嗎?
不,這是不可能的,您必須使用嵌套堆棧或 Aws CDK 來組合變量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.