10 min
Configure custom domains with automatic Let’s Encrypt SSL certificates for secure HTTPS access to your Decision Control deployment.
Overview
Both Sandbox and Production editions support automatic SSL/HTTPS configuration using:
- Custom Domains: Use your own subdomain (e.g.,
decision-control.example.com)
- Route 53 Integration: Automatic DNS record creation
- Let’s Encrypt: Free SSL certificates with auto-renewal
- nginx Reverse Proxy: HTTPS termination on port 443
- HTTP Redirect: Automatic redirect from HTTP to HTTPS
Prerequisites
Before configuring SSL/HTTPS, you need:
- Route 53 Hosted Zone: You must own a domain with a hosted zone in AWS
- Example:
example.com. (note the trailing dot)
- The hosted zone must exist in the same AWS account
- Public Subnet: Instance must have a public IP for Let’s Encrypt validation
- Port 80 Access: Security group must allow HTTP from
0.0.0.0/0 for Let’s Encrypt challenge
- This is temporarily required for certificate validation
- HTTPS (port 443) can be restricted to your IP/CIDR
Configuration During Deployment
When creating your CloudFormation stack, provide these optional parameters:
Custom Domain Parameters
CustomDomain:
- The subdomain prefix for your application
- Do NOT include the full domain name
- Example:
decision-control (not decision-control.example.com)
- Valid characters: lowercase letters, numbers, hyphens
- Must start with a letter
HostedZoneName:
- Your Route 53 hosted zone name
- Must include the trailing dot (
.)
- Example:
example.com. (not example.com)
- Must match an existing hosted zone in your AWS account
Example Configuration
For a final URL of https://app.mycompany.com/:
What Happens Automatically
When you provide custom domain parameters, the deployment automatically:
- Creates Route 53 A Record:
decision-control.example.com → Instance Public IP
- DNS propagation takes 1-5 minutes
- Waits for DNS Resolution: Application startup waits for DNS to propagate
- Obtains Let’s Encrypt Certificate: Using HTTP-01 challenge
- Let’s Encrypt validates domain ownership via HTTP
- Certificate valid for 90 days
- Free certificate from trusted CA
- Configures nginx: Reverse proxy setup
- HTTPS on port 443 → Application on port 8080
- HTTP on port 80 → Redirects to HTTPS
- Enables Auto-Renewal: Daily cron job checks for renewal
- Automatically renews 30 days before expiration
- Zero downtime renewal process
Security Group Requirements
For Let’s Encrypt HTTP-01 Challenge
The security group must allow HTTP access from the internet for Let’s Encrypt validation:
During Deployment (Required for certificate issuance):
After Certificate is Issued (Optional - More Secure):
Port 80 MUST be accessible from 0.0.0.0/0 during initial certificate issuance and renewals. Let’s Encrypt validation servers need to reach http://your-domain.com/.well-known/acme-challenge/TOKEN.
How Let’s Encrypt Validation Works
The HTTP-01 challenge process:
- Certificate Request: Your instance requests a certificate from Let’s Encrypt
- Challenge Issued: Let’s Encrypt provides a unique token
- Token saved to:
/var/www/html/.well-known/acme-challenge/TOKEN
- Validation Request: Let’s Encrypt makes HTTP request
- nginx Serves Challenge: nginx serves the token file on port 80
- Certificate Issued: Let’s Encrypt validates ownership and issues certificate
- Certificate stored in
/etc/letsencrypt/live/decision-control.example.com/
- nginx Reconfigured: HTTPS enabled, HTTP redirects to HTTPS
Testing Your HTTPS Deployment
Verify DNS Resolution
Test HTTP Redirect
Test HTTPS Connection
Verify Certificate
Certificate Auto-Renewal
Certificates automatically renew via daily cron job:
Renewal Configuration
Cron Job: /etc/cron.daily/certbot-renew
Renewal Timing:
- Checks daily at 2:00 AM local time
- Renews when 30 days or less remain
- Zero downtime (nginx reload, not restart)
Manual Renewal (Testing)
To manually test renewal:
Troubleshooting SSL/HTTPS Issues
Issue: Certificate Validation Fails
Symptoms:
Causes:
- Port 80 not accessible from internet
- DNS not resolving correctly
- Security group blocking Let’s Encrypt servers
Solutions:
Issue: DNS Not Resolving
Symptoms:
Causes:
- Route 53 hosted zone doesn’t exist
- Hosted zone name mismatch
- DNS propagation delay
Solutions:
Issue: Certificate Expired
Symptoms:
Causes:
- Auto-renewal cron job not running
- Port 80 blocked during renewal
- DNS changed after deployment
Solutions:
Issue: nginx Not Starting
Symptoms:
Causes:
- Certificate files not found
- Incorrect file permissions
- nginx configuration error
Solutions:
Advanced SSL Configuration
Using Your Own SSL Certificate
If you prefer to use your own SSL certificate instead of Let’s Encrypt:
- SSH to Instance:
- Upload Certificate Files:
- Update nginx Configuration:
- Test and Reload:
Custom SSL/TLS Settings
Enhance security with custom nginx SSL settings:
Best Practices
- Use Custom Domains for Production: Always enable HTTPS for production deployments
- Keep Port 80 Open: Required for Let’s Encrypt renewals every 60-90 days
- Monitor Certificate Expiration: Let’s Encrypt certificates expire in 90 days
- Test Renewal Process: Run dry-run renewals monthly
- Use HSTS Headers: Enable HTTP Strict Transport Security (already included)
- Plan for DNS Changes: If you change instance IP, update Route 53 A record
Next Steps
Support
For SSL/HTTPS issues: