skip to Main Content

For a multitude of reasons, mostly ease of use and internally broken imports, I don’t want to add AWS amplify to my current react-native project. Is there any way I can directly read objects from S3 without AWS amplify and all of the complication that comes with setting that up in an existing project?

Thanks

I’ve tried using the @aws-sdk/client-s3 but that imports packages from the NodeJS standard library (which are not available in react, such as ‘stream’). I’ve tried to setup AWS amplify but it adds far too much complexity for something as simple as reading an Object from an S3 bucket

EDIT:
I’ve had a working react native application deployed on the app store for months now, but suddenly the s3 sdk started importing the standard NodeJS library (stream). My application doesn’t require any of the IAM roles, buckets, and "amplify backends" that amplify creates for me. In the interest of keeping my app’s code as simple and straightforward as possible, I don’t want to add a whole new managed workflow for something that I don’t use

2

Answers


  1. Chosen as BEST ANSWER

    Fixed!! Quite annoyed at how simple this was:

    I restored my git branch to the last working point, deleted the node_modules, install aws-sdk (not @aws-sdk/client-s3 like I had before), and rebuilt my development client with expo, and voila!


  2. If the files in the S3 bucket are public, you can read then via simple HTTP GET. Look for the "Static Website Hosting" option in the bucket’s "Properties" tab. A better route, is to access the S3 bucket via CloudFront. Just look for articles about static hosting via S3.

    If the files are not all public, then you may want to hit a REST endpoint (e.g. API Gateway) which can check authorization and return a temporary signed-url (via Lambda) that points to the S3 file you want. The client app can then simply GET the file via the signed-url.

    If you plan to use other AWS services it should pay-off to learn and incorporate Amplify.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search