# Django App Deployment on AWS
This repository contains configurations and modules for deploying a Django application on AWS using Terraform. The setup includes several modules for creating an ECR repository, ECS cluster, load balancer, and associated configurations.
## Prerequisites
Ensure you have the following prerequisites installed and configured:
- [Terraform](https://www.terraform.io/downloads.html)
- AWS CLI configured with necessary permissions and credentials
- Docker installed for building and managing containers
## Getting Started
Follow these steps to deploy your Django app on AWS:
### 1. Configure AWS Provider
Make sure to set up your AWS provider configuration in `provider.tf`:
```hcl
provider "aws" {
region = "us-west-2" # Replace with your desired AWS region
}
Use the ECR module to create a repository for your Docker images:
module "ecr" {
source = "./modules/ecr"
ecr_name = "ecr" # Define your ECR repository name
mutability = "MUTABLE"
# Additional configurations can be added here
}
Configure an ECS cluster for your Django app using the ECS module:
module "ecs" {
source = "./modules/ecs"
ecs_name = "test-ecs-cluster" # Define your ECS cluster name
familytype = "service"
pathJson = "${file("service.json")}" # Path to your service configurations
service_name = "my-first-service" # Define your service name
}
Use the Load Balancer module to set up an Application Load Balancer:
module "load_balancer" {
source = "./modules/load_balancer"
lb_name = "new-lb1" # Define your Load Balancer name
lb_type = "application"
tg_name = "target-group2" # Define your target group name
# Additional configurations for load balancer settings
}
Adjust default VPC and subnet settings as needed for your AWS resources. Configure security groups for load balancer ingress and egress traffic.
- Run
terraform init
to initialize the Terraform configurations. - Execute
terraform plan
to review the planned changes. - Run
terraform apply
to apply the configurations and deploy the Django app on AWS.
- This setup is designed to deploy a Django app on AWS using Terraform modules. Customize the configurations to fit your application requirements.
- Ensure proper configurations and permissions are set to avoid any unexpected changes or issues.
This comprehensive README provides step-by-step instructions for deploying a Django app on AWS using Terraform modules. It includes prerequisites, setup steps, module configurations, usage instructions, and notes for customization.