https://github.com/secretshardul/s3-apigateway-proxy
Upload to s3 using API gateway as proxy based on AWS tutorial
https://github.com/secretshardul/s3-apigateway-proxy
Last synced: 5 months ago
JSON representation
Upload to s3 using API gateway as proxy based on AWS tutorial
- Host: GitHub
- URL: https://github.com/secretshardul/s3-apigateway-proxy
- Owner: secretshardul
- Created: 2019-11-21T08:31:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-21T08:58:38.000Z (over 6 years ago)
- Last Synced: 2025-06-12T07:47:21.896Z (about 1 year ago)
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# s3-apigateway-proxy
Simplified explaination of [AWS tutorial](https://docs.aws.amazon.com/apigateway/latest/developerguide/integrating-api-with-aws-services-s3.html) on API gateway as S3 proxy.
## structure
1. /: GET gives list of all buckets
2. /{folder}: GET PUT DELETE for buckets
3. /{filder}/{item}: GET PUT DELETE HEAD for items in bucket
## steps
1. Create IAM role for API gateway. Then attach s3fullaccess policy to it.
2. Add resources and methods as mentioned above.
3. During creation
**integration type**: AWS service>s3
**HTTP method**: PUT GET DELETE(accordingly)
**Path override** for each method depends on its resource. {folder}/{item} will be mapped to {bucket}/{object}:
```
1. Resource /: /
2. Resource /{folder}: {bucket}
3. Resource /{folder}/{item}: {bucket}/{object}
```
4. Path mappings
object -> method.request.path.item (only for resource #3)
bucket -> method.request.path.folder (for resource #2 and #3)
5. Header mappings(resource #2 and #3)
Most s3 parameters like meta are passed through headers.
x-amz-acl -> 'authenticated-read'
Content-Type -> method.request.header.Content-Type
## working
Body can have text or binary. URL specifies bucket and object name. To enable binary add */* in settings>binary media. If IAM was used to authenticate API then add authorization>AWS signature
```
https://xn2nuhcvxd.execute-api.us-east-1.amazonaws.com/dev/demobucket/bible.jpeg
```