Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunil Kumar Mohanty committed May 31, 2020
1 parent 06d23bd commit c965308
Showing 1 changed file with 52 additions and 1 deletion.
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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=<BUCKET_NAME>" -backend-config="profile=<AWS_PROFILE>" -backend-config="region=<AWS_REGION>"
```

### Create environment

```
AWS_SDK_LOAD_CONFIG=1 \
TF_VAR_site_domain=<PUBLIC_DOMAIN> \
TF_VAR_public_alb_domain=<INTERNAL_DOMAIN_FOR_ALB> \
TF_VAR_db_master_username=<DB_MASTER_USERNAME> \
TF_VAR_db_master_password="<DB_MASTER_PASSWORD>" \
AWS_PROFILE=<AWS_PROFILE> \
AWS_DEFAULT_REGION=<AWS_REGION> \
terraform apply
```

### Tear down

```
AWS_SDK_LOAD_CONFIG=1 \
TF_VAR_site_domain=<PUBLIC_DOMAIN> \
TF_VAR_public_alb_domain=<INTERNAL_DOMAIN_FOR_ALB> \
TF_VAR_db_master_username=<DB_MASTER_USERNAME> \
TF_VAR_db_master_password="<DB_MASTER_PASSWORD>" \
AWS_PROFILE=<AWS_PROFILE> \
AWS_DEFAULT_REGION=<AWS_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
Expand Down

0 comments on commit c965308

Please sign in to comment.