user2496965
user2496965

Reputation: 65

Grant Amazon ML permission to read from Amazon S3 programmatically

I am developing an Amazon Machine Learning application and am reading my data from amazon s3. I ran into a read permission error and found a solution using amazon explorer. I was wondering if there is a way to grant Amazon ML read-write permissions using code , maybe using aws cli or via boto sdk.

Upvotes: 1

Views: 561

Answers (2)

Minh Le
Minh Le

Reputation: 1

Just to give an answer. Create a folder in your bucket. Put the file in the folder. And make sure:

"Resource": "arn:aws:s3:::bucketname/foldername/*"

"s3:prefix": "foldername/*"

NOT your filename

Upvotes: 0

quiver
quiver

Reputation: 4470

I'll answer solutions for aws-cli.

After creating S3 bucket policy(ml_bucket_policy.json) based on the developer guide, just run $ aws cli s3api put-bucket-policy command to assign the bucket policy.

$ aws s3api put-bucket-policy --bucket YOUR_BUCKET_NAME --policy file://ml_bucket_policy.json

Be warned that you need two kinds of bucket policy.

  • One is for reading data sources.
  • Another is for creating batch predictions

Upvotes: 2

Related Questions