How to Architect a basic website with S3, API Gateway, Lambda, and DynamoDB

1. Create static S3 website with public endpoint
Go to S3, and create a bucket.
Enable Static Website hosting, and create a simple index.html file. This file will call API Gateway to retrieve DynamoDB entries.


2. Create NoSQL database with DynamoDB
Create a DynamoDB table with 1 Read and 1 Write Capacity Unit (for cost efficiency).
Set id as primary key for this demo.
Create a test item.

3. Create PutItem API and Lambda
We will write serverless JavaScript code which adds entries from DynamoDB. First, let's import some relevant libraries:

Below is the handler code. It calls DynamoDB.put with a callback.

Future improvements
- Document
4. Create GetTableView API and Lambda
We will now write serverless JavaScript code which retrieves entries from DynamoDB. Let us again import libraries:

Below is the handler code. It calls DynamoDB Scan with a callback.

Future improvements
- Document
2. Create an API Gateway Endpoint for POST and GET
Create a REST API. Create a POST and a GET endpoint, with a GET by Partition Key option.
