This repo is to create the wp lightsail instance with the terraform. Below is the architecture diagram that will be created by this terraform project.
directory | explanation |
---|---|
./.ssh/ | Put your ssh-key(this directory is not exist on default) |
./modules/lightsail/ | Create lightsail instance. |
./modules/statc_host/ | Set up the access method to lightsail to SSL terminated using Cloudfront. |
- Manually create a Route 53 Zone on AWS.
- Set the same domain name and lightsail parameters in variables.tf as a domain the one registered in the manually created Route53.
terraform init
terraform plan
terraform fmt -recursive
andterraform validate
terraform apply
- In case of using a domain purchased by another company, please register the name_servers information print according to outputs.tf of the static_host module to the site where you purchased the domain.
Remember to associate the CRANE of the ACM certificate with the domain.
.tfstate is managed on S3 bucket, So please create .tfstate in S3 referenced backend.tf before ru terraform commands.
This project is intended to run on AWS Cloud9.
AWS CLI or AWS credentials are registered in an environment variable on your dev machine, please adjust the code.
- Disable access to wp-configure.php
- Install some plugins in wordpress for security purposes.
SES configuration required.
To use Cloudwatch to monitor access to lightsail, you need to create an IAM user for monitoring, install and configure the cloudwatch agent on lightsail, create a log group, etc.
- AWS Cloud9
- terraform v1.5.2