Cloudformation 未能满足约束:成员的长度必须小于或等于 51200

Shi*_*and 15 amazon-web-services aws-cli

使用 awscli 验证 CloudFormation 模板

aws cloudformation validate-template --template-body file://C:/path/file.yaml
Run Code Online (Sandbox Code Playgroud)

回报

failed to satisfy constraint: Member must have length less than or equal to 51200
Run Code Online (Sandbox Code Playgroud)

有可能简单修复吗?

Shi*_*and 21

validate-template --template-body最大长度限制为 51,200 字节 (50KB)。要验证本地文件,文件大小必须小于 50KB。

如果您想验证更大的模板,您可以将其上传到 s3,然后使用该--template-url参数。它的限制为 460800 字节 (450KB)

aws s3 cp $PATH_TO_FILE s3://$BUCKET_NAME/PATH
aws cloudformation validate-template --template-url https://$BUCKET_NAME.s3.amazonaws.com/path/file.yml
Run Code Online (Sandbox Code Playgroud)

  • 您的整个工作流程将更改为使用 s3 cfn 模板存储桶。当**创建**时,获取模板的摘要以进行**更改集**,您现在需要首先将模板 cp 到 s3 存储桶,然后塞入 **--template-url** (2认同)