This repository contains Terraform configurations and code for setting up a serverless infrastructure on AWS. The infrastructure includes AWS Lambda functions, AWS CloudWatch Event Rules, and other resources. It also demonstrates best practices for managing AWS infrastructure as code (IaC) using Terraform.
Key Highlight: Deploy multiple Python files under a single Lambda function, allowing you to organize your Lambda code efficiently while maintaining a modular and maintainable architecture.
Before you begin, make sure you have the necessary prerequisites and AWS credentials configured.
- Terraform installed locally.
- AWS account with appropriate permissions and AWS CLI configured.
This repository uses custom Terraform modules to provision resources. The modules are located in the tf-modules
directory. Each module is designed to manage specific AWS resources, making it easy to organize and maintain your infrastructure.
tf-modules/lambda
: Manages AWS Lambda functions and their associated resources.tf-modules/cloudwatch
: Manages AWS CloudWatch resources, including event rules.
-
Clone this repository to your local machine:
git clone https://github.com/your-username/your-repo.git cd your-repo
-
Update the Terraform variables and configuration files as needed. Ensure that you replace sensitive information such as AWS access keys with environment variables or use a secure method to manage secrets.
-
Initialize Terraform and download the required providers:
terraform init
-
Review the action plan
terraform plan
-
Apply the Terraform configuration to create or update AWS resources:
terraform apply
-
Verify that the resources have been provisioned correctly in your AWS account.
This infrastructure can serve as a starting point for your serverless applications on AWS. Customize the Terraform configurations and modules to match your specific requirements. Additionally, you can extend the infrastructure to include additional AWS services and resources as needed.