Reputation: 415
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"
Upvotes: 1
Views: 1359
Reputation: 833
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 exemple:
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
Upvotes: 4