I am studying React Native, I played with AWS S3 before, I have set some images in my buckets, I want to do a GET, from my code, and that images are set to private.
I want to call S3 API using the React Native way just like I did on my Angular2 Project. I checked online, only found that there are third party plugin used for upload images to S3.
How would I be able to create a new S3 object in react nativevar s3 = new AWS.S3(); and call a function like s3.listBuckets(function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
}); or simply get a private image on my bucket.
Many thanks!
This functionality is now provided in the new AWS Amplify library on the AWS official repo: https://github.com/aws/aws-amplify
You can use the storage module: https://github.com/aws/aws-amplify/blob/master/media/storage_guide.md
import { Storage } from 'aws-amplify'
Storage.configure( { level: 'private' } );
Storage.get('myfile.gif');
This is an example of a private image but you can do more with the library. It will also use credentials for the user in Authenticated or UnAuthenticated state from the Auth module which integrates with Amazon Cognito.