【发布时间】:2020-11-21 20:46:39
【问题描述】:
例如,我有一个要求这些参数的 CF 模板
----- cftemplate.yaml -----
...
Parameters:
**Subnet:
Description: Subnet for the Instance
Type: 'AWS::EC2::Subnet::Id'
SecurityGroups:
Description: Security Group for Instance
Type: 'List<AWS::EC2::SecurityGroup::Id>'**
...
Resources:
EC2Instance:
Type: AWS::EC2::Instance
Properties:
...
**SubnetId: !Ref Subnet
SecurityGroupIds: !Ref SecurityGroups**
...
----- cftemplate.yaml -----
为了部署堆栈,我使用以下命令:
aws cloudformation create-stack --stack-name StackName --template-body file://cftemplate.yaml --parameters file://params.json
params.json 包含的位置:
----- params.json -----
[
{
"ParameterKey":"Subnet",
"ParameterValue":"subnet-11111111"
},
{
"ParameterKey":"SecurityGroups",
"ParameterValue":"sg-111111111",
"ParameterValue":"sg-222222222"
}
]
----- params.json -----
现在,我的目标是消除 .json 文件的使用。有谁知道应该达到与上述命令相同效果的命令的简写语法?似乎在网上的文档中找不到这个。提前致谢!
【问题讨论】:
标签: json amazon-web-services yaml amazon-cloudformation aws-cli