Menu

Build a Serverless AI API on AWS with Bedrock, Lambda and Terraform
πŸ“°

Build a Serverless AI API on AWS with Bedrock, Lambda and Terraform

DEV Community: terraformΒ·Ige Olajide GideonΒ·3 days ago
#DICCwFQd
#devtoterraform#devto#dev#bedrock#lambda
Reading 0:00
15s threshold

I wanted a small project that shows what I can actually do with AWS: an HTTPS endpoint that takes a prompt and returns an answer from a model on Amazon Bedrock, with every resource defined in Terraform and permissions tight enough that I'd be comfortable leaving it running.

Most Bedrock tutorials stop at a Python script that calls a model from your laptop. That's fine for a demo. A real application needs more: an endpoint other code can call, credentials that never leave AWS, permissions that allow one model and nothing else, logs, and a cap on how fast anyone can spend your money.

So that's what we'll build:

An HTTPS endpoint ( POST /chat ) on Amazon API Gateway

An AWS Lambda function in Python that calls the Bedrock Converse API

A least-privilege IAM policy that allows one model through one inference profile

Throttling and log retention , so the endpoint is safe to leave running

All of it deployed and destroyed with Terraform

The project also taught me something I didn't plan to learn.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.