Error 403, Problem with importing image data in s3 to SageMaker Notebook

0

I am working with SageMaker Notebook and image data in S3 bucket with name s3://<BucketName>/train/<class0-4> and validate data in other dir.
I create an IAM Role and put previous specific bucket, in the notebook I load this bucket with:

s3_train = 's3://<BucketName>/train'
train_data = sagemaker.session.s3_input(s3_train, distribution='FullyReplicated', 
                        content_type='application/x-image', s3_data_type='S3Prefix')

The same for train lst file, validation data and validation lst data, after create data channels with this:

data_channels = {'train': train_data, 'validation': validation_data, 
                 'train_lst': train_data_lst, 'validation_lst': validation_data_lst}

After create a TensorFlow estimator, and finally in fit pass the data with this:

tf_estimator.fit(inputs=data_channels, logs=True)

And return this menssage error:
An error occurred (403) when calling the HeadObject operation: Forbidden

Inntech
asked 4 years ago811 views
3 Answers
0
Accepted Answer

An empty bucket policy is fine. You should only make your objects public if you want everyone in the world to have access.

If you’re using a SageMaker notebook server, then when you created it you would have created (or used an existing) IAM role for it. You should check to see it’s S3 permissions, and make sure that it has access to the bucket in question.

Hope that helps.

answered 4 years ago
0

Looks like an issue with a policy attached to your role. Do you want to paste it in here so we can take a look?

answered 4 years ago
0

The bucket policy its empty, change the bucket to public access, but the files aren't public, think that the directories are public and files not. What suggest put in bucket policy??

Inntech
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions