Amazon API Gateway with an Amazon S3 integration

API Gateway REST API → Amazon S3

Create a REST API Gateway with a S3 read-only integration

This pattern deploys an Amazon API Gateway REST API endpoint with a S3 read-only integration
The API exposes 3 GET methods:
- Root GET method: it provides a list of the S3 buckets of the account where the stack is deployed.
- {folder} GET method: it provides a list of the objects contained in the bucket {folder}
- {item} GET method: it returns the contents of the object {item}.
The template also deploys an IAM role with S3 read-only capabilities that is used by API Gateway to integrate with S3.
Since this effectively acts as a proxy to S3, every GET method is protected by IAM authentication to prevent public access.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Launch Stack

Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-s3-proxy

Deploy

sam deploy --guided --capabilities CAPABILITY_IAM


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete.

Additional resources

Created by:

Albert Blaya

Albert Blaya

Albert is a Solutions Architect at Amazon Web Services based in Australia.

Follow on LinkedIn