Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gipsh/aws-s3-upload-pre-signed-demo
example of using lambda for generating pre-signed urls to upload files to s3
https://github.com/gipsh/aws-s3-upload-pre-signed-demo
Last synced: 9 days ago
JSON representation
example of using lambda for generating pre-signed urls to upload files to s3
- Host: GitHub
- URL: https://github.com/gipsh/aws-s3-upload-pre-signed-demo
- Owner: gipsh
- Created: 2020-06-02T18:56:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-02T20:43:14.000Z (over 4 years ago)
- Last Synced: 2024-04-22T00:31:07.755Z (9 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aws-s3-upload-pre-signed-demo
This a demo project for uploading files to an s3 bucket using a pre-signed url
issued by a lambda function.The frontend is a static HTML + javascript page deployed also on the same bucket
## install
Just clone the repo and make sure you have serverless framework installed
For deploying the lambda function first run make to compile the golang lambda:
```bash
make
```and then:
```bash
sls deploy````
This will deploy the lambda and generate an endpoint like: https://xxxxxx.execute-api.us-east-2.amazonaws.com/dev/purl
When called the lambda return a json with a random file name and a pre-signed-url
```bash
curl https://xxxxxxxxxxxx.execute-api.us-east-2.amazonaws.com/dev/purl
``````json
{
"file":"tmp-52fdfc072182654f163f5f0f9a621d72",
"url":"https://aws-upload-pre-signed-bucket.s3.us-east-2.amazonaws.com/tmp-52fd........"
}
```Now to deploy the frontend, just copy the endpoint url and add it to the `client/dist/index.html`
and now deploy:
```bash
sls client deploy```