How I built this serverless API with the new AWS
AI coding agents have shortened the path from an idea to working code. The updated AWS experience is designed to make deployment keep pace. It connects your agent to an AWS project, configures the AWS tools it needs, and handles permissions between the resources it creates. I used that workflow to turn a short prompt into a Python API using Amazon API Gateway, AWS Lambda, and Amazon DynamoDB. The…
The process of building a serverless API using AWS and an AI coding agent is straightforward. Signing in, I connected the agent to my AWS project and provided a brief prompt outlining my desired Python API with stateful responses that could be tested. The agent took care of installing necessary tools like the AWS CLI, logging me in, configuring the AWS MCP server, and setting up core AWS skills.
Next, I described the API in the prompt, specifying Python as the language, requesting a stateful response for testing, and asking for a preview of the architecture before deployment. The agent then proposed an architecture: a GET /counter endpoint that atomically increments a value stored in DynamoDB, with API Gateway exposing the public endpoint, a Python Lambda function handling each request, and an on-demand DynamoDB table maintaining state across calls.
This design prevented duplicate values during concurrent requests and included conservative throttling, least-privilege IAM role, CloudWatch log retention, local tests, and deployment through an AWS CloudFormation stack.
After reviewing the architecture and approving the public endpoint, the agent deployed the serverless-counter-api CloudFormation stack in the us-east-2 region. The deployment included a public API Gateway endpoint, a Python 3.12 Lambda function, a DynamoDB table for storing the counter, and an IAM role granting the function the necessary access. The API was intentionally public for the demo, but a production API should incorporate appropriate authorization.
To verify the live endpoint, I called it three times, and each call returned HTTP 200 with the values { "value": 1}, { "value": 2}, and { "value": 3}. A subsequent read from DynamoDB confirmed the stored value was indeed 3. I set the API_URL to the /prod/counter invoke URL and called it three times in a loop, receiving { "value": 7}, { "value": 8}, and { "value": 9}, confirming the service was live and maintaining state across requests.
Throughout the process, I maintained control over the API's functionality, reviewed the proposed architecture, and approved the public deployment. The AI agent managed the tooling setup, implementation, deployment, and initial tests. Before concluding, I verified the outcome myself, ensuring that Lambda updated DynamoDB atomically, returned the new value, and that permissions were limited to the function's needs.
The GET /counter endpoint worked as expected, and I was satisfied with the results. The agent's report confirmed success, but the final verification was my responsibility. I encourage using this approach with any coding agent and a small AWS project to see the plan before deployment, empowering you to build something meaningful.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.