ValidationError when creating a SageMaker Model

Question:

I’m new to AWS and trying to build a model (from the web console) by referring to their demo. However, when I try to create the model, it gives me the below error.

Could not access model data at
https://s3.console.aws.amazon.com/s3/buckets/bucket_name/models/model_name-v0.1.hdf5.
Please ensure that the role
“arn:aws:iam::id:role/service-role/AmazonSageMaker-ExecutionRole-xxx
exists and that its trust relationship policy allows the action
“sts:AssumeRole” for the service principal “sagemaker.amazonaws.com”.
Also ensure that the role has “s3:GetObject” permissions and that the
object is located in eu-west-1.

I checked the IAM Role and it has AmazonSageMakerFullAccess and AmazonS3FullAccess policies attached. And also, the trust relationship is also specified for the role (as below).

I’m specifying the ECR and the S3 path correctly, but I can’t figure out what is happening. Can someone help me to fix this?

Sorry if I couldn’t provide more info, but I will give any other information if required.

UPDATE:

Below are the IAM policies.

AmazonS3FullAccess

AmazonSageMaker-ExecutionPolicy-xxx

AmazonSageMakerFullAccess

Answer:

I think the sagemaker execution policy is missing permission at bucket level. Try adding "arn:aws:s3:::<bucket_name>" to the AmazonSageMaker-ExecutionPolicy-xxx


{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::<bucket_name>"
]
},
{
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::<bucket_name>",
"arn:aws:s3:::<bucket_name>/*"
]
}
]
}

I ran the demo with SageMaker execution policy as below and it works. This is much permissive policy. You can change it as per your bucket name once it works.


{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}

Leave a Reply