Search code examples
reactjsamazon-web-servicesamazon-s3aws-amplify

Multiple s3-buckets in aws amplify


so i wanted my react-amplify application to access multiple s3 buckets. I followed this tutorial and achieved it. it was pretty straightforward. the Storage.get() and Storage.put() code looks something like this respectively

Storage.get('/path/to/file', {bucket: 'bucketname'})
Storage.put('/path', 'object',{bucket: 'bucketname'} 

this code works fine. but when I try to get or put operation... I get s3-access denied error as my bucket is private.

I tried to add s3fullaccess permission to the backend role that is used by my amplify app... but still, I have no success. I am not sure what else would help me.


Solution

  • to access the s3 buckets....

    edit the authenticated or the unauthenticated role of your identity pool using IAM Roles

    edit the pre existing policies auto generated by AWS Amplify and add new new bucket arn.

    refer first half of this blog: https://medium.com/@anjanava.biswas/uploading-files-to-aws-s3-from-react-app-using-aws-amplify-b286dbad2dd7