Amazon API Gateway REST API with AWS Lambda non-proxy integration and CORS enabled

API Gateway REST API → AWS Lambda

API Gateway REST API with Lambda non-proxy integration and CORS enabled for GET and OPTIONS methods

A REST API is created that has a GET method with a Lambda function integration.
The API also has an OPTIONS method with a MOCK integration
CORS is enabled for both GET and OPTIONS method i.e. 'Access-Control-Allow-Methods', 'Access-Control-Allow-Headers', 'Access-Control-Allow-Origin' headers are returned.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-cors-nonproxy

Deploy

sam deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk delete.

Created by:

Noor Bari

Noor Bari

Cloud Support Engineer @ AWS.

Follow on LinkedIn