This is to set up wordpress using AWS infrastructure. We are using terraform to provision infrastructure. Code uses and creates following aws services.
- VPC and it's components
- Subnets, Route Tables, Internet Gateway, Nat Gateway.
- EC2 instance
- EIP for NAT Gateway
- RDS mysql instance.
- Security Groups to access both EC2 and MYSQL
You may get charged by aws for using services
-
You need to have Ssh keys generated and should be put into
~/.ssh/
, if your machine is windows then feel free to use diff path and update the same in thessh_key
variable in thevars.tf
-
create an IAM user and create security credentials(AccessKey, SecretKey) and update in the
~/.aws/credentials
file like below
Note : if you have default profile, just erase the profile
attribute in provider.tf
- git clone https://github.com/aleti-pavan/terraform-aws-wordpress.git
- cd terraform-aws-wordpress
- terraform init
- terraform plan
- terraform apply -auto-approve
- cd terraform-aws-wordpress (Be in the repo directory)
- terraform destroy -auto-approve
Code has been changed on 11th April, 2020. Code is now compatible with below versions.
Terraform v0.12.24
- provider.aws v2.12.0
- provider.template v2.1.2
(Old) Code slightly changed on 31st May, 2019. I have added providers.tf with versions required for each provider