β¨ Turn your words into voice. In real time. In any accent. Straight from the cloud.
Welcome to Speak AI β a serverless web app that literally talks back. Type a message, pick a voice, and within seconds, hear it spoken out loud using the power of Amazon Polly. No downloads. No installs. Just your browser, the cloud, and a bit of magic.
π§ Try the app in action:
π Click here to launch Speak AI
No installs. Just your browser, some text, and a voice from the cloud!
Speak AI is more than just a text-to-speech app β it's a cloud-native, fully serverless voice generation pipeline built using AWS.
Behind the scenes, it uses a suite of AWS services working in harmony:
-
π Asynchronous processing with SNS
-
π§ Stateless logic with Lambda
-
π¦ Durable storage via S3 and DynamoDB
-
π€ Realistic voices with Amazon Polly
-
π Public APIs through API Gateway
β
Enter text in your browser
β
Choose from multiple Amazon Polly voices
β
Get an audio file generated in seconds
β
Scalable to thousands of requests
β
No backend servers, no EC2s, no containers
β
100% Serverless. 100% AWS.
AWS-Text-2-Audio-Converter-Project/
β
βββ serverless-web/
β βββ index.html # π Main Web UI
β βββ styles.css # π¨ Frontend styles
β βββ scripts.js # βοΈ Frontend logic & API calls
β βββ error.html # π« Error fallback page
β
βββ add_new_posts.py # π€ Lambda: Text submit & SNS trigger
βββ convert_text_to_audio.py# π Lambda: Polly text-to-speech
βββ read_table_items.py # π₯ Lambda: Read from DynamoDB
β
βββ arc_diagram.png # π§ Architecture visual
βββ iam-policy.txt # π IAM Roles & Permissions
βββ s3-bucket-policy # π S3 policy for public access
βββ README.md # π Project overview
| AWS Service | Purpose |
|---|---|
| Amazon Polly | Converts text into realistic MP3 speech |
| AWS Lambda | Serverless compute (3 functions for different stages) |
| Amazon S3 | Stores MP3 files and optionally hosts frontend |
| DynamoDB | NoSQL storage for request data and audio URLs |
| SNS | Publishes events and triggers processing asynchronously |
| API Gateway | Connects frontend to Lambda securely via HTTP endpoints |
π§ Prerequisites
-
AWS account with programmatic access
-
IAM roles set up with proper permissions
-
Bucket with public-read policy (see s3-bucket-policy)
Files: index.html, styles.css, scripts.js
- ποΈ Text Input: User submits text and selects a voice.
- ποΈ Voice Selector: Dropdown to choose a Polly voice.
- π§ Result Display: Shows playback links for generated audio.
- π‘ Communicates with backend via REST (API Gateway).
- Exposes secure RESTful endpoints for frontend interactions.
- Triggers Lambda functions upon requests.

-
add_new_posts.pyπ€
β€ Receives new text input
β€ Stores in DynamoDB
β€ Publishes event to SNS -
convert_text_to_audio.pyπ
β€ Triggered by SNS
β€ Reads text/voice from DynamoDB
β€ Converts text to audio using Amazon Polly
β€ Uploads.mp3to S3
β€ Updates DynamoDB with the audio URL & status -
read_table_items.pyπ₯
β€ Reads all entries from DynamoDB
β€ Returns data to frontend for listing
-
π§Ύ DynamoDB
-
π¬ SNS (Simple Notification Service)
- Decouples text submission from audio processing
- Enables async invocation of audio conversion
-
π£οΈ Amazon Polly
- Converts submitted text into lifelike speech
- Supports multiple languages and voices
-
ποΈ Amazon S3
Region:
πΉ Make sure all AWS services (Lambda, DynamoDB, S3, SNS, Polly) are deployed in the us-east-1 region for seamless integration.
Purpose:
πΉ This application is intended for educational and demonstration purposes. It is not production-hardened.
1οΈβ£ Input Validation
- πΈ Sanitize text input to prevent injection attacks or invalid data.
- πΈ Set character limits and allow only supported languages.
2οΈβ£ Error Handling
- πΈ Add try/catch blocks in all Lambda functions.
- πΈ Show clear frontend error messages (e.g., "Audio failed to generate").
- πΈ Implement retry logic for transient AWS service errors.
3οΈβ£ Security Best Practices
-
π IAM Roles
- Use least privilege access policies.
- Avoid
AdministratorAccesson deployed functions. - Define resource-specific ARNs in permissions.
-
π S3 & DynamoDB Access
- Do not expose DynamoDB or sensitive S3 data publicly.
- Use signed URLs if public access is needed.
4οΈβ£ Monitoring & Alerts
- π Enable
CloudWatch Logsfor all Lambda functions. - β° Create CloudWatch alarms for function errors or high latency.
- π° Set up Billing Alerts to track AWS usage and avoid surprise costs.
Give a β if you like this!




