This repo contains reference architectures developed by DigitalOcean to help users understand how to leverage DigitalOcean Services for specific use cases. Each reference architecture is provided as a Terraform module, allowing you to deploy and test to facilitate learning and rapid development. These reference architecture modules leverage our Terraform Module Library, which contains reusable Terraform modules addressing specific components of the architectures.
Note: While these reference architectures are fully functional, they are intended to be used as a reference. Please validate any configuration for your own use case.
| Name | Use Case | Periodic Validation | YouTube Video |
|---|---|---|---|
| Globally Load Balanced Web Servers | Load balanced web servers deployed into multiple regions with a global load balancer directing users to the region closest to them. | Yes | Watch Tutorial |
| NAT Gateway | Route all egress traffic from DOKS cluster and Droplets through a NAT Gateway, providing a single static IP for outbound connectivity | Yes | Coming Soon |
| Partner Network Connect with AWS | End-to-End connection between DO VPC and AWS VPC using Partner Network Connect with HA support | No | Coming Soon |
| Site to Site VPN with AWS | IPSec VPN Gateway Droplet connecting DO VPC and DOKS cluster with AWS VPC | No | Watch Tutorial |
Reference architectures deployed entirely on DigitalOcean are validated periodically (typically daily) to ensure they work as intended. Multi-cloud architectures are not validated via periodic testing but are verified using static analysis and unit testing when updates are made.
This section helps beginners set up Terraform and DigitalOcean access.
- Install Terraform
- Export your DigitalOcean token:
export DIGITALOCEAN_ACCESS_TOKEN="your_token_here"
- Clone this repo and navigate to the desired reference architecture.
- Create a
terraform.tfvarsfile with required inputs.
Example:
region = "nyc3"
droplet_count = 3
image = "ubuntu-20-04-x64"A typical way to deploy for testing purposes would be to:
- Ensure you have your DigitalOcean Personal Access Token set in the
DIGITALOCEAN_TOKENenvironment variable. - Clone the repo.
cdinto theterraformdirectory within the reference architecture you want to test.- Note: Some reference architectures use multiple Terraform stacks (e.g.,
terraform/1-infra/,terraform/2-routes/) to handle dependencies between resources. These must be deployed sequentially, starting with stack 1. Check the reference architecture's README for specific deployment instructions.
- Note: Some reference architectures use multiple Terraform stacks (e.g.,
- Create a
tfvarsfile with the inputs needed for the reference architecture module. - Run:
terraform init terraform plan -var-file=<path to tfvars file> terraform apply -var-file=<path to tfvars file>
- Test your deployment.
- When done, destroy the resources in reverse order (for multi-stack architectures, destroy the highest numbered stack first):
terraform destroy -var-file=<path to tfvars file>
If you wish to use the reference architecture as a basis for your own deployment, it's recommended to copy the Terraform files to your own repo and customize them for your needs.