AWS GenAI Use Case 1: Manufacturing Text Summarization
An end-to-end Serverless AWS architecture designed to automatically summarize lengthy manufacturing shift reports, maintenance logs, and defect analyses using the Cohere Command Text model hosted on Amazon Bedrock.
Architecture Overview
This is a fully serverless, event-driven, and scalable architecture.
- Amazon S3 (Data Ingestion): Factory foremen upload daily PDF/Text shift reports into an S3 Bucket.
- S3 Event Notifications: The upload instantly triggers an AWS Lambda function.
- AWS Lambda (Python Compute):
- The Python script downloads the file from S3 into memory.
- It extracts the raw text.
- It formats a precise Prompt Engineering template.
- Amazon Bedrock (GenAI Inference): The Lambda function securely calls the Foundation Model via the Boto3 SDK, passing the prompt and the extracted text. The model mathematically summarizes the 10-page report into 3 bullet points.
- Amazon DynamoDB (Storage): The Lambda function saves the final AI-generated summary into a NoSQL database for the frontend dashboard to query.
- Amazon API Gateway (Optional Exposure): Exposes the Lambda function as a REST API if you want to trigger summarization synchronously from a web application instead of via S3 upload.
Component Breakdown
1. terraform/ (Infrastructure as Code)
Contains the exact AWS infrastructure required to deploy this solution.
- main.tf: Provisions the S3 Bucket, Lambda Function, IAM Roles (specifically granting Bedrock access), and the DynamoDB table.
2. src/ (Application Code)
lambda_handler.py: The actual Python logic executed by the serverless function. It uses theboto3library to interact with Bedrock.requirements.txt: The dependencies required by Lambda (None needed beyond standard library, asboto3is pre-installed in the Lambda runtime!).
3. .github/workflows/deploy.yml (CI/CD)
Automates the deployment. When code is pushed to the main branch, GitHub Actions automatically runs terraform apply and zips/uploads the Lambda code to AWS.
Prerequisites for Deployment
- AWS Account & IAM: A user with programmatic access to deploy Terraform.
- Bedrock Model Access: By default, all models in Bedrock are locked. You must manually go to the AWS Console $\rightarrow$ Amazon Bedrock $\rightarrow$ Model Access $\rightarrow$ Request access to
Cohere Command Text.