Welcome to Day 16. Today we expose our DynamoDB data to the web using API Gateway.
The Setup
Lambda: Created a simple function that scans the DynamoDB table and uses a DecimalEncoder helper to fix JSON serialization issues.
API Gateway: Used the HTTP API type (cheaper/simpler than REST API).
Integration: Connected the Gateway to the Lambda.
The CORS Config
This is where most people get stuck. I ensured my Lambda returns these headers:
Python
'headers': {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET'
}
And configured the Gateway CORS settings to match.
The Result
A public URL endpoint that serves my financial data in JSON format, ready for my React App to consume tomorrow.

Top comments (0)