Zero-touch deployment of EC2 + TLS
Lettuce Encrypt is a pattern for deploying EC2 web servers that can obtain their own TLS certificates from Let's Encrypt. You'll need an AWS account and at least one domain already registered in Route53.
Simply make provision PARENT_ZONE=x
where x is a domain that you already have
registered in Route53. Assuming you have valid AWS credentials, Lettuce Encrypt
will do the following:
- Reserve a static IP address and assign it to a new subdomain (dns/)
- Create a new AMI (image/)
- Create a small storage volume to hold your Let's Encrypt certs (storage/)
- Deploy an EC2 instance which mounts this volume and uses the reserved IP
- Provision this instance, obtaining or renewing Let's Encrypt certs as needed
┌───────────────────────────────────────────────────────────────────────────────┐
│ Provisioning │
│ │
│ ┌──────────────────┐ │
│ │ Let's Encrypt │ │
│ ┌──────────────▶│ Certificates │◀─────────────┐ │
│ │ └──────────────────┘ │ │
│ │ │ │
│ ┌───────────────────┐ ┌───────┐ │
│ │provisions/Makefile│──────────────────────────────────▶│ Zpool │ │
│ └───────────────────┘ └───────┘ │
│ ▲ ▲ │
└───────────┼─────────────────────────────────────────────────┼─────────────────┘
┌───────────┼─────────────────────────────────────────────────┼─────────────────┐
│ │ Webserver │ │
│ │ ┌──────────────┐ │
│ │ │ Volume │ │
│ ├────────────────────────────────────────▶│ Attachment │ │
│ │ ┌──────────────┐ └──────────────┘ │
│ ├─────────────▶│EIP Attachment│ ▲ │
│ │ └──────────────┘ │ │
│ ┌────────────┐ ▲ │ │
│ │EC2 Instance│ │ │ │
│ └────────────┘ │ │ │
│ ▲ │ │ │
└───────────┼──────────────────────┼──────────────────────────┼─────────────────┘
│ │ │
┌───────────┼──────────────────┐ │ │
│ │Image │ │ │
│ ┌───────────────────┐ │ │ │
│ │ Lettuce AMI │ │ │ │
│ └───────────────────┘ │ │ │
│ ▲ │ │ │
│ │ │ │ │
│ ├──────────┐ │ │ ┌──────────────────────┐ │
│ │ │ │ │ │ DNS │ │
│ │ │ │ │ │ ┌──────────────────┐ │ │
│ │ ┌────────────┐ │ │ │ │ Subdomain Record │ │ │
│ │ │provision.sh│ │ │ │ │ (Route 53) │ │ │
│ │ └────────────┘ │ │ │ └──────────────────┘ │ │
│ ┴ │ │ │ ▲ │ │┌────────────────┐
│ ┌───────────────────┐ │ │ │ │ │ ││ Storage │
│ │ OmniOS │ │ │ │ ┌────────────┐ │ ││ ┌────────────┐ │
│ │ Community Edition │ │ └─┼────│ Elastic IP │ │ └┼─│ EBS Volume │ │
│ └───────────────────┘ │ │ └────────────┘ │ │ └────────────┘ │
└──────────────────────────────┘ └──────────────────────┘ └────────────────┘
┌───────────────────────────────────────────────────────────────────────────────┐
│ Prerequisites │
│ ┌────────────────────────┐ ┌────────────────────┐ │
│ │Existing Route53 Domain │ │AWS Credentials for │ │
│ │ (PARENT_ZONE) │◀───────▶│ us-east-1 │ │
│ └────────────────────────┘ └────────────────────┘ │
└───────────────────────────────────────────────────────────────────────────────┘
This pattern assumes that the instance is not part of a cluster (i.e. that you will be obtaining a certificate for a domain that points to a single EC2 instance) and thus is better suited for deploying infrastructure appliances than for large-scale websites.
Because this pattern automates the creation of a Let's Encrypt account, you are obligated to agree to the Let's Encrypt Subscriber Agreement.