[英]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.