This project automates the deployment of a WordPress site on an AWS EC2 instance with an RDS MySQL database. The deployment uses Terraform for infrastructure provisioning, Ansible for server configuration, and Bash scripting for automation.
- Automated AWS EC2 Instance Creation
- AWS RDS MySQL Setup
- Security Group Configuration
- Cloudflare DNS Setup for Custom Domain
- Automated WordPress Installation using Docker
- WP-CLI for WordPress Management
- AWS Account with IAM access
- Terraform installed
- Ansible installed
- Cloudflare account with API token
- SSH key for EC2 access
git clone https://github.com/your-repo/EC2-RDS-Wordpress.git
cd EC2-RDS-WordpressUpdate variables.tf with your Cloudflare credentials:
variable "cloudflare_api_token" {
description = "Cloudflare API token"
type = string
sensitive = true
}
variable "cloudflare_zone_id" {
description = "Cloudflare Zone ID"
type = string
}terraform init
terraform apply -auto-approvechmod +x deploy.sh
./deploy.shThis script:
- Retrieves instance and database details
- Creates a
.envfile with database credentials - Copies
.envto the instance - Runs the Ansible playbook
- Deploys WordPress with Docker
- Website: http://wordpress.purvesh.cloud
- Admin Panel: http://wordpress.purvesh.cloud/wp-admin
- Admin Credentials:
- Username:
admin - Password:
Admin@123
- Username:
To delete all resources:
terraform destroy -auto-approve- Saurabh Mate - GitHub