API Gateway Proxy for S3 Bucket Files
MIT License
This project creates a Api Gateway Rest Api that serves as a proxy for S3, allowing you to download/view S3 files without the necessity of a download feature, in other words, is not necessary a Lambda to be able to download a file, the whole process will be handled by AWS infrastructure.
Easy peasy lemon squeezy:
$ yarn
Or:
$ npm install
If you need change the bucket name for any reason remember to update the custom.bucketName
in the serverless.ts
file.
If necessary more binary types add it in the StorageGatewayApi.Properties.BinaryMediaTypes
array in the serverless.ts
.
Deploy the project running the following command:
$ sls deploy --stage dev
Now run the scripts/main.js
script to upload some sample files:
$ node scripts/main.js
Then get the application Rest API URL.
route | HTTP Method |
---|---|
/images/blown.gif |
GET |
/images/programming.jpg |
GET |
/images/works.png |
GET |
Below you can see the path structure:
/{folder}/{filename}
/images
is the name of the folder where the samples were uploaded./blown.gif
, /programming.jpg
and /works.png
) is the name of the files.