Automated Infrastructure Provisioning for a Multi-Tier Web Application
This project automates the provisioning of all necessary infrastructure components on AWS for hosting a multi tier web application using Terraform. It includes setting up networking, compute resources, databases, and security groups to ensure a scalable, secure, and efficient environment.
- Getting Started
- Prerequisites
- Project Structure
- Infrastructure Components
- Usage
- Contributing
- License
To get started with this project, clone the repository and follow the instructions below to set up your environment.
git clone https://github.com/imsiddhant/TerraformInfraProject.git
cd TerraformInfraProject
- Terraform (recommended version 1.9.x or above)
- An AWS account with appropriate permissions to create resources.
- AWS CLI configured with your credentials.
- You can attach following managed policies to the IAM User:
- AmazonEC2FullAccess
- AmazonRDSFullAccess
- AmazonVPCFullAccess
- CloudWatchFullAccess
TerraformInfraProject/
│
├── module
├── Compute
├── app.sh
├── main.tf
├── outputs.tf
├── variables.tf
├── Database
├── main.tf
├── outputs.tf
├── variables.tf
├── Monitoring
├── main.tf
├── outputs.tf
├── variables.tf
├── Networking
├── main.tf
├── outputs.tf
├── variables.tf
├── main.tf
└── README.md
- Networking Setup
- Create a Virtual Private Cloud (VPC) with public and private subnets.
- Configure route tables and internet gateways for public subnet access.
- Compute Resources
- Launch EC2 instances to host the web application.
- Use Auto Scaling Groups to ensure high availability and scalability.
- Utilize Elastic Load Balancing for distributing incoming traffic.
- Database Configuration
- Set up a managed database service like Amazon RDS for storing application data.
- Choose the appropriate database engine (e.g., MySQL, PostgreSQL) based on your application's requirements.
- Security and Access Control
- Implement security groups to control inbound and outbound traffic to EC2 instances and databases.
- Monitoring
- Set up an SNS topic with an email subscription for notifications.
- Configure CloudWatch alarms to monitor the health of Compute and Database resources.
-
Modify variables.tf to set your desired configurations.
-
Initialize Terraform:
terraform init
- Plan the infrastructure deployment:
terraform plan
- Apply the configuration to create resources:
terraform apply
- To destroy the infrastructure when it's no longer needed:
terraform destroy
Contributions are welcome! Please open an issue or submit a pull request for any improvements or features you'd like to see.
Please feel free to reach out to me on Instagram for any further queries or concerns.
Thank you.
================================================================================================================