5
votes

I have a static website hosted on an S3 bucket. The website takes a file as an input and uploads it to another S3 bucket. I don't want to keep the bucket as public. How can I upload a file to a non-public bucket? Currently, I'm using my access key to upload a file, but I don't want to expose the access key in my Javascript code for authentication. My objective is to upload a file to a non-public bucket without exposing my access credentials.

Edit1: I used the amazon API gateway with Lambda to generate pre-signed S3 URL. This way my credentials don't get exposed.

1

1 Answers

0
votes

You can use environment variables to hide API Keys for Javascript. React and Node examples

You could also use AWS Parameter Store to store the API Keys. There are examples of how to integrate with node.js and other frameworks.