This project contains infrastructure and application source code for deploying a sample, highly resilient, multi-region application running on AWS AppRunner and DynamoDB. It contains the companion source code for the Architecting for Resiliency using AWS App Runner blog post. The IaC code is written in Terraform and the application code is written in Go and Next.js.
-
Clone this git repository
-
Update the Terraform input variables here, here, and here to specify the app name, regions, and Route53 Hosted zone that you'd like to use.
-
Run
make init
to provision the AWS resources -
After the command completes and the custom domain has been validated (this can take some time), you should be able to access the application at the URL specified in the
custom_service_url
output value.
At this point, you should have an application running in whichever two AWS regions you set in the terraform.tfvars
files.
From this point on you can iterate on the source code and then run make deploy
to build a new container image and deploy it to both regions.
If you wish to tear down the application, you can run make destroy
to deprovision the resources that were created in your AWS account.
The following are the minimum required dependencies needed to deploy the solution.
- AWS CLI v2
- Terraform >= v1
- Docker Desktop >= v1 OR Docker CE >= v20
If you wish to make changes to the application code and build it (outside of Docker) then you'll need to install the following.
- Go >= v1.18
- Nodejs >= v16
A .tool-versions file is included which lets you optionally use the asdf tool to install the dependencies via asdf install
. AWS CLI and Docker Desktop are typically installed separately.
If you choose to use Cloud9 for your development environment, it comes with the following dependencies pre-installed.
- Docker CE
- Terraform
- AWS CLI v1 (you'll need to upgrade to v2)
- Nodejs
- Go (you'll need to upgrade to the latest)