A hands-on Lambda lab in eighteen slides, in the console and the CLI: rebuild the project bucket, the upload topic, the queues and the sessions table; replace the worker fleet with the function project-worker, triggered by the queue project-thumbs, and watch a poison upload reach the dead-letter queue; build the REST API project-api with the function project-api-fn and the table project-notes, deploy it to the stage prod and throttle it; read the sessions table's stream with project-session-stream; and clean up.
The slides
The tool is a hands-on lab in eighteen slides, one step each, with the steps to follow beside a terminal and a picture
of the lab's resources: what earlier sessions made, the three functions, and the notes API.
- Introduction: what the lab makes.
- 1. Rebuild
- Rebuild the bucket, the topic and the queues: session 10's messaging, with a visibility timeout of 180 seconds.
- Rebuild the upload notification: S3 to the topic, for
uploads/. - Rebuild the sessions table and its items: session 9's table, its stream on, and
sessions.py run again.
- 2. The worker
- Create the worker function, Write the worker's code and Give the worker's role its permissions.
- Add the queue as the worker's trigger: an event source mapping.
- Upload a file and watch the worker: a cold start in the log.
- Send a poison message to the dead-letter queue.
- 3. The notes API
- Create the notes table and Create the API's function.
- Create the REST API:
/notes with GET and POST, Lambda proxy integration. - Deploy the API to the stage prod and Throttle the stage:
429 Too Many Requests.
- 4. The stream
- Create the stream function and Change a session and read the stream:
INSERT, MODIFY, REMOVE.
- 5. Clean up: the mappings first, then everything else.
The buttons on the left and right edges move between slides. So do the arrow keys and a swipe.
The lab uses names from
the DynamoDB lab and
the messaging lab.
The slides
Serverless: Lambda, API Gateway, Cognito explain what it uses.
The placeholders
The account ID is AWS's 111122223333, the API ID a1b2c3d4e5, and the request, message and note IDs are made up in
the formats AWS prints. The role names end in a few random characters the console chooses; yours differ.
Sources