Перейти к содержимому

Serverless API & Automation That Costs Nothing While Idle

Cameron Jackson

0:00 / 0:00

Serverless API & Automation That Costs Nothing While Idle

15 просмотров · 2 недели назад
Cameron Jackson
8 подписчиков
15 просмотров · 2 недели назад
In Lab 9, I build an API that costs nothing while nobody is calling it, and a daily job that runs on a clock instead of a person. There is no server anywhere in this build: nothing to patch, nothing to pay for while it sits idle, and nothing to keep running by hand. The API is one Lambda function behind an API Gateway HTTP API, storing items in DynamoDB. The daily job is a second Lambda function that EventBridge Scheduler fires at 13:00 UTC every day. Every permission is scoped to the one table or the one function it needs, and I lint that IAM with Access Analyzer before I call the build done. What I build and prove: • A DynamoDB table billed per request, with point-in-time recovery on from the start • An items API on Lambda with create, read, list, and delete routes behind an API Gateway HTTP API • A daily job on Lambda, fired by an EventBridge Scheduler cron at 13:00 UTC with no flexible window • A live test with curl: create an item, then list it straight back • The scheduled job invoked by hand, with its summary line read back from CloudWatch Logs Checks, validation, and security: • Least privilege IAM: the functions can get, put, delete, and scan one table, by its exact ARN, and nothing else • The AWS managed DynamoDB policy is left out on purpose, because it grants those actions on every table in the account • The scheduler's role can invoke exactly one function, not every Lambda in the account • The items function can only be invoked by this API, scoped to the API's own execution ARN • IAM Access Analyzer policy validation on both custom policies: zero errors, zero security warnings • Point-in-time recovery on the table, so it can be restored to any second in the last 35 days • JSON logs with a 14-day retention on both functions, instead of the default that never expires Stack: AWS · Lambda · API Gateway HTTP API · DynamoDB · EventBridge Scheduler · IAM · IAM Access Analyzer · CloudWatch Logs Lab 9: Serverless API & Automation on my site: https://camdjackson.com/projects.html Code and README: https://github.com/jackson-camerond/c... #AWS #Serverless #AWSLambda #DynamoDB #CloudEngineering