Docs · How-to
Around your sites
The tasks around a site, in the order you meet them: before the first plan, publishing, after the first site, and taking it down. Each one says when you need it, its steps, and how you check it worked.
Not released yet. hyperstack's free edition isn't public yet, so a stranger can't follow these recipes today. The tutorial's step 1 says how you'll get it.
Before you use a recipe
These recipes assume the route of the tutorial, "One account, one site": one AWS account, an administrator's sign-in for it in one AWS CLI profile (example-site here), the release unpacked whole at vendor/hyperstack/, and two stacks run where they are: stacks/static-account once per account, and stacks/static-site once per site. Each recipe names the stack's directory it runs in.
Signing in: every aws command here names --profile example-site (put your own profile's name in its place), and nothing goes in the environment: no export AWS_PROFILE. An AI agent's commands each start a fresh shell, so an export in one is gone in the next. Terraform reads the same profile from profile in terraform.tfvars.
The one rule still holds: every change is a saved plan you've read, then that plan applied.
terraform plan -out=x.tfplan
terraform apply x.tfplan
If a plan shows a destroy or a replace you didn't ask for, stop, and find out why before anything is applied.
What's proven, and what isn't. Where a step has run on AWS, the recipe says when. Where it's written from reading the code and AWS's documentation, and hasn't run yet, it says "not yet run". The facts behind each are in the reference, "What has run".
The recipes, in order:
- Before the first plan: bring your domain's zone, check your inputs offline, adopt an account already in use, keep the state in S3.
- Publishing: from your repository's CI, from your own machine, checking the site's quality.
- After the first site: a second site, turning on an option, upgrading.
- The end: take it down.
Before the first plan
Bring your domain's zone
When: your domain, or the parent it sits under (example.com for www.example.com), has no public hosted zone in the account the site goes in. A hosted zone is your domain's address book on AWS (Route 53). A domain you registered with Route 53 in this account has one already: skip this. It's the slowest task, because its wait is for the internet, not for AWS, so start it first.
First, decide which case is yours. The name servers set where you registered the domain answer for the whole registered domain (example.com) and every name under it, so changing them moves all of it at once.
- The registered domain itself, new or unused (
example.com, with nothing at it you need:dig +short MX example.comanddig +short A example.comprint nothing you mean to keep): "A zone for a new or unused domain", below. - A name under a domain already in use (
www.example.comorapp.example.com, whereexample.comalready answers from somewhere else: its mail, another site, another DNS host or another account): never change the registered domain's name servers. That hands all ofexample.com, its mail included, to an empty zone. Give the site a zone of its own instead: "A zone of the site's own", below. - In doubt, take the second. One NS record is easy to remove; a whole domain's records are not easy to bring back.
A zone for a new or unused domain. You make the zone by hand, and it's yours, not a stack's. Signed in with the account's profile (aws sts get-caller-identity --profile example-site prints the account's ID):
- Make the zone, public and in this account:
A zone made this way, with noaws route53 create-hosted-zone --name example.com --caller-reference "zone-$(date -u +%Y%m%dT%H%M%SZ)" --profile example-site--vpc, is public. The answer holds"PrivateZone": falseand, underDelegationSet, four name servers: write them down, and the zone's ID (the part after/hostedzone/). Make one zone per domain: a second call makes a second zone of the same name, and only the one the registrar names answers. - Point the registrar at it. If DNSSEC is on for the domain where you registered it, turn it off there first, and wait the time the registrar gives. Then replace the domain's name servers with the four from step 1, each without a trailing dot. Every registrar's page differs: it's often called "Nameservers", "DNS" or "Delegation". Records you had there (mail, say) must be in the new zone before this step, or they stop answering.
- Wait until the internet asks the new zone. Every few minutes:
until it prints the four name servers of step 1, and nothing else. A registrar can take minutes, or up to two days, before the change reaches the internet. Don't plan a site before then: the site's certificate is checked through a record in this zone, so the apply waits until the internet reaches it.dig NS example.com +short - Check it's public and in this account:
You'll see the zone's name (aws route53 list-hosted-zones-by-name --dns-name example.com --max-items 1 --query 'HostedZones[0].[Name,Id,Config.PrivateZone]' --profile example-siteexample.com.), its ID, andfalse: public. Found with that profile, it's in this account.
Check, all at once: scripts/site-inputs.sh <domain> <owner>/<repo> (or the domain alone, for a site with no repository), from stacks/static-site, runs steps 3 and 4, read-only, with the CAA check (the reference, "Errors"), and prints the parent_dns line for the site's terraform.tfvars. It exits 1 while the name servers don't answer yet.
Cost: $0.50 a month for the zone, from the month it's made, whether or not a site uses it. The three records a site writes in it add no charge of their own, and queries to the certificate's validation record are $0.40 per million queries. AWS's Route 53 pricing page has today's prices. No teardown removes this zone: it's yours.
Undo: set the registrar's name servers back first; then, once only the zone's own NS and SOA records are left in it, aws route53 delete-hosted-zone --id <the zone's ID> --profile example-site. Never delete a zone that still answers for a domain, or holds other records.
A zone of the site's own. For a name under a domain already in use. Here the site's stack makes the zone itself, you add one NS record for the site's name at the DNS host that serves example.com today, and the zone goes when the site goes. It's set when you write the site's inputs, the tutorial's step 3:
- Set
parent_dns = nullin the site'sterraform.tfvars, and skip the zone lookup (the site walkthrough's step 3): there's no zone to look up yet.scripts/site-inputs.shlooks for a zone already in the account, so it doesn't fit this route; look updeploy_subjectby hand, as the site walkthrough's step 1 shows. - Make the zone alone, in
stacks/static-site:
You'll seeterraform init terraform plan -target=module.cloudfront.aws_route53_zone.this -out=zone.tfplan terraform apply zone.tfplan terraform output name_servers1 to addin the plan, then the zone's four name servers. - Delegate the site's name to it: at the DNS host that serves
example.comtoday, add one NS record for the site's name (www.example.com) holding those four. Change nothing else there, and never the registrar's name servers. Ifexample.com's zone is in Route 53:aws route53 change-resource-record-sets --hosted-zone-id <the parent zone's ID> --profile <the parent zone's account> \ --change-batch '{"Changes":[{"Action":"UPSERT","ResourceRecordSet":{"Name":"<domain>","Type":"NS","TTL":300,"ResourceRecords":[{"Value":"<ns 1>"},{"Value":"<ns 2>"},{"Value":"<ns 3>"},{"Value":"<ns 4>"}]}}]}' - Wait for that NS record until the internet sees it:
lists the same four names. The certificate can't be checked before then. In the stack's first real apply, 2026-11-17, the zone took 31 s to make and the NS record 31 s to apply, anddig NS www.example.com +shortdig NSlisted all four within about 20 s of that; a public resolver answered on its first check. Another DNS host can take longer (general DNS behaviour, not from a run). - Then the rest of the site: the site walkthrough from its step 4. The plan is
18 to add, with the records in the site's own zone.
Check: dig NS www.example.com +short names the zone's four servers, and curl -sI https://www.example.com/ answers. Cost: the site's zone bills $0.50 a month while it stands. When you take the site down, remove the NS record at the parent's DNS host first; the site's destroy then deletes the zone with the rest ("Take it down"). To move the site's records into the parent zone later and drop its own zone, the release has "Move off the site's own zone".
The detail: in the release, docs/how-to/how-to.md, "Bring your domain's zone", for a new or unused domain, and stacks/static-site/HOWTO.md, "Bring it up with its own zone", for a zone of the site's own.
Check your inputs offline
When: before a first plan, or after any change to a terraform.tfvars. It checks your values with no AWS sign-in at all: a plan of the stack against stand-ins for AWS (the stack's own shipped tests, in tests/plan.tftest.hcl), with your values in place.
It finds a missing input, a wrong type, every value the stacks refuse (account_id, account_alias, deploy_subject, rewrite), the example's zone ID left in place, a name, domain or deploy_subject of the wrong shape, and one that another site beside this one has already.
- Check the configuration, in the stack's directory:
You'll seeterraform init -backend=false terraform validateSuccess! The configuration is valid.If the root has abackend.tf("Keep the state in S3"), the realterraform initafter this needs-reconfigure. - Make the check, in a directory of your own,
mine/, inside the stack's directory (Terraform refuses a test directory outside it). The release's how-to has the commands, one block for the base and one for each site: they copy the shipped test's stand-ins intomine/inputs.tftest.hclwith your account's ID, name and domain in place of the example's, and add one test that reads yourterraform.tfvarsand checks each value's shape. A site's block also reads every other site'sterraform.tfvarsbeside it, so two sites can't share aname, adomainor adeploy_subject. - Run it:
You'll seeterraform test -test-directory=mineSuccess! 1 passed, 0 failed.A failure names the input:Invalid value for variablewith the stack's own message,No value for required variable, orTest assertion failedwith what's wrong. Fixterraform.tfvars, and run it again. - The one check that needs the account, read-only: the zone. Offline, nothing can tell that your zone is public and is the one that answers. "A zone for a new or unused domain", step 4, prints
falsefor a public zone. Then:
lists only the zone's own name: no NS record hands your domain to another zone (a real run, 2026-11-19).aws route53 list-resource-record-sets --hosted-zone-id <the zone's ID> --query "ResourceRecordSets[?Type=='NS'].Name" --profile example-site
Make the check again whenever you change a terraform.tfvars or add a site: it holds the values as they were. mine/ is yours, like terraform.tfvars: the release's checksums don't list it, and an upgrade carries it over.
The detail: in the release, docs/how-to/how-to.md, "Check your inputs offline" (checked with Terraform 1.17.1).
Adopt an account already in use
When: the account already holds some of what the base makes account-wide, by hand or from another tool: S3's public access block, EBS encryption by default, GitHub's OIDC provider, an account alias, or an Access Analyzer. The base's first plan would try to make them again, and its teardown would remove them. Adopting them means the base takes them over without a change, and leaves them as they were when it comes down.
- Check each one, and write down what's there, before the base's first plan:
An account with nothing else in it has none of these to adopt.aws s3control get-public-access-block --account-id <account id> --profile example-site aws ec2 get-ebs-encryption-by-default --region <region> --profile example-site aws iam list-open-id-connect-providers --profile example-site aws iam list-account-aliases --profile example-site aws accessanalyzer list-analyzers --region <region> --profile example-site - Import each one it found, and only those, in
stacks/static-account, afterterraform init:
The alias only withterraform import 'module.account.aws_s3_account_public_access_block.this[0]' <account id> terraform import 'module.account.aws_ebs_encryption_by_default.this[0]' default terraform import 'module.account.aws_iam_openid_connect_provider.github[0]' arn:aws:iam::<account id>:oidc-provider/token.actions.githubusercontent.com terraform import 'module.account.aws_iam_account_alias.this[0]' <the alias> terraform import 'module.security.aws_accessanalyzer_analyzer.account[0]' accountaccount_aliasset to it. The analyzer only if it's namedaccount; with another name, setaccess_analyzer = falseinstead. - Plan: each one you imported plans no change, and the rest are added. Read it, then apply it.
Or leave it to another tool. If something else keeps the public access block, EBS encryption by default or GitHub's provider, two tools must never both manage it: either one's teardown would delete it for the other. Name it in the base's managed_elsewhere (managed_elsewhere = ["github_oidc"], or public_access_block, ebs_encryption_by_default); the plan shows no change. The sites find GitHub's provider by its address, whoever made it.
Check: terraform state list names each one you imported; for one left to another tool, terraform output settings shows it under managed_elsewhere. Undo: terraform state rm each, by the same address: it stays in the account, and the base no longer manages it. This recipe is written from the AWS provider's documentation, read 2026-11-18, and hasn't run in an account already in use yet.
The detail: in the release, stacks/static-account/WALKTHROUGH.md, "Before you start", and stacks/static-account/HOWTO.md, "Adopt an account already in use" and "Leave a singleton to another root".
Keep the state in S3
When: you want Terraform's record of what it made somewhere safer than one folder on one machine. Every stack keeps its state in its own directory by default (terraform.tfstate), and that file is the only record: lose it, and Terraform no longer knows the site is there. One bucket in the account can hold every root's state, each under a key of its own: base/terraform.tfstate for the base, sites/<the site's name>/terraform.tfstate for each site. Two roots on one key would each read the other's resources as theirs.
- The bucket, once per account, by hand (it holds the state of the roots that would make it).
<prefix>is a short name of yours,<region>the stacks'region:
In us-east-1, leave outaws s3api create-bucket --bucket <prefix>-tfstate-<account id> --region <region> --create-bucket-configuration LocationConstraint=<region> --profile example-site aws s3api put-bucket-versioning --bucket <prefix>-tfstate-<account id> --versioning-configuration Status=Enabled --profile example-site aws s3api put-public-access-block --bucket <prefix>-tfstate-<account id> --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true --profile example-site--create-bucket-configuration. A real run, 2026-11-19, made its bucket with these three, before the base. Check:aws s3api list-objects-v2 --bucket <prefix>-tfstate-<account id> --profile example-siteshows noContents. - Expire old versions. Every lock and every apply leaves an old version behind, a few KB each (that run's bucket held 13 within the hour). Keep 30 days of them (not yet run):
aws s3api put-bucket-lifecycle-configuration --bucket <prefix>-tfstate-<account id> --profile example-site --lifecycle-configuration '{"Rules":[{"ID":"old-versions","Status":"Enabled","Filter":{},"NoncurrentVersionExpiration":{"NoncurrentDays":30},"Expiration":{"ExpiredObjectDeleteMarker":true}}]}' - A
backend.tfof your own in each root, beside the stack's files, with that root's key (here a site's; the base's haskey = "base/terraform.tfstate"):terraform { backend "s3" { bucket = "<prefix>-tfstate-<account id>" key = "sites/<the site's name>/terraform.tfstate" region = "<region>" profile = "example-site" use_lockfile = true } } - Init: to start on S3, put
backend.tfin place before the root's firstterraform init(with-reconfigureif you ran the offline check first);terraform state listthen saysNo state file was found!, since nothing is there yet. To move a root that's already up,terraform init -migrate-state, and answeryes.
Check: after the first apply (or the move), aws s3 ls s3://<prefix>-tfstate-<account id>/sites/<the site's name>/ --profile example-site lists terraform.tfstate, and a second plan says No changes. (a real run, 2026-11-19). After a move, keep the local terraform.tfstate.backup until that check passes. Undo: take backend.tf out, and terraform init -migrate-state again. The bucket bills a little storage until you empty and delete it, every version, after the last root is down. backend.tf is yours, like terraform.tfvars: an upgrade carries it over, and a second site never copies it.
The detail: in the release, stacks/static-site/HOWTO.md, "Keep the state in S3", the one recipe for both stacks.
Publishing
A publish is the same two commands however it's run: copy the folder your build writes (its output, never its source) to the site's bucket, then clear CloudFront's copies of the old files. Who runs them, and with what sign-in, is what differs: your repository's CI on each merge, or you from your own machine. Either way, the site's deploy role can change this site's files and nothing else in the account.
Publish from your repository's CI
Not yet run end to end. This workflow is written from reading the code and GitHub's and AWS's documentation. No run of it is on record yet.
When: the site's files live in a GitHub repository, and you want each merge to main published. Starting state: the site is up, and its repository's three variables are set (terraform output -raw repository_variable_commands, the tutorial's step 3).
- Add the workflow to the content repository, as
.github/workflows/publish.yml. The release has it whole, as text. On a push tomainit signs in as the site's deploy role (with no stored keys: GitHub's OIDC provider, which the base made, vouches for the run), syncs the folder to the bucket with--delete, and invalidates/*. - Set two things in it: its
aws-regionto the stack'sregion, and its./distto the folder your build writes: the build's output, never its source (./distfor Vite and Astro). A build step, if your site needs one, goes before the sync. - The tripwire. On a pull request, the workflow asks for the deploy role, and must be refused: the role trusts pushes to
mainonly, so only what's merged is published. If a pull request's run ever gets the role, the trust is too wide: stop, and fixdeploy_subject.
Check (the smoke check): open a pull request first. Its run is green, with the tripwire's step refused (Not authorized to perform sts:AssumeRoleWithWebIdentity). Merge it: the push's run is green, and once the invalidation completes (aws cloudfront get-invalidation --distribution-id <id> --id <its id> --profile example-site says Completed), curl -s https://www.example.com/ serves the merged content. Undo: revert the commit on main; the next run publishes the old files.
An option, cache headers: for a build that puts its assets under hashed names in a folder of their own, the recipe shows a two-pass sync, the hashed files cached for a year and the rest asked for again each time.
The detail: in the release, stacks/static-site/HOWTO.md, "Publish from the repository's CI", with the workflow, its pinned actions and the cache-headers option.
Publish from your own machine
Not yet run on AWS. This recipe is written from reading the code and AWS's documentation.
When: you publish by hand, or an AI agent working for you does, with no repository's CI. A site with no content repository at all (a small app built on your machine, say) needs no deploy_subject. You sign in as yourself, and each publish takes the site's deploy role for an hour at most: it holds this site's bucket and distribution, and nothing else in the account. Starting state: the base and the site are applied.
What you need first:
- The AWS CLI, version 2:
aws --versionprintsaws-cli/2.…, and 2.32.0 or later foraws login, below. - A profile for this account that isn't the root user, an administrator's: the one you plan and apply with.
aws configure list-profileslists your profiles' names. Then:
prints who it signs in as:aws sts get-caller-identity --profile <your profile> --query Arn --output textarn:aws:iam::<account id>:user/… orarn:aws:sts::<account id>:assumed-role/…. If it ends in:root, it's the root user's, and AWS never lets the root user take a role ("You cannot assume a role when you are signed in as the AWS account root user", IAM's user guide). Make an administrator first. - No administrator yet? In the console, signed in as the root user: IAM, Users, Create user. Give it a name (
<you>-admin), console access with a password, and the AWS-managed policyAdministratorAccess, attached directly; turn on MFA for it. Sign in as that user. Thenaws login --profile <your profile>opens the browser: choose the<you>-adminsession, never the root user's. The CLI keeps short-lived credentials and renews them for up to 12 hours (AWS's "Login for AWS local development using console credentials"). The command above then prints…:user/<you>-admin. An access key in place ofaws loginworks too, but it lasts until you delete it, for anyone who has a copy: keep it out of every repository and chat.
- Turn on
local_publish, in the site'sterraform.tfvars:
The plan islocal_publish = true deploy_subject = null # only for a site with no repository; keep it to let the repository's CI publish too1 to change: the deploy role's trust, in place. Apply the saved plan. Anyone in this account whose own permissions allow it, an administrator however they sign in, can then take the role, for an hour; nothing outside the account can, and the root user never can. - Give the deploy role a profile of its own, once. The three values are in
terraform output -json repository_variables;<name>is the site'sname, and<region>itsregion:
They write aaws configure set role_arn <AWS_DEPLOY_ROLE_ARN> --profile <name>-deploy aws configure set source_profile <your profile> --profile <name>-deploy aws configure set duration_seconds 3600 --profile <name>-deploy aws configure set region <region> --profile <name>-deploy[profile <name>-deploy]block to~/.aws/config. Each command with that profile signs in as you, takes the deploy role, and uses it alone. Nothing secret is printed, and nothing goes in your shell's environment, so it works the same across separate commands, which is how an agent's commands run. - Publish: one recipe, whether you run it or an agent does, and for any site: the release's
stacks/static-site/kit/CLAUDE.md, "Deploy it." Each command names--profile <name>-deploy, in this order:- The four values:
scripts/deploy-vars.sh <the site's root>printsDEPLOY_PROFILE(<name>-deploy),SITE_BUCKET,DISTRIBUTION_IDandSITE_DOMAINfrom that root's outputs. It only reads. - The identity check:
Stop unless it namesaws --profile <name>-deploy sts get-caller-identity --query Arn --output textassumed-role/<name>-deploy/. Anything else is the wrong session, and a sync with it would publish as you. - The quality check on the build, before the sync:
scripts/check-site.sh --built <dir>("Check the site's quality"). - The sync, then the invalidation and its wait:
aws --profile <name>-deploy s3 sync <dir> "s3://<SITE_BUCKET>/" --delete --cache-control no-cache aws --profile <name>-deploy cloudfront create-invalidation --distribution-id <DISTRIBUTION_ID> --paths '/*' aws --profile <name>-deploy cloudfront wait invalidation-completed --distribution-id <DISTRIBUTION_ID> --id <its id> - The same check, live:
scripts/check-site.sh --quality <domain>.
<dir>is the folder of files to publish: the build's output, never its source (./distfor Vite and Astro; a kit app's issite/). - The four values:
Never let a command print credentials: no aws sts assume-role or aws configure export-credentials on its own, and, in an agent's session, no env, printenv or aws configure list. Each puts keys on the screen, and into an agent's transcript. The release also shows a second way for a person's own terminal: the role taken once, inside a subshell, so its keys are gone when it ends.
If it goes wrong:
not authorized to perform: sts:AssumeRoleat step 3's first command: step 1's apply hasn't run,<your profile>is the root user's or another account's, or its own permissions don't allow taking a role (a read-only profile's don't).- Terraform worked, and the publish is refused:
aws loginaccepts the root user, so Terraform ran as root with no error, but root can never take the deploy role. Make the administrator above, andaws loginagain as that user. The source_profile "<x>" referenced in the profile "<name>-deploy" does not exist: set step 2'ssource_profileagain, to one thataws configure list-profileslists.ExpiredToken, or a message that your session has expired: sign in again the way you did, then run the command again.
Check: before the sync, aws --profile <name>-deploy s3 ls (every bucket in the account) is refused with AccessDenied: the session holds this site alone. After the invalidation completes, scripts/check-site.sh www.example.com passes. Undo: local_publish = false, with a deploy_subject set (the plan refuses a role that trusts no one), then plan and apply; and remove the [profile <name>-deploy] block from ~/.aws/config.
The detail: in the release, stacks/static-site/HOWTO.md, "Publish from a local session with short-lived credentials".
Check the site's quality
When: before and after each publish, however you publish. The quality guard holds your site's own files to a general static-site standard: favicons and the touch icon, a web app manifest that makes the site installable, a service worker for an app, the page's basics, its title and description, the canonical address, the cards a link shows when it's shared, every local link, robots.txt, the sitemap, the 404 page, and whether search engines may index it. It asks nothing of AWS. It needs only python3 and its standard library.
Two runs of one script, scripts/site_quality.py, which scripts/check-site.sh hands its arguments to:
scripts/check-site.sh --built <dir> [--config <site-quality.json>] # B: the built folder, before you publish, offline
scripts/check-site.sh --quality <domain> [--config <site-quality.json>] # L: the live site, after you publish, over HTTPS
- The B run reads the folder you're about to upload, so a page with no favicon, or a manifest with no start page, never goes out.
- The L run checks what only the live site has: status codes, content types, headers, the 404 page and
robots.txt. Run it once the invalidation completes. - The stack's own check is separate:
scripts/check-site.sh www.example.com(the security headers, the certificate, the redirect from plain HTTP). Run both after a publish.
Your site's declaration, site-quality.json, at your site repository's top (never inside the folder you publish). Both runs read it from the current directory:
{
"url": "https://www.example.com/",
"kind": "site",
"indexing": "indexed",
"exceptions": {
"WEB-PWA-1": "not installable: a document, not an app"
}
}
url: the site's root,https://, ending in/.kind:site, orappfor one that works offline or holds state (an app needs a service worker).indexing:indexedornoindex, with no default.noindexalso needsindexing_reason, one sentence, and may setnoindex_via:meta(a robots tag on every page, the default) orheader(the stack'snoindex = true).installable(optional):truefor an app that must install to a phone's home screen. It needskind: app, and no exception may excuse the install checks.exceptions: a check's ID to its reason, one sentence each. It covers that one check alone, and an exception that's no longer needed is reported, with a warning that it can go.
The checks come in families, each with an ID: the declaration (WEB-DECL), icons (WEB-ICON), the manifest (WEB-MAN), installing (WEB-PWA), the page's head (WEB-HEAD), link previews (WEB-SOC), local links (WEB-LINK), crawling (WEB-CRAWL), the 404 page (WEB-ERR) and indexing (WEB-IDX). Each is a FAIL, which blocks, or a WARN, which is reported and doesn't.
You'll see one line per check per page or file (ok, FAIL, WARN, n/a with why, or excepted with its reason), then a summary line that counts each, such as summary: 29 ok, 0 FAIL, 2 WARN, 4 n/a, 1 excepted (B: the built output, before publish). It exits 0 with no FAIL, 1 with any FAIL, and 2 when it can't run: a declaration that isn't JSON or has no https address, a folder with no HTML, a domain that isn't the declared address's, or a site that doesn't answer.
In CI: copy scripts/site_quality.py into your site's repository (say, tools/site_quality.py, noting the release it came from) and run it directly, with the same arguments: the B run after the build and before the credentials, so a pull request that breaks a check fails before it merges, and the L run after the invalidation completes. The release has the workflow's steps (not yet run).
Check: the B run exits 0 on the folder you publish, and the L run exits 0 once the invalidation completes. Undo: stop running it; nothing else changes.
The detail: in the release, stacks/static-site/HOWTO.md, "Check the site's quality", with every check's ID, what passes it, and a worked example.
After the first site
Add a second site
When: another site in the same account. It's the site's stack again, in a directory of its own, with its own state, and no second base: the base is the account's, applied once. It works the same with no site up yet, a throwaway site before the first, say (a real run, 2026-11-19, did this). A second proving run, 2026-11-20, brought a second site up in 7 min 37 s.
Count first. An account holds 20 sites by default: each makes one custom response headers policy, and CloudFront allows 20 an account (its quotas page, 2026-11-18; you can ask AWS for more).
aws cloudfront list-response-headers-policies --type custom --query 'ResponseHeadersPolicyList.Quantity' --profile example-site
- A directory of its own, beside the first, so its modules still resolve. From
stacks/static-site:
It copies the stack's own files and the shipped tests toscripts/new-site.sh site-twostacks/site-two, refuses a directory that exists, and prints what's next. Beside a site that's up,scripts/new-site.sh --like static-site site-two www.example.orgalso writes the new site'sterraform.tfvars, taking the account's values from the first, and, when the first has abackend.tf, one with the same settings and a key of its own. - Its own inputs. The same
account_id,profileand, under the same parent,parent_dns. Its own:name, different from every other site's in the account: it names the bucket, the deploy role and the distribution's parts.terraform output namesin each site lists what it holds.domain: each domain once per account; never reuse one while its site stands. Check:aws cloudfront list-distributions --query "DistributionList.Items[].Aliases.Items[]" --profile example-sitedoesn't list it.deploy_subject: each site's deploy role trusts exactly one subject. To publish two sites from one repository, the second uses a GitHub environment of that repository, with its own three variables (a private repository on GitHub's free plan can't use environments); never another branch, whose run would read and overwrite the first site's variables. Otherwise give each site its own repository. The release has the environment's commands (not yet run).
nameor onedomaincollide, and no plan catches it, since one state can't see another's. "Check your inputs offline", made again in each site, does. - Never copy
backend.tf,terraform.tfvars,.terraform/or a state file from the first site: a copied backend would read the first site's resources as the second's, and its apply would change or destroy them. - Then the site's steps again, without the base: the tutorial's step 3 from its inputs, in
stacks/site-two. The plan is the same18 to add, with the second site's names.
Check, before its first plan: on local state, terraform init names no backend, and terraform state list says No state file was found! and exits 1; with a backend of its own, init names the new key, and state list prints nothing. After the apply, terraform output names shares no value with the first site's. Undo: "Take it down", in stacks/site-two: only its resources go. stacks/site-two is the one directory you add inside vendor/hyperstack/: the release's checksums ignore it, and an upgrade carries it over.
The detail: in the release, docs/how-to/how-to.md and stacks/static-site/HOWTO.md, "Add a second site".
Turn on an option
Each option is an input of a stack: set it in that stack's terraform.tfvars, plan, read it, apply. Its undo is the input back as it was. Each has a recipe of its own in the release, with its plan and its check.
- Your own 404 page (site): publish a
404.htmlwith the site, then setnot_found_page = "/404.html", only when the build holds the page (ls ./dist/404.html): a bundler's stock build has none, and without it a missing page keeps S3's 403. The distribution updates in place. Write the page's links root-absolute (/style.css, neverstyle.css): CloudFront serves it at the missing page's own address, at any depth. Without it, a missing page answers S3's403. Check:curl -sI https://www.example.com/no-such-pageanswers404. - Out of search engines (site):
noindex = trueaddsX-Robots-Tag: noindex, nofollowto every answer. Check:curl -sI https://www.example.com/showsx-robots-tag: noindex, nofollow. - How addresses map to files (site):
rewriteisindexby default (/path/serves/path/index.html),spafor a single-page app (a path with no extension serves/index.html), ornone. - Only some viewers (site):
allow_cidrs, the address ranges that may see the site, IPv4 and IPv6, up to 50. Any other viewer gets a403. It's an address list, not a sign-in: anyone behind a listed address gets in. Keepnoindex = truewith it. Not yet run. - Share with a key (site): a link with a long random key, for a preview a few people outside your network should see. The stack takes the key's SHA-256, never the key. One shared key, not user accounts. Not yet run.
- The replica (site):
replica = truecopies the site to a second bucket inreplica_region, and serves from it if the first fails. The plan is10 to add(from the stand-in plans; not yet run on AWS), and files already there are copied once by hand. It adds the replica's storage and requests. - A spending alert (base): one budget per account. If you made it by hand (NEW-TO-AWS.md, section 4), you have it: don't add this. Otherwise, two lines in the base's
terraform.tfvars, the amount in US dollars and the addresses it mails:
The plan ismonthly_budget_usd = 5 budget_emails = ["<your address>"]1 to add. Pick a small amount above your zone's charge, such as 5, or it mails you for the zone alone. A budget with no actions is free. Check:aws budgets describe-budgets --account-id <account id> --profile example-sitelists it. - GuardDuty (base): AWS's threat detection, one per account, and billed (AWS's GuardDuty pricing page). The base doesn't pass it as an input: add
guardduty = trueto themodule "security"block instacks/static-account/main.tf, then plan and apply. Not yet run. That edit to a shipped file shows in the release's checksum check, and an upgrade must carry it over.
The detail: in the release, docs/how-to/how-to.md, "Turn on an option"; stacks/static-site/HOWTO.md, "Serve your own 404 page", "Keep the site out of search engines", "Change the rewrite", "Allow only some viewers", "Share a site with a key" and "Turn on the replica"; stacks/static-account/HOWTO.md, "Set, change or drop the budget"; modules/security/HOWTO.md, "Turn on GuardDuty in a member account".
Upgrade
When: a newer release. Take it whole, and never patch a module in place. First read its CHANGELOG.md, from the versions you have to the new ones: a major version says what breaks, and the exact step to take.
- Put the new release at
vendor/hyperstack/, as the tutorial's step 1, and check it the same way. Carry your own files over from the old tree: eachterraform.tfvars, any localterraform.tfstate, eachbackend.tf, eachmine/(made again from the new tests), any edit you made to a stack'smain.tf, and each further site's directory (its.tffiles from the new stack, its own files kept). - In each root, the base first:
with the changelog's own upgrade steps before the plan. Anything the plan replaces or destroys must be something the changelog named; otherwise stop.terraform init terraform test terraform test -test-directory=mine terraform plan -out=upgrade.tfplan - Apply the saved plan, even when it shows no changes.
Check: a second plan shows no changes, and each site still serves (scripts/check-site.sh <domain>). A site applied before stacks/static-account existed holds the account's base in its own state: its upgrade is its own recipe, and its plan must say 0 to destroy. No worked upgrade across a major version is on record yet.
The detail: in the release, docs/how-to/how-to.md, "Upgrade"; stacks/static-site/HOWTO.md, "Upgrade a module"; stacks/static-account/HOWTO.md, "Upgrade a site that held the base".
The end
Take it down
When: only once you mean to delete a site and its content. Every step deletes something: name each deletion to yourself first. The order leaves nothing of the site's billed: the content, then the stack, then a check; the base only after the last site.
- Each site, from its own directory:
- Turn its publish workflow off, if it has one.
- With a zone of the site's own, remove the NS record for the site's name at the parent's DNS host first, so nothing points at a zone that's going.
- Empty the site's bucket, every old version included (and the replica's, if it's on): the destroy refuses a bucket that still holds anything. The S3 console's Empty does it; the release has a command for it.
- Plan the destroy, read it, then apply it:
You'll seeterraform plan -destroy -out=down.tfplan terraform apply down.tfplan18 to destroy(a real run, 2026-11-19);19with a zone of the site's own, since the zone goes with the site (not yet run);28with the replica,29with both (not yet run). If the certificate's delete is refused withResourceInUseException, AWS still lists it in use by the distribution just deleted: wait about 15 minutes, then plan the destroy again and apply it. Never delete the certificate by hand. It may not come at all: a run on 2026-11-19 met it, and one on 2026-11-20 met it in neither of two destroys. - Check that nothing is left:
scripts/sweep.sh <name> <domain> <zone id>, read-only. You'll seeokon every line; aLEFTnames what's still there. - Delete the repository's three variables, and the site's state.
- After the last site, the base, if you mean to, in
stacks/static-account:- Check that no deploy role still trusts GitHub's provider:
You'll see an empty list.aws iam list-roles --query "Roles[?contains(to_string(AssumeRolePolicyDocument), 'token.actions.githubusercontent.com')].RoleName" --profile example-site - Take out of the state what you adopted ("Adopt an account already in use"), with
terraform state rm, so the destroy leaves it as it was. - Plan the destroy, read it, then apply it:
4 to destroyby default, one more with a budget, one fewer for each one you took out (not yet run). It turns the account's public access block and EBS encryption by default off.
- Check that no deploy role still trusts GitHub's provider:
What no stack removes:
- A zone you made by hand for a new or unused domain: $0.50 a month until you delete it, once only its NS and SOA records are left (its undo).
- The state bucket, if you made one: empty it, every version, and delete it.
- Three things AWS made and keeps, which cost nothing: the service-linked roles
AWSServiceRoleForAccessAnalyzerandAWSServiceRoleForCloudFrontLogger, and the AWS-managed keyaws/acmin us-east-1. A sweep that finds them after a teardown has found no leftover (a real run, 2026-11-19, found these three, and nothing else). - The account itself, and your domain, which renews where you bought it until you turn its auto-renew off.
Check: terraform state list in each root prints nothing, and dig A www.example.com +short stops answering once its time to live has passed. Undo: none for the content. The infrastructure comes back by applying again, the base first.
The detail: in the release, docs/how-to/how-to.md, "Take it down"; stacks/static-site/HOWTO.md, "Take it down", with its checklist of what must be gone; stacks/static-account/HOWTO.md, "Take it down".
Next
- A fact to look up (an input, a cost, an error, what has run): the reference.
- The first site, step by step: the tutorial.
- Why it's shaped this way: in the release,
docs/explanation/explanation.md, for now.