Building a Serverless AI-Powered Text Summarizer using AWS Bedrock

Utkarsh RastogiUtkarsh Rastogi
2 min read

Introduction

In this project, I built a serverless AI-powered text summarizer using Amazon Bedrock, AWS Lambda, API Gateway, DynamoDB, and a React frontend hosted on AWS Amplify.

It summarizes input text into concise content using powerful LLMs, while leveraging serverless technology for cost-efficiency and scalability.

Architecture Overview

React (Amplify) → API Gateway → Lambda → Amazon Bedrock → DynamoDB

  • React.js: User-facing frontend hosted on AWS Amplify

  • API Gateway: Exposes REST API endpoints to the frontend

  • AWS Lambda: Serverless compute running our summarization logic

  • Amazon Bedrock: Provides the generative AI summarization capability

  • DynamoDB: Stores summaries for future reuse to avoid redundant AI calls

GitHub & Documentation

Repo: https://github.com/Utkarshlearner/aws-ai-text-summarizer

https://github.com/Utkarshlearner/aws-ai-text-summarizer/blob/main/ai_summarizer_project.pdf

Deployment Steps

This project uses AWS CLI + CloudFormation templates to create infrastructure.

Make sure the AWS CLI is configured (aws configure) before running these commands.

1) Create IAM Role
aws cloudformation create-stack --stack-name AI-Summarization-IAM-Role --template-body file://iam.yaml --capabilities CAPABILITY_NAMED_IAM


2) Create DynamoDB Table
aws cloudformation create-stack --stack-name AI-Summarization-DynamoDB-Table --template-body file://dynamodb.yaml --capabilities CAPABILITY_NAMED_IAM


3) Create Lambda Function
aws cloudformation create-stack --stack-name AI-Summarization-Lambda --template-body file://lambda.yaml --capabilities CAPABILITY_NAMED_IAM

4) Create API Gateway
aws cloudformation create-stack --stack-name AI-Summarization-APIGateway --template-body file://apigateway.yaml --capabilities CAPABILITY_NAMED_IAM

5) Create Amplify Hosting
aws cloudformation create-stack --stack-name AI-Summarization-Amplify --template-body file://amplify.yaml --capabilities CAPABILITY_NAMED_IAM

6)React Frontend (Amplify Hosting)
npm run build

7) Zip build folder contents

8) Deploy via Amplify Console (Drag-and-Drop)

Postman Testing

Once deployed:

  • Use Postman to hit the API endpoint

  • Pass JSON body:

Payload:

{ "text": "Artificial Intelligence is transforming the world in unimaginable ways..." }

Best Pratices Learned

  • Use DynamoDB for caching:

    • Avoids repeated calls to Bedrock

    • Reduces cost and latency

  • Separate responsibilities with microservices:

    • Keep summarization logic in Lambda

    • Manage frontend and backend independently

  • Always test endpoints locally via postman

  • Enable CORS properly in API Gateway for seamless frontend-backend integration

  • Clean up unused stacks/resources to avoid surprise billing

Use CloudFormation for reproducibility and version control of infra


"Thank you for reading! If you found this blog helpful, don't forget to subscribe and follow for more insightful content. Your support keeps me motivated to bring you valuable insights. Stay updated and never miss out on our latest posts. Feel free to leave comments or suggestions for future topics. Happy learning!"

https://awslearner.hashnode.dev/amazon-web-services-via-category

https://awslearner.hashnode.dev/aws-beginner-level-project-ideas

0
Subscribe to my newsletter

Read articles from Utkarsh Rastogi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Utkarsh Rastogi
Utkarsh Rastogi

👨‍💻 AWS Cloud Engineer | Around 6 years of Corporate Experience | Driving Innovation in Cloud Solutions 🔧 Day-to-Day Tasks: Specialize in creating AWS infrastructure for Migration Projects. Leveraging services such as S3, SNS, SQS, IAM, Lambda, System Manager, Kinesis, OpenSearch, Cognito, Storage Gateway, Cloud Watch, API Gateway, AWS Event Scheduler, Secret Manager, ECS, Application Load Balancer, VPC among others. Additionally, I excel in crafting Splunk Dashboards and implementing alerting mechanisms for Cloud Watch logs to monitor failures. My approach involves constructing AWS infrastructure using the Serverless framework and Cloud Formation templates, while automating tasks through Boto3 (Python Scripting) Lambdas. 🎯 Passion: I am deeply passionate about continuously learning new technologies and eagerly anticipate the transformative impact of cloud computing on the tech landscape. 📧 Connect: Feel free to reach out to me at awslearningoals@gmail.com. Let's connect and explore potential collaborations! https://www.linkedin.com/in/rastogiutkarsh/