Skip to content

CloudFormation Template

The CloudFormation template provisions all AWS resources needed for HQ Deploy in a customer’s account. It’s parameterized, supports conditional SSR resources, and includes a cross-account IAM role for the control plane.

Parameters

ParameterRequiredDefaultDescription
OrgSlugYesOrganization identifier (used in resource naming)
DomainNameYesBase domain (e.g., deploy.acme.com)
VpcIdYesVPC for ALB and ECS (SSR only)
SubnetIdsYesComma-separated subnet IDs
RegionNous-east-1AWS region
EnableSSRNofalseProvision ECS Fargate infrastructure
ControlPlaneAccountIdNoAWS account ID for cross-account trust

Resources Created

Always Created (Static Hosting)

ResourceName PatternPurpose
S3 Buckethq-deploy-{OrgSlug}-assetsAsset storage with versioning
CloudFront DistributionGlobal CDN with wildcard cert
ACM Certificate*.{DomainName}Wildcard TLS (us-east-1, DNS validation)
Route 53 Hosted Zone{DomainName}DNS management
Lambda@EdgeOrigin-request subdomain router

Conditional (SSR — when EnableSSR=true)

ResourcePurpose
ECS Fargate ClusterContainer orchestration
ALB + HTTPS ListenerLoad balancing with wildcard cert
ECR RepositoryDocker image storage
Security GroupsCloudFront prefix list for ALB ingress

IAM

RoleTrustScope
hq-deploy-deployerControl plane account (if provided)hq-deploy-* resources only

The deploy role uses an ExternalId condition to prevent the confused deputy problem — a third party can’t assume the role even if they know the ARN.

Outputs

OutputDescription
DeployRoleArnARN of the cross-account deploy role
BucketNameS3 bucket name for assets
DistributionIdCloudFront distribution ID
HostedZoneIdRoute 53 hosted zone ID

Version Tracking

The template includes Metadata.Version which is used by the upgrade flow to detect drift between the installed stack and the latest template version.

Metadata:
Version: "1.0.0"

This version is read during hq-deploy upgrade to determine what changes need to be applied.