This project will create a Wordpress site for development or production purposes within AWS.
Note: Production will utilise larger resources than development.
The following resources will be created for either development (dev) or production (prod), depending on user selection. In the case of production, more than one resource of a particular type below will be created.
- vpc
- ec2
- rds (mysql)
- elb (load balancer)
- efs (ec2 shared file system)
Note: The following should take place within the project's root directory.
-
Create yourself a ssh-keypair:
ssh-keygen -f wordpress_ec2 -
Supply your AWS credentials within a new file (as below): 'terraform.tfvars'
AWS_ACCESS_KEY = "AKIA..."
AWS_SECRET_KEY = "YvbB..."
-
Setup Terraform:
terraform init -
Apply Terraform (you will be prompted to supply a password for the RDS database):
terraform plan -var ENV=devorterraform plan -var ENV=prodfollowed by:
terraform apply -var ENV=devorterraform apply -var ENV=prod -
The following outputs will be supplied on successful build:
- ELB endpoint - for accessing the website
- EC2 IP(s) - for accessing the instance(s) via ssh
- When complete:
terraform destroy -var ENV=devorterraform destroy -var ENV=prod
All work is my own.