This terraform projects creates RDS databse with mysql 5.7 #EC2 instance with wordpress pre installed and configured
Change database entries ,regions and other variable in terraform.tfvars file And Database password in user.tfvars file
This script is default for Ubuntu
If you want to configure wordpress in AWS LINUX 2 then change IsUbuntu value to false in terraform.tfvars
Make sure you have configured aws CLI in your local machine
EC2 will be launched in public subnet and RDS will be launched in private subnet
Only EC2 with defined security group can access RDS and RDS wont have internet access
<----------------------------------------------------------------------------------------------------------------------->
Before launching Terraform template, aws cli should be installed and configured with proper access key and secret key
Terraform should be installed in your local machine
Configure AWS CLI with aws configure
if you havent configured already
<------------------------------------------------------------------------------------------------------------------------>
Clone this repo using command git clone https://github.com/devbhusal/terraform-ec2-RDS-wordpress.git
Go to project folder cd terraform-ec2-RDS-wordpress
Initialize terraform terraform init
Change database and aws setting in terraform.tfvars file
Generate Key pair using ssh-keygen -f mykey-pair
View Plan using terraform plan -var-file="user.tfvars"
Apply the plan using terraform apply -var-file="user.tfvars"
After successfull provisioning of AWS Resources,Using remote-exec and private key, EC2 instance will be connected via SSH. Tail command will used to check prgress of Wordpress Installation. Once Installation is done ,You will be provided with Public Ip address of WebServer.
everything is Automatic. This will provision all needed aws resources and also build and start webserver using USERDATA
Destroy the resources terraform destroy -var-file="user.tfvars"