首页 > 解决方案 > AWS CloudFormation CLI - 参数问题

问题描述

我有一个 EC2 实例,我正在尝试使用它来执行 CFN 脚本,但我遇到了以下错误:

Error parsing parameter '--parameters': Unable to retrieve https://xxxxxxxxxxxxxxxxxxxxVPC-Parameters.json: received non 200 status code of 403

请参考我的 CLI 命令:

aws cloudformation create-stack \
    --stack-name mytestVPC  \
    --template-url  https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VPC.yaml \
    --parameters https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VPC-Parameters.json \
    --tags  https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VPC-Tags.json \
    --capabilities CAPABILITY_IAM

我之前使用 CLI 执行过 CFN,但这是我第一次遇到这样的问题。我的角色拥有对所有资源的 S3 的完全访问权限。我也验证了我的--parametersJSON,它是有效的。
AWS CLI 版本:aws-cli/1.16.102 Python/2.7.16 Linux/4.14.171-105.231.amzn1.x86_64 botocore/1.12.92
当我从命令中删除--parameters--tags时,命令成功执行。
如果有人可以帮助我理解和解决这个问题,那就太好了。

标签: amazon-cloudformation

解决方案


--parameters标志具有键/值格式,例如:

ParameterKey=string,ParameterValue=string,UsePreviousValue=boolean,ResolvedValue=string ...

你不能在那里使用 URL。对--tags.

aws cloudformation create-stack \
    --stack-name mytestVPC  \
    --template-url  https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/VPC.yaml \
    --parameters ParameterKey=KeyPairName,ParameterValue=TestKey ParameterKey=SubnetID,ParameterValue=SubnetID1 \
    --tags  Key=MyTag,Value=MyTagValue \
    --capabilities CAPABILITY_IAM

参考


推荐阅读