The yaml template documentation for the AWS Cloudformation AWS::SageMaker::Model ContainerDefinition specifies that "Environment" is of type Json. I can't work out how to submit json in my yaml template that does not cause a "CREATE_FAILED Internal Failure" after running a deploy with the below command.
aws cloudformation deploy --stack-name test1 --template-file test-template-export.yml
test-template-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
I have also tried the below formats as well and still no luck.
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"
Running without Environment deploys fine.
I have tried everything in this answer. How do I format this Environment argument?
My version of aws cli is "aws-cli/2.4.10 Python/3.8.8"
Hi when you see json format think more dict. So write it like this:
Containers:
- ModelPackageName: arn:aws:sagemaker:us-east-1:123456789123:model-package/name/25
Environment:
SAGEMAKER_CONTAINER_LOG_LEVEL: 20
For IAM Policies the PolicyDocument is json type and this is how AWS do it in their exempel:
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.