Skip to main content

Text-to-Speech Serverless App — Phase 5: Infrastructure as Code with Terraform

·1 min read

by Frank Doka

Article

Text-to-Speech Serverless App — Phase 5: Infrastructure as Code with Terraform

Phase 5 replaces all console-created resources with Terraform, making the entire backend reproducible and version-controlled.

What I Defined in Terraform

  • Three Lambda functions (submit, process, retrieve) with IAM execution roles scoped to least privilege
  • API Gateway with routes, Cognito authorizer integration, and CORS configuration
  • DynamoDB table with partition key and on-demand billing
  • S3 bucket with appropriate policies for audio file storage
  • SNS topic with Lambda subscription and invoke permissions
  • Cognito User Pool and app client for authentication

Terraform Workflow

terraform init     # Download providers
terraform plan     # Preview what will change
terraform apply    # Create or update resources
terraform destroy  # Tear down everything cleanly

The entire backend — eight interconnected AWS services — stands up with a single terraform apply and tears down cleanly with terraform destroy. No manual steps, no console drift.

Project Takeaways

Building this app end-to-end — from React/Cognito auth through three Lambda functions, SNS-decoupled processing, Polly/Translate integration, S3 storage, and Terraform IaC — gave me deep, practical experience with the AWS serverless ecosystem. Every component is automated, reproducible, and secured with least-privilege IAM.

More articles

CI/CD Pipeline for NGINX on Docker — Phase 3: Infrastructure with Terraform

Provisioning the AWS EC2 infrastructure with Terraform — instances, security groups, and outputs for Ansible dynamic inventory.

Read more

Cloud Resume Challenge — Phase 5: IaC, CI/CD & Smoke Testing

Defining all infrastructure in Terraform, building a GitHub Actions CI/CD pipeline, and adding Cypress smoke tests to validate every deploy.

Read more