[英]AWS Cloudformation- How to do string Uppercase or lowercase in json/yaml template
[英]How to format parameter of data type json in a aws cloudformation yaml template?
AWS Cloudformation AWS::SageMaker::Model ContainerDefinition 的 yaml 模板文档指定“环境”的类型为 ZEED8D85B888A6C015834240885EE633。 在使用以下命令运行部署后,我无法弄清楚如何在我的 yaml 模板中提交 json,该模板不会导致“CREATE_FAILED 内部故障”。
aws cloudformation deploy --stack-name test1 --template-file test-template-export.yml
测试模板export.yml
Description: Example yaml
Resources:
Model:
Type: AWS::SageMaker::Model
Properties:
Containers:
- ModelPackageName: arn:aws:sagemaker:us-east-1:123456789123:model-package/name/25
- Environment: '{"SAGEMAKER_CONTAINER_LOG_LEVEL": "20"}'
ExecutionRoleArn: arn:aws:iam::123456789123:role/service-role/AmazonSageMakerServiceCatalogProductsUseRole
我也尝试了以下格式,但仍然没有运气。
Containers:
- ModelPackageName: arn:aws:sagemaker:us-east-1:123456789123:model-package/name/25
Environment: '{"SAGEMAKER_CONTAINER_LOG_LEVEL": "20"}'
--
Containers:
- ModelPackageName: arn:aws:sagemaker:us-east-1:123456789123:model-package/name/25
- Environment: |
{
"SAGEMAKER_CONTAINER_LOG_LEVEL": "20"
}
--
Containers:
- ModelPackageName: arn:aws:sagemaker:us-east-1:123456789123:model-package/name/25
- Environment:
- SAGEMAKER_CONTAINER_LOG_LEVEL: "20"
在没有环境的情况下运行部署良好。
我已经尝试了这个答案中的所有内容。 如何格式化此 Environment 参数?
我的 aws cli 版本是“aws-cli/2.4.10 Python/3.8.8”
嗨,当您看到 json 格式时,请考虑更多 dict。 所以这样写:
Containers:
- ModelPackageName: arn:aws:sagemaker:us-east-1:123456789123:model-package/name/25
Environment:
SAGEMAKER_CONTAINER_LOG_LEVEL: 20
对于 IAM 策略,PolicyDocument 是 json 类型,这就是 AWS 在其示例中的做法:
Type: 'AWS::IAM::Policy'
Properties:
PolicyName: CFNUsers
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- 'cloudformation:Describe*'
- 'cloudformation:List*'
- 'cloudformation:Get*'
Resource: '*'
Groups:
- !Ref CFNUserGroup
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.