Serverless Generative AI with Amazon Bedrock Nova Micro

API Gateway REST API → AWS Lambda → Amazon Bedrock

This pattern demonstrates how to create a serverless API leveraging Amazon Bedrock Nova Micro through AWS Lambda.

An Amazon API Gateway REST endpoint accepts POST requests containing prompts. These requests are automatically routed to an AWS Lambda function, which processes the input and interacts with Amazon Bedrock Nova Micro.
The Lambda function formats the request according to the model's requirements, invokes the model, and returns the generated response through API Gateway. This serverless architecture ensures scalability and cost-effectiveness, as you only pay for actual API calls and compute time.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd apigw-lambda-bedrock-nova-terraform

Deploy

terraform initterraform planterraform apply


Testing

Test the API endpoint using curl:
curl -X POST -H "Content-Type: application/json" -d '{"prompt": "What are the key benefits of using AWS services?"}' https://YOUR-API-ENDPOINT/dev/generate_content

Cleanup

terraform destroy
terraform show

Created by:

Naresh Rajaram

Naresh Rajaram

Cloud Infrastructure Architect, AWS

Follow on LinkedIn