diff --git a/README.md b/README.md index 3f0d2dd..08d4da2 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Lots of Terraform recipes for doing things, aimed for copy and pasting into proj - [aws/aws_reverse_proxy](aws/aws_reverse_proxy) - [aws/aws_static_site](aws/aws_static_site) - [aws/static_website_ssl_cloudfront_private_s3](aws/static_website_ssl_cloudfront_private_s3) + - [aws/wordpress_fargate](aws/wordpress_fargate) - [azure](azure) - [azure/layers](azure/layers) - [generic](generic) @@ -1111,9 +1112,59 @@ Hosting static website using S3 is a very cost effective approach. Since, S3 web ## Architecture -![Architecture](images/s3-static-website.png) +![Architecture](aws/static_website_ssl_cloudfront_private_s3/images/s3-static-website.png) +# [aws/wordpress_fargate](aws/wordpress_fargate) +# Wordpress on Fargate + +This terraform example demonstrates how to run a scalable wordpress site. In this exmaple, we have tried to use serverless technologies as much as possible. Hence, we chose to run the site on fargate and are using Aurora serverless as DB. + +## AWS Services + +We used the below AWS services in our example. The main motivation behind the selection of services is that we select as many serverless components as possible. + +- Fargate - for computing +- Aurora Serverless - for database +- EFS (Elastic File System) - for persistent data storage +- Cloudfront - CDN + +## Terraform setup + +## Initialize terraform environment + +``` +terraform init -backend-config="bucket=" -backend-config="profile=" -backend-config="region=" +``` + +### Create environment + +``` + AWS_SDK_LOAD_CONFIG=1 \ + TF_VAR_site_domain= \ + TF_VAR_public_alb_domain= \ + TF_VAR_db_master_username= \ + TF_VAR_db_master_password="" \ + AWS_PROFILE= \ + AWS_DEFAULT_REGION= \ + terraform apply +``` + +### Tear down + +``` + AWS_SDK_LOAD_CONFIG=1 \ + TF_VAR_site_domain= \ + TF_VAR_public_alb_domain= \ + TF_VAR_db_master_username= \ + TF_VAR_db_master_password="" \ + AWS_PROFILE= \ + AWS_DEFAULT_REGION= \ + terraform destroy +``` + +p.s. Instead of environment variables, you can obviously use .tfvar files for assigning values to terraform variables. + # [azure](azure) # Azure Examples