Repository navigation
Release
For operators: how to deploy an environment with the release script, set up a new environment, ship a new version and publish the npm package.
Every deploy is run by the owner with one script, scripts/release.sh. It builds everything, saves a Terraform plan in HCP Terraform, refuses dangerous plans, asks for a typed word, applies, syncs the site, clears the CloudFront cache and checks the health route. The npm package is published separately, by a GitHub Actions workflow started by a version tag. See Operations for the environments and who runs what.
scripts/release.sh dev
scripts/release.sh prod
Deploy dev first and prod second. The script takes exactly one argument; anything other than dev or prod prints the usage and exits with status 2 before any Terraform runs.
The typed confirmation differs per environment: dev asks you to type yes, prod asks you to type prod. A yes meant for dev can therefore never apply production.
-
Reads the backend settings. It reads
infra/envs/<env>/cloud.auto.tfbackendasKEY=VALUElines (it never sources the file) and exportsTF_CLOUD_ORGANIZATION,TF_CLOUD_PROJECTandTF_WORKSPACE. A missing key stops the script and is named. -
Checks the tools and your AWS session.
terraform,jq,npm,awsandcurlmust be installed, andaws sts get-caller-identitymust succeed. Otherwise it stops withno AWS session; run aws sso login first. -
Builds. It builds the TypeScript workspace (
npx tsc -b), the two Lambda bundles (npm run build:lambda --workspace @compass/pass-service, copied toinfra/build/api-lambda.zipandinfra/build/passkit-lambda.zip) and the site (npm run build --workspace site). It then copies the three Google Wallet images (logo-v1.png,wide-logo-v1.png,hero-v1.png) from packages/pass-service/artwork/google into the built site underwallet/, because Google fetches them from<public base URL>/wallet/. -
Checks it can reach the right account. After
terraform initit reads thesite_bucket_nameoutput of the last apply and runsaws s3api head-bucketon it. A session in another account stops here, before anything is planned, with a message that namesAWS_PROFILE. A first deploy has no bucket yet and skips this. -
Plans. It runs
terraform plan -out=tfplanwithservice_versionset fromgit describe --tags --always --dirty. The plan JSON is held in memory and piped throughjq; it is never written to disk. The saved plan filetfplanis git-ignored, excluded from the HCP upload, and deleted when the script ends, whatever the outcome. -
Refuses dangerous plans. It exits non-zero and prints the addresses or types (never values) if the plan would delete or replace a resource of a retained type (
aws_cloudfront_distribution,aws_dynamodb_table,aws_secretsmanager_secret,aws_s3_bucket), or touches any resource type outside its allow list of 32 types. -
Asks for the typed word. It prints
plan for <env>: N to add or replace, N to change, N to destroy, thenType yes to apply this plan to dev:orType prod to apply this plan to prod:. Anything else printsaborted: nothing was applied. -
Applies, syncs and invalidates. It applies the saved plan. An empty plan skips the apply (HCP Terraform refuses to apply a saved plan with no changes) but still syncs, invalidates and checks health. It then syncs the site to the site bucket with
aws s3 sync --delete, uploads.webpfiles again with their content type stated, and creates a CloudFront invalidation for/*. -
Checks health. It calls
GET https://<cloudfront domain>/api/v1/healthup to six times, ten seconds apart. Only HTTP 200 counts.
The health check goes to the CloudFront default domain of the environment, not the custom domain. Because every request passes the origin guard first, a 200 proves the whole path: CloudFront, the API key that CloudFront adds, API Gateway, the Lambda, and the origin-verify secret. The route answers {"status":"ok","version":"<service version>"}.
You can override the build steps with COMPASS_WORKSPACE_BUILD_CMD, COMPASS_LAMBDA_BUILD_CMD and COMPASS_SITE_BUILD_CMD, and the site output folder with COMPASS_SITE_DIR.
The script ends with health check passed (HTTP 200) and exit status 0. Run it again with no commit in between and the plan shows no changes. After a new commit the api Lambda shows one in-place update, because service_version comes from git describe.
- The bootstrap has been applied and a second apply shows no changes (see Operations).
-
infra/envs/<env>/cloud.auto.tfbackendexists, copied from the.examplenext to it, with your organisation, project and workspace names. It is git-ignored. - You are signed in with your own SSO session (
aws sso login) in the Compass account. If your default identity belongs to another account, prefix the command:AWS_PROFILE=<profile> scripts/release.sh dev. -
terraform,jq,npm,awsandcurlare installed andnpm cihas run. - The provider lock files of the three roots (
infra/bootstrap,infra/envs/dev,infra/envs/prod) are committed. To regenerate one, runterraform providers lock -platform=linux_amd64 -platform=windows_amd64 -platform=darwin_arm64in that root and commit it. A lock made by a plainterraform initon one machine can fail on the HCP runners. - The workspace variables are set. The bootstrap writes the non-sensitive ones from
workspace_variablesin its tfvars:event_timezone,event_window_start,event_window_end,id_token_issueranddomain_name, plus any optional ones you add. The three sensitive ones (alarm_email,origin_verify_value,api_key_value) are written byset-workspace-secrets.sh(see Secrets).
Reserved concurrency is a deliberate cap: 20 for the api Lambda and 10 for the passkit Lambda. A new AWS account can have a Lambda concurrency quota too low to reserve any. If the first apply fails on reserved concurrency, request a quota increase in Service Quotas and keep the defaults. Do not set api_reserved_concurrency or passkit_reserved_concurrency to -1: that removes the cap.
Run these once per environment, in this order.
-
Domain. The hosted zone for
reinvent-compass.vegasexists (the bootstrap registers the domain, or reads an existing zone). Setdomain_nameper environment:dev.reinvent-compass.vegasfor dev,reinvent-compass.vegasfor prod.hosted_zone_namekeeps its default. The ACM certificate validates itself through DNS records the first apply creates, usually within a few minutes. - Edge values. Generate the origin-verify value and the API key, and set the sensitive HCP variables from them (Secrets, steps 1 and 2).
-
First release. Run
scripts/release.sh <env>. It creates the infrastructure with empty secret containers. The health check fails and the script exits non-zero: by design the API refuses every request until the origin-verify secret is loaded. That is not a failed deploy. -
Secrets. Load
origin-verify,app,appleandgoogle, then runscripts/check-secrets.sh <env>. All seven values must report present. -
Google Wallet class. Create it with
scripts/google-wallet-class.mjs(Secrets). -
Second release. Run
scripts/release.sh <env>again. The health check must pass, and the plan must show no changes apart from the api Lambda update a new commit causes. - Alarm email. Click the confirmation link AWS emails to the alarm address. Until then the alarms notify nobody.
With domain_name set, the Lambdas know their public address (https://<domain_name>) from the first apply. Without it, set the variable public_base_url to https:// plus the cloudfront_domain_name output and release once more: the distribution depends on the Lambdas, so they cannot learn its address any earlier.
The release is cut from main. There is no release branch.
- Open a pull request from
developintomain, wait for the checks to go green, and merge it. - Check out
mainin a clean working tree (git switch main,git pull,git statusshows nothing) and runnpm ci. - Rehearse on dev:
scripts/release.sh dev. It must end withhealth check passed (HTTP 200). - Release prod:
scripts/release.sh prod, and typeprod. - Check the custom domain yourself, since the script checks the CloudFront domain:
curl https://reinvent-compass.vegas/api/v1/healthmust return HTTP 200. - Smoke test on a real iPhone and a real Android phone: open the board page, issue a pass and add it to the wallet.
- Run the
e2eworkflow (.github/workflows/e2e.yml) by hand on themaincommit. It runs Playwright with axe on seven device profiles and must be green. - If the npm package changed, publish it (below).
- Merge
mainback intodevelopso the branches match. - Watch the five alarms and the health route for 30 to 60 minutes. If something breaks, roll forward or use the kill switch.
The MCP server is published to npm as reinvent-compass from packages/mcp-server. The workflow is .github/workflows/publish.yml. It runs only on a pushed tag that matches v*, never on a branch push, a pull request or a schedule. It publishes through npm trusted publishing with provenance, so no npm token is stored anywhere. Every action in it is pinned by commit SHA.
-
Claim the name. A trusted publisher can only be added to a package that already exists, so a placeholder
0.0.1was published once by hand. That version is spent: npm never lets a version be reused, so a real release is0.1.0or later. -
Add the trusted publisher on npmjs.com (package settings, Trusted Publisher, GitHub Actions): the repository owner and name, the workflow file
publish.yml, the environmentnpm-publish, and only the "npm publish" action. The CLI equivalent is:npm trust github reinvent-compass --file publish.yml --repo henniefrancis/aws-re_invent-compass --env npm-publish --allow-publish npm trust list reinvent-compass -
Revoke any npm token used for the manual publish.
Do these in one commit:
- Set the same version in packages/mcp-server/package.json, power/plugin.json, power/mcp.json, power/POWER.md, the hook template and every
npx --yes reinvent-compass@X.Y.Zexample in the package README and underpower/. The tests in packages/mcp-server/test/power fail if any one differs. - Check that
COMPASS_API_BASE_URLin compass-api.ts is the prod domain,https://reinvent-compass.vegas, with no trailing slash. A published version cannot be changed, so a wrong address there makes the version useless. - Run
npx tsc -b,npm run lint,npm run format:checkandnpm test. - Check the file list once by hand:
npm pack --dry-run --workspace packages/mcp-server. It may hold only the entries of thefileslist in the package.json (the three bundles indist/, thedist/data,dist/sample-repoanddist/fixturesfolders,README.md,LICENSE,NOTICE,THIRD-PARTY-NOTICES.txt) andpackage.json.
- Deploy prod first, so
https://reinvent-compass.vegasanswersGET /api/v1/health. - Merge the release commit to
main. - Check the trusted publisher (
npm trust list reinvent-compass, or the package settings page). If it is missing or has expired, delete it and add it again. - Create the tag
vX.Y.Zon that commit, whereX.Y.Zis the package version, and push it. - Approve the publish job when it waits in the
npm-publishenvironment.
flowchart LR
T["push tag v*"] --> V["verify: contents read only"]
V -->|npm-tarball artifact| P["publish: id-token write, npm-publish environment"]
P -->|"npm publish --provenance"| R["npm registry"]
It has two jobs, so the job that holds the OIDC token runs none of the repository's code.
-
verifyhascontents: readonly: noid-tokenand no environment. It runsnpm ci,npx tsc -b,npm run lintandnpm test; checks that the tag equalsvplus the package version; builds the workspace and the package; checks the packed file list with check-pack.mjs (any missing or unexpected file stops the run); packs the tarball withnpm pack; and uploads it as thenpm-tarballartifact, kept for seven days. -
publishneedsverifyand runs only when the ref starts withrefs/tags/v. It holdsid-token: writeand thenpm-publishenvironment, so it waits for approval. It does no checkout, nonpm ciand runs no package script. It sets up Node 24 with the npm registry, fails if npm is older than 11.5.1 (trusted publishing needs it), downloads the tarball, checks there is exactly one namedreinvent-compass-<version>.tgz, and runsnpm publish <tarball> --provenance --access public. What is published is exactly the fileverifybuilt and checked.
- On a clean machine, run
npx reinvent-compass@X.Y.Z demoand check that it starts. - In Kiro, use "Import power from GitHub" with the folder URL
https://github.com/henniefrancis/aws-re_invent-compass/tree/main/powerand check that the Kiro Power loads. - Set
packageVersionin site/src/lib/content/links.ts to the published version and release the site withscripts/release.sh prod. - After the first real release, deprecate the placeholder once:
npm deprecate reinvent-compass@0.0.1 "Placeholder. Use 0.1.0 or later."
These are account and repository settings, not code:
- Keep two-factor authentication on for the npm account, including for publishing.
- In GitHub, under Settings, Environments,
npm-publish, require the owner as reviewer and allow deployments only from tags matchingv*.
-
File list check failed. The message names each
missing:orunexpected:path. Fix thefileslist or the build script; never edit the checker to make it pass. - Tag and version differ. Delete the tag locally and on the remote, fix the version, and tag again.
-
npm publishreports E404 onPUT https://registry.npmjs.org/reinvent-compassright after the provenance statement. npm refused the OIDC token exchange, so nothing was published. Check the trusted publisher (missing, expired, or a field that differs), fix it, then use "Re-run failed jobs" on the same run. The tag and the checked tarball stay as they are. -
A published version is wrong. It cannot be overwritten. Publish a new patch version and run
npm deprecateon the bad one.
- A plan refusal names the resource or type. Fix the cause. Never edit the script to get past it.
-
AccessDeniedduring the apply means a statement in the apply role policy in infra/bootstrap is too narrow. Extend only that statement, apply the bootstrap again, and review the diff before you release again. Never widen a statement to a wildcard. -
your AWS session cannot reach the <env> site bucketmeans your shell is signed in to another account. SetAWS_PROFILE, runaws sso login, and try again. Nothing was applied. -
The health check fails after a release that should be healthy: run
scripts/check-secrets.sh <env>. If every value is present, the HCP origin-verify value and the stored secret may differ; set both again from the same file (see Secrets). -
terraform initfails with "unauthorized": aTF_TOKEN_app_terraform_ioleft over from another project is in your shell. Load the Compass token in the same shell first (for example withread -rs). -
A plan or apply role was recreated: the bootstrap writes the role ARNs into the workspaces as write-only values, so a changed ARN is pushed only when you raise
value_wo_versionon both role variables in workspaces.tf and apply the bootstrap again.
- The scripts run under Git Bash on Windows as well as on Linux and macOS: they strip the carriage returns that the Windows AWS CLI and
jq.exeadd. Run them from Git Bash, not from a WSL shell that lacks the tools. - The
hash_keyandrange_keydeprecation warnings on the DynamoDB table are expected and harmless; the module keeps those arguments on purpose. - The alarm topic uses a customer managed KMS key, which costs about USD 1 a month and counts against the budget.
re:Invent Compass is an independent community project and is not affiliated with, endorsed by, or sponsored by Amazon Web Services. Boarding passes are unofficial: your re:Invent badge is your ticket. Licensed under Apache-2.0. Disclaimer · Repository · Project board
Get started
User guide
Architecture
- Overview
- Kiro Power
- MCP server
- Pass service
- Showcase site
- Flows
- AWS architecture
- Security
- Data and privacy
- Quality
Key decisions
- Index
- Product and scope
- Architecture
- Infrastructure
- Passes and wallets
- Security and privacy
- Delivery and tooling
Developer guide
Operations
Runbooks
How it was built
Reference
Links