Skip to content Skip to sidebar Skip to footer

How To Use Ecs Credentials With Aws Js Sdk

I'm trying to access a S3 Bucket using the AWS JS SDK but without success. I got a task definition that uses a task role called Foo. This task role as an attached policy to access

Solution 1:

There was an error in the policy to access the S3 Bucket (note the /* at the end of the resource):

{"Version":"2012-10-17","Statement":[{"Sid":"","Effect":"Allow","Action":["s3:PutObject","s3:GetObject"],"Resource":"arn:aws:s3:::foo-bucket/*"}]}

Plus, the credentials option provided to the AWS SDK is not needed:

const options = {
  apiVersion: '2006-03-01',
  region: bucketSettings.region,
};

this.s3Instance = new AWS.S3(options);

Post a Comment for "How To Use Ecs Credentials With Aws Js Sdk"