This repository has been archived on 2026-03-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nginx-s3-upload/README.MD
T

28 lines
1.0 KiB
Markdown
Raw Normal View History

2019-06-20 13:07:42 +02:00
# nginx-s3-upload
Uploads files to s3 bucket. Basically an [nginx](http://nginx.org/en/docs/) which `proxy_pass` `HTTP POST` requests to [S3](https://aws.amazon.com/s3) directly
## Configuration
Environment variables are used to provide configuration.
| Variable name | Comment |
|----------------|---------|
| S3_BUCKET_NAME | Mandatory |
| AWS_ACCESS_KEY_ID | Optional - will be fetched from IAM policy on AWS |
| AWS_SECRET_ACCESS_KEY | Optional - will be fetched from IAM policy on AWS |
## Testing
docker run --rm --env AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} --env AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} --env S3_BUCKET_NAME=upload.paidit.se -p 8000:80 875131241629.dkr.ecr.eu-west-1.amazonaws.com/nginx-s3-upload
Try it out:
curl localhost:8000/upload -d 'some data' -v
...
> PUT /uploads HTTP/1.1
...
< X-File-URL: https://uploads.paidit.se/59389abb021973a41d05e0d7d79949b17b83b142058a3704c98f274b6e563cfc403e64db6550f233
...
The header `X-File-URL` will contain the URL to the uploaded file.