Loading repository data…
Loading repository data…
Dheyyu / repository
This project implements a serverless Text-to-Speech Narrator using AWS Lambda, Amazon Polly, and Amazon S3. The entire infrastructure is provisioned using Terraform, making it easy to deploy, test, and tear down your environment. This solution provides a great learning experience in building and managing serverless architectures with Terraform.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
This project implements a serverless Text-to-Speech Narrator using AWS Lambda, Amazon Polly, and Amazon S3.
The entire infrastructure is provisioned using Terraform, making it easy to deploy, test, and tear down your environment. This solution provides a great learning experience in building and managing serverless architectures with Terraform.
The core functionality of this project is to convert any provided text into speech using Amazon Polly. The Lambda function accepts text (via a JSON payload), synthesizes speech, uploads the generated MP3 file to an S3 bucket (which is kept private), and returns a pre-signed URL for temporary access to the audio file.
Note: Amazon Polly has input size limits (around 3000 characters for plain text). In production or experiments with longer texts, you might need to split the text into smaller chunks.
PICTURE
. ├── terraform/ │ ├── main.tf # Main Terraform configuration │ ├── variables.tf # Variable definitions │ └── outputs.tf # Output variables (e.g., API endpoints) ├── lambda/ │ ├── lambda_function.py # Lambda function code (text-to-speech conversion) │ └── lambda.zip # Deployment package (generated from lambda_function.py) └── README.md # This file
Before you begin, make sure you have the following installed and configured
Ensure your AWS CLI is configured. For example, run:
aws configure
Then provide your AWS credentials to connect your account.
Navigate to the terraform/ directory and run:
terraform init
To initialalize terraform on your local machine
Then run:
terraform validate
To validate your code is well structured
Then run:
terraform plan
To plan the way the resources would be created
Then finally, run:
terraform apply
To apply those changes and set up the resources.
Terraform will provision the following:
An S3 bucket (for storing your synthesized audio)
An IAM Role with permissions for Lambda, S3, and Polly
A Lambda function that implements the text-to-speech conversion
Note: The S3 bucket ACL is set to private by default, and pre-signed URLs control temporary access.
In the lambda/ directory, package your function code:
cd lambda
zip lambda.zip lambda_function.py
cd ..
Ensure your Terraform Lambda resource points to the correct ZIP file. Then, re-run terraform apply if necessary to update your Lambda deployment.
Since this project isn’t exposed via a public website, you can test the Lambda function below:
{
"body": "{\"text\": \"Hello, this is a sample text-to-speech conversion.\"}"
}
When you're finished experimenting and documenting, tear down all the resources by running:
terraform destroy
This command removes all AWS resources that were created for this project.
Then you have successfully created the Text-to-Speech Application.