Deployment on AWS#
Tearing an environment down is a parameter, not a destroy#
Superseded · 2026-10-01 · #96 · by The container architecture is removed from the infrastructure
Since #557 nothing is torn down. What billed by the hour went with the containers, and with it
running, billable.tf, check-billable-guard.py, env.sh down and what env.sh up did;
env.sh up now only applies an environment's root, and keeps the shown plan and the saved plan
file. The tag pre-serverless keeps the rest. What
follows is why teardown was a parameter.
Decision. Each environment has a running variable, default false. The resources that bill
live in modules/environment/billable.tf, each carrying count = var.running ? 1 : 0, so taking
an environment down is tofu apply with the variable false. deployment/aws-tofu/env.sh wraps
the two pieces of ceremony — the right AWS profile and the right variable — and
check-billable-guard.py fails the build on an unguarded resource in that file.
Why not a separate root for the billable layer. That was the alternative, and its appeal is
real: tofu destroy in a runtime root cannot reach the foundation, so there is nothing to aim.
It was rejected on two grounds. The environment roots have already been applied, so splitting
them now means migrating state keys on a live environment. And a parameter is the mechanism this
directory already uses for the only other axis it has — the difference between qa and prod — so
teardown becomes the same kind of reviewable change rather than a second concept.
Why the default is false. The cost model is that an idle environment costs nothing, so the
safe outcome of an apply nobody thought hard about should be a foundation and no bill. Defaulting
to true would mean the careless path is the expensive one.
Why it is never committed to terraform.tfvars. Whether an environment is up right now is a
fact about the world, not about the configuration. Committing it would make every teardown a
commit, and every git pull a potential surprise about what exists in AWS.
Why the guard is checked rather than remembered. A billable resource added without count
fails silently: the teardown succeeds, that one resource keeps running, and the first evidence is
the bill. That is exactly the class of mistake worth spending a check on, and the check is a
deliberately literal string match — a cleverer equivalent it cannot recognise is still something
a human has to reason about, which is what the rule exists to avoid.
On the script. It exists because the ceremony is two things that are quiet when wrong, not
because tofu is hard. It deliberately shows the plan and waits on every run, and applies the
saved plan file rather than re-evaluating, so what is applied is what was displayed. A script that
applied without showing would be how an environment gets destroyed by muscle memory.
Deploy identities are OIDC roles, scoped to deploying and nothing else#
Accepted · 2026-09-30 · #95
Revised in part on 2026-11-15 (#557): with the containers' infrastructure gone, the roles deploy the
Go backend's functions and the site bucket only, for an hour a session; the ECS, RDS and
iam:PassRole grants below, and their two limits, went with it
(below).
Revised in part: RunTask cannot be pinned to the environment's network, a limit added to the two
below, and env.sh and deploy-backend.py pass over a task revision without this environment's own
execution role (#429).
Decision. GitHub Actions deploys each environment by assuming an IAM role through GitHub's OIDC provider. The roles may register a task definition, update the one service, run the migration task, snapshot the database before a migration and write the site bucket. They may not create, change or delete any infrastructure. A human with their own privileges creates the VPC, the database, the load balancer and the cluster.
The snapshot grants are the downtime path's (#215, D1): a release with a migration is deployed
by the workflow, stop–snapshot–migrate–start, instead of by a person running down and up for an
hour with an MFA session. That needed rds:CreateDBSnapshot and DescribeDBSnapshots on this
environment's instance and its snapshots, rds:AddTagsToResource on its pre-release snapshots
-- the instance copies its tags to each snapshot, and RDS checks that against the caller, which the
first downtime deploy (v0.12.0) found -- and rds:DeleteDBSnapshot on its pre-release snapshots
only, to keep the newest three. Scaling the service and running the migration were
already allowed. The role still cannot delete or modify the database, restore it, or delete a
final snapshot or touch the automated backups (seven days, point in time): a misused deploy role
could migrate the data and delete pre-release snapshots, and those two remain the way back. Its
sessions last two hours rather than one, because the path's waits together can outlast an hour,
and credentials that expire mid-start would also fail the call that leaves the service safe.
Why the scope stops at deploying. A credential that can run tofu apply needs create and
delete on every resource the configuration manages, which is administrator for that environment
under a different name — there is no useful way to least-privilege it. Keeping infrastructure in
human hands means that credential is never created, which is a guarantee rather than an argument.
It also matches exposure to blast radius: the deploy identity is the one used unattended and
frequently, so it is the one most likely to be abused, and scoped this way the worst case is a bad
deployment rather than a dropped database.
Why roles and not users with access keys. This reverses the earlier plan. An access key is a
long-lived secret stored in GitHub; an OIDC role issues credentials that expire in minutes and
stores nothing, so there is no key to leak and no rotation to schedule. It also lets the trust
condition name the GitHub environment as well as the repository, which turns the prod approval
gate into an AWS refusal instead of only a GitHub courtesy. A secondary benefit: aws_iam_access_key
writes its secret into OpenTofu state in cleartext, and with roles the question does not arise.
Two limits, recorded rather than discovered later.
ecs:RegisterTaskDefinitioncannot be scoped to a resource, because the call creates one and there is no ARN or tag to condition on. The qa role can therefore register a revision in prod's task definition family, though with its own roles or none, never prod's execution role, sinceiam:PassRoleis pinned;env.shanddeploy-backend.pycarry or run only a revision with the environment's own execution role, which every revision of its own carries (#429). The bootstrap task's execution role, the one that reads the master secret, is not among those it may pass (#454). This is accepted: a task definition nobody runs is inert, and both calls that could run or deploy one are scoped to this environment's cluster and service.RunTask, though, has no condition key for the network a task runs in, so a one-off task can be started in the other environment's subnets; it carries only its own environment's roles, so it holds no credentials for the other database (#429). It does mean the earlier plan's "denied everything taggedenv=prod" is not literally achievable.- The policy scopes by explicit ARN, not by resource tag. With each identity touching a
handful of resources whose names the project chooses, ARNs are both tighter and simpler. A
tag-based
Denywas considered and rejected as theatre: every other statement is already ARN-scoped to one environment, and the one statement that is not has no resource to carry a tag.
One consequence for how the code is written. The policy names resources that do not exist yet —
the cluster, the service, the migration task family, the site bucket. It can do so because those
names are chosen rather than generated, so they live in a locals block that the changes
creating those resources must also use. CloudFront is the exception: a distribution's id is
generated by AWS, so cloudfront:CreateInvalidation is deliberately absent until the change that
creates the distribution can scope it to a real ARN, rather than being granted on * in advance.
OpenTofu rather than Terraform#
Accepted · 2026-09-30 · #94
Decision. The AWS infrastructure under deployment/aws-tofu/ is OpenTofu. The binary is
tofu, CI pins 1.12.6, and required_version is >= 1.10.
Why. The choice was made after comparing the two, and the honest summary is that Terraform was the safer default and lost on two specific features:
- A backend block can interpolate a variable (OpenTofu 1.8). Terraform evaluates nothing in
a backend block, so the state key has to be written out per environment. That made
backend.tfthe one file the environment roots could not share, and so the one exceptioncheck-environments-match.pyhad to carve out. On OpenTofu the roots are identical apart fromterraform.tfvars, and the exception is gone — which matters because prod is a parameter change from qa is the design of that directory, and every exception is somewhere drift can hide. - The S3 backend locks using S3 (OpenTofu 1.10), so there is no DynamoDB table to create, pay for, or forget when tearing an environment down. The bootstrap is one bucket.
Licensing was the reason to look, not the reason to switch. OpenTofu is MPL-2.0 where Terraform is BUSL-1.1, but BUSL only forbids offering a competing infrastructure-as-code product; using it to manage your own infrastructure is unrestricted, and neither licence touches this repository's own Apache-2.0.
What it costs, stated rather than discovered later. Terraform is what a commercial project is
more likely to use, and this environment is partly a proof-of-concept for one — so HCP Terraform,
Stacks and Sentinel are all out of reach, and documentation for awkward edge cases is thinner.
The languages and the provider protocol are the same, so the knowledge transfers; the tooling
around them does not entirely. Two further notes: state files stay compatible in both directions
unless OpenTofu's state encryption is enabled, which is a one-way door and is not used here;
and file names stay .tf and terraform.tfvars rather than OpenTofu's optional .tofu
extension, because every example and every provider document is written that way.
The plan is the deployment chapter; these are the choices in it that had a real alternative. Nothing is built yet — #60 produced the plan deliberately, because several of these are hard to reverse once anything exists.
One AWS account, with IAM roles and resource tags#
Accepted · 2026-09-30 · #93
This reverses an earlier decision to use separate accounts. The hosted zone and the certificates live in the existing account, and splitting turned every DNS record and every ACM validation into a cross-account operation — for two hostnames.
What it costs is stated rather than glossed#
Accepted · 2026-09-30 · #93
The technical IAM users below became OIDC roles soon after, with no access keys: Deploy identities are OIDC roles, scoped to deploying and nothing else.
With separate accounts, "prod is never created
by an automated agent" was enforceable because the prod account held nothing to assume. In one
account it is a policy: three technical IAM users, one per job, scoped by resource tag — a QA
deployer denied everything tagged env=prod, a prod deployer whose key lives in a GitHub
environment that requires human approval, and a read-only user for monitoring. The hole that remains is local credentials — an agent
running with an administrator profile could reach prod, and only a least-privilege local profile
stops it. That is a discipline, not a wall. The wall was the account boundary, and it was traded
for not having to cross an account boundary to write two DNS records.
A second consequence: with no per-account bill, cost attribution moves to tags, and an untagged resource becomes invisible to both environment budgets.
PostgreSQL on RDS, destroyed with a final snapshot when idle#
Superseded · 2026-09-30 · #93 · by The container architecture is removed from the infrastructure
Since #557 there is no database server. The Go backend's data is in DynamoDB; Gunnar deleted the final RDS snapshots on 2026-11-15. What follows is why the database was RDS.
The database is managed because this stands in for a commercial project and a managed database is part of what it proves. Rejected: stopping the instance. It still bills storage, and AWS restarts a stopped instance after seven days, so it does not survive a demo that is idle for weeks. Rejected: Aurora Serverless v2 with scale-to-zero, which pauses properly and resumes in about fifteen seconds — but it is Aurora rather than plain RDS, and the commercial project this represents would use plain RDS. Rejected: PostgreSQL as a container, the original plan, for the same reason RDS was chosen.
The application authenticates to RDS with IAM, not a password#
Superseded · 2026-10-01 · #108 · by The container architecture is removed from the infrastructure
Since #557 there is no RDS instance to sign in to, nor a task role. What follows is how the Quarkus backend signed in.
The task role is the
credential: a token signed per connection by a Quarkus CredentialsProvider, which Agroal asks
again for every connection it opens — DatasourceCredentialsPerConnectionTest holds it to that,
because a token fetched once would fail 15 minutes after the first connection was replaced.
Rejected: injecting the database password from Secrets Manager through the task definition.
RDS rotates a managed secret every seven days and ECS reads it only at task start, so a running
task would keep the old one; it would also have meant the application using the master user.
Rejected: the AWS Advanced JDBC Wrapper, which does the same signing inside a replacement
driver. It would have needed db-kind=other, an explicit Hibernate dialect, and Dev Services
replaced, where the credentials provider leaves the PostgreSQL driver and every test untouched.
Decided: one database user per environment, taskfest_<env>, for both the application and
the migrations, and the IAM grant names that user rather than the instance — an instance's
resource id changes with every restore, while the user travels with the snapshot.
The database user is created by a one-off ECS task, run by a person#
Superseded · 2026-10-01 · #109 · by The container architecture is removed from the infrastructure
Since #557 there is no database user and no one-off task; env.sh db-bootstrap and migrate
went with them. What follows is why the user was made that way.
Revised in part: the task starts with an execution role of its own, the only one that may read the master secret, and the deploy role may not pass it (#454).
It is the only thing
that needs the master credentials, and it is needed once per environment, so it is a task the
lifecycle role may run and the deploy role may not, started by env.sh db-bootstrap. ECS
injects the credentials when the task starts, so the seven-day rotation that ruled out injecting
them into the service does not apply to a task that lives for seconds. The master secret is
matched by the aws:rds:primaryDBInstanceArn tag RDS puts on it, because its name is random and
changes with every restore. Only the task's own execution role, taskfest-<env>-db-bootstrap-execution,
may read it, and only the lifecycle role may pass that role. It was the execution role all tasks
share at first, which the deploy role may pass: since it may also register any task definition, a
revision of its choosing, the backend's included, could have had ECS inject the master secret
(#454). env.sh db-bootstrap runs only a revision with that role, and the deploy role's UpdateService
may point the service only at the backend's own family, never at a bootstrap revision. Rejected: the backend creating its own user at start-up, which
would put the master credentials in the service. Rejected: a Lambda in the VPC, which is more
infrastructure for something that runs once.
The frontend is static on S3 behind CloudFront, with /api/* on the same distribution#
Accepted · 2026-09-30 · #93
No
container, no task, no image to patch — which is also part of the answer to #66. The second
origin is not optional: httpd currently serves the SPA and proxies the API, and that
same-origin arrangement is what the OIDC redirect_uri and the session cookie depend on.
Serving only S3 would break sign-in after deployment, where nothing local would catch it.
Rejected: the frontend container on ECS, which keeps local and production identical at the cost
of a load balancer target, a task and a base image that needs patching forever.
GitHub Actions, not CodePipeline#
Accepted · 2026-09-30 · #93
The technical IAM users below became OIDC roles soon after, with no access keys: Deploy identities are OIDC roles, scoped to deploying and nothing else.
One pipeline rather than two, and the prod gate is a protected environment. It runs as a technical IAM user per environment rather than assuming a role through OIDC, which is what was asked for. The cost is long-lived access keys held as GitHub secrets, where OIDC would have issued short-lived credentials and stored nothing; least privilege by tag, rotation, and an alarm on use from outside Actions are the mitigations, and moving to OIDC later changes nothing else in the plan. Cost did not decide the CodePipeline question — a V1 pipeline is about a dollar a month and CodeDeploy is free for ECS. Rejected: CodePipeline, which would be right if demonstrating AWS-native CI/CD were itself the point, or if blue/green still required CodeDeploy. It no longer does: ECS has blue/green natively, which removed the main argument.
Two deployment paths rather than expand-and-contract#
Superseded · 2026-09-30 · #93 · by The container architecture is removed from the infrastructure
Since #557 there are no containers to deploy to. What follows is how they were deployed.
Revised in part on 2026-11-15 (#559): deploy-backend.yml, which took both paths, went with the
Quarkus backend, so nothing deploys the containers any more; the Go backend has no schema to
migrate (The Go backend is deployed by moving an alias after a check).
A release with no migration goes
blue/green with zero downtime and an instant rollback; a release with a migration takes the
downtime, because nothing old running means nothing needs to be backward-compatible. The image
carries the schema it expects and the deployment picks the path. Rejected: expand-and-contract
everywhere, the usual answer, which buys zero-downtime schema changes at the cost of every
change shipping in two releases — not worth it when downtime is acceptable. Rejected:
migrate-at-start in production, which on ECS would migrate from a new task while an old one
still served.
The load balancer stays, and is internal#
Superseded · 2026-09-30 · #93 · by The container architecture is removed from the infrastructure
Since #557 there is no load balancer: CloudFront sends /api/* to the Go backend's HTTP API.
What follows is why there was one.
It is the largest fixed cost in an environment (~$16 a month, idle or not), so it was challenged. It stays because ECS blue/green shifts traffic between two target groups, which is a load balancer's job — there is no load-balancer-free form of it, and demonstrating blue/green is one of the reasons this deployment exists. Rejected: a Network Load Balancer, the same price per hour, and worse here — ECS adds a ten-minute delay to the blue/green lifecycle stages with an NLB and supports only all-at-once shifting. Rejected: CloudFront straight to the ECS service, which VPC origins do not support and which a changing task IP would break anyway. Rejected: an API Gateway HTTP API with a VPC link — which is cheaper, but by less than it appears. A VPC link is $0.01/hour, about $7.20 a month, charged at zero traffic, so the comparison is $16 against $7.20 and the saving is about nine dollars an environment, not sixteen. That nine dollars buys the blue/green demonstration, and it only applies while an environment is up — which, by design, QA usually is not. The real lever is destroying idle environments, and it destroys the load balancer too.
Rejected: one load balancer shared by both environments with host-based rules. It would halve the cost only while both are up, which is the uncommon case, and it cannot be destroyed with either environment — so it needs a third OpenTofu stack and couples the two together.
It is internal, reached through a CloudFront VPC origin, so it has no public address. Rejected: a public load balancer with a shared secret header that CloudFront sends and the load balancer checks — the older pattern, which works but leaves a bypass that depends on a secret staying secret. VPC origins remove the public address instead, at no cost.
Custom hostnames under an existing zone#
Accepted · 2026-09-30 · #93
taskfest-qa.cloud.hilling.de and
taskfest.cloud.hilling.de, as alias records to each environment's distribution. This is what
makes the Google OIDC redirect URIs knowable before the environments exist, which matters
because that configuration is manual and cannot be automated here. One consequence is worth
recording rather than rediscovering: the ACM certificate must live in us-east-1, whatever
region the environment uses, because CloudFront accepts certificates from nowhere else.
They are alias records, not CNAMEs. Route 53 does not charge for queries to an alias record
pointing at an AWS resource, while a CNAME is $0.40 per million — and a CNAME to another name
in the same zone is billed as two queries, because the resolver asks twice. The amounts are
trivial at demo traffic; the point is that the alias is free, needs one lookup instead of two,
and is the only one of the two that works at a zone apex. Rejected: CloudFront's own domain,
which would have worked and would have left the sign-in configuration undoable until after the
first deployment.
Fargate tasks in public subnets, with no NAT gateway#
Superseded · 2026-09-30 · #93 · by The container architecture is removed from the infrastructure
Since #557 there is no VPC: no function runs in one. What follows is why the tasks' network was built that way.
A NAT gateway is about $33 a month
before data — more than the database, and the largest line item in an environment that would
otherwise cost about $50. The tasks take a public IP and are reachable from nothing: the security
group admits only the load balancer. Rejected: private subnets with a NAT gateway, which is
what a commercial deployment should do and what the plan says to do when this stops being a demo.
Rejected: VPC endpoints instead of NAT, which is cheaper than NAT but still per-endpoint, and
more moving parts than a demo justifies. Without endpoints there is also no request-side VPC restriction:
aws:SourceVpc is only set on a request that goes through one, and aws:Ec2InstanceSourceVpc
covers EC2 instance credentials, not Fargate task roles. What is restricted by VPC instead is where
the deploy and lifecycle roles may place the service and the load balancer — see
Accounts and access.
VPC flow logs go to S3, all traffic, for 30 days#
Superseded · 2026-10-01 · #106 · by The container architecture is removed from the infrastructure
Since #557 there is no VPC, and no flow logs. What follows is why they went to S3.
Delivery to S3 is about half the per-GB price of CloudWatch Logs and needs no delivery role, and logs read when something needs explaining do not need CloudWatch's query console. All traffic rather than rejected-only, because the useful question is what talked to what. The bucket is encrypted with S3-managed keys: rejected: a customer-managed KMS key, which at about $1 a month costs more than the logs.
CloudFront's /api/* origin comes and goes with the environment; the distribution stays#
Superseded · 2026-10-03 · #112 · by The container architecture is removed from the infrastructure
Since #557 the /api/* origin is always the Go backend's HTTP API, and neither it nor the
distribution comes or goes. What follows is why the containers' origin did.
A
VPC origin names one load balancer ARN and cannot be changed or deleted while a distribution uses
it, so destroying the load balancer on down means detaching and deleting the VPC origin, and
up means creating a new one and attaching it — up to ~15–20 minutes each way. The lifecycle
role therefore may update this environment's one distribution and create and delete VPC origins,
and still cannot create or delete distributions. Rejected: keeping the load balancer up
permanently, which would leave the distribution untouched and up/down fast, for about $20 a
month even while qa is down. Rejected: the distribution coming and going too, which is no faster
and needs more rights. An earlier version of this choice claimed the distribution could stay
untouched while the origin changed; it cannot.
CloudFront reaches the load balancer over HTTPS with the environment's own name#
Superseded · 2026-10-03 · #112 · by The container architecture is removed from the infrastructure
Since #557 there is no load balancer, and no regional certificate for it. What follows is how CloudFront reached it.
The ALB
carries a regional ACM certificate for taskfest-<env>.cloud.hilling.de, the same name as
CloudFront's own (which has to be in us-east-1). That works because /api/* forwards the viewer's
Host header, and AWS documents that the origin certificate may then match the Host header
instead of the origin's domain name — so no second name for the load balancer is needed. Both
certificates validate through the same DNS record.
Encryption in transit is settled by configuration, hop by hop, not measured#
Accepted · 2026-10-09 · #97, #246
Revised in part on 2026-11-15 (#557): the hops through the load balancer, the tasks and RDS went
with them. What is left is TLS throughout: browser to CloudFront, CloudFront to the site bucket and
to the HTTP API (https-only), and the functions to AWS's APIs and Google.
97 asked to switch on AWS's VPC Encryption Controls in monitor mode and let the flow logs say#
which traffic inside qa's VPC is in cleartext. It is not switched on (Gunnar's decision): since March 2026 the feature costs $0.17 an hour in Frankfurt for every VPC holding a network interface, monitor and enforce mode alike -- about $124 a month at 24/7, roughly doubling what qa costs while it is up -- and every hop can be answered from the configuration that enforces it:
| Hop | Encrypted | Enforced by |
|---|---|---|
| browser → CloudFront | TLS | the viewer protocol policy: HTTP is redirected for the app and refused for /api/* |
| CloudFront → site bucket | TLS | origin access control over HTTPS; the bucket policy refuses aws:SecureTransport false |
| CloudFront → load balancer | TLS | the VPC origin is https-only; the listener is HTTPS with the environment's ACM certificate and ELBSecurityPolicy-TLS13-1-2-2021-06 |
| load balancer → backend task | TLS, since #247 | both target groups and their health checks are HTTPS to port 8443; the task serves a self-signed certificate it makes at start (start-with-tls.sh) and opens no plain-HTTP port (%prod.quarkus.http.insecure-requests=disabled in application.properties) |
| backend, migrate, db-bootstrap → RDS | TLS, server certificate verified | sslmode=verify-full against the RDS bundle (PGSSLMODE for db-bootstrap); RDS for PostgreSQL 18 refuses plain connections (rds.force_ssl), and IAM login needs TLS anyway |
| browser and backend → attachment bucket | TLS | presigned HTTPS links and the SDK; the bucket policy refuses plain HTTP |
| tasks → AWS APIs, Google, Quay through ECR | TLS | HTTPS endpoints only |
That left one hop in cleartext, the load balancer to the task -- HTTP to port 8080 -- and #247
closed it with a certificate the container makes itself: a load balancer does not validate its
targets' certificates, so no CA, no stored secret and no renewal are involved. Each task makes a
new key pair at start with the JRE's keytool, as the image has no openssl. The script is the
image's own entry point and the prod profile serves TLS only, so the same holds behind httpd in
the Compose stacks, where the end-to-end suite exercises it on every pull request (Gunnar's
decision: HTTPS wherever prod runs, not only in AWS). A release from before #247 cannot run on
this infrastructure: it serves plain HTTP on 8080. The switch needs an environment that is down. The target
groups' protocol and port can only change by replacing them, and while the environment is up they
are held by the listener rule and the service, which ignore changes to them; so the order was:
both environments down, the security group rules applied with an administrator's profile (the
lifecycle role may not change them), a release built after #247, then env.sh up, which creates the
HTTPS target groups and starts that release.
Rejected: monitor mode to confirm the table, for the price above; and since AWS moves load
balancers and Fargate onto encrypting hardware once it is on, the measurement would have reported
that hop as hardware-encrypted rather than shown what the configuration does without it.
Rejected: enforce mode, for the same price, permanently, and the internet gateway the public
tasks use would need an exclusion. If compliance ever asks for proof rather than configuration,
monitor mode for a day costs about $4.
The tasks run on Graviton, chosen per environment#
Superseded · 2026-10-09 · #252 · by The container architecture is removed from the infrastructure
Since #557 there are no tasks, and cpu_architecture went with them; the Go functions are
arm64 by design. What follows is how the tasks moved.
Fargate on ARM64 costs 20% less than on x86 for the same vCPU and memory
(cost), and the database was Graviton already (db.t4g). Once the images
were published for arm64 (#249), the tasks could follow (#250). cpu_architecture -- a module
variable, set in each environment's terraform.tfvars -- moves the backend, migrate and
db-bootstrap tasks together, so that, once rolled out, the one-off tasks run the same build of the
image as the service. Between env.sh up registering the new revisions and the configuration
rollout, the service still runs the old architecture while a migrate task would run the new one;
the image is the same release either way, so that matters only for how long the window lasts. qa went first; prod followed
once qa had shown it works (Gunnar's call).
A task definition's architecture is configuration, so it reaches the service as a configuration
rollout: env.sh up registers the revisions, and deploy-backend.yml with the running version
moves the service onto them, blue/green (deploying). A release from
before v0.15.0 has no arm64 image and cannot start on Graviton, so it is refused rather than tried:
plan stops on a precondition, and deploy-backend.py refuses such a release before anything
stops. Rolling back that far means switching back to X86_64 first. Rejected: a separate story per task, which would have left the
migrate task on x86 against an arm64 service for no saving worth having.
ECS-native blue/green, which needed AWS provider 6#
Superseded · 2026-10-03 · #112 · by The container architecture is removed from the infrastructure
Since #557 there is no ECS service to deploy blue/green; the Go backend moves an alias after a check (below). Provider 6 stays. What follows is how the containers were deployed.
Two target groups, a production listener
rule ECS moves between them, a bake with both versions running (two minutes in qa, five in prod), and the circuit
breaker for a deployment whose tasks never become healthy. Provider 5.x has no
deployment_configuration for it; the upgrade was its own pull request (#111), and a plan of
every root showed no change from it. Rejected: CodeDeploy, which the plan had already ruled out.
The frontend's deep links are a CloudFront Function, and a release needs no invalidation#
Accepted · 2026-10-03 · #124
A
path whose last segment has no dot is a client-side route and gets index.html; anything else is
a file and is served as itself. Rejected: CloudFront custom error responses (403/404 →
/index.html), the common recipe, because they are distribution-wide: an API 404 would have come
back as the app with a 200. index.html is uploaded with no-cache instead of being invalidated,
so the deploy role still needs no cloudfront:CreateInvalidation, and the hashed assets are never
deleted, so a rollback is only the previous release's index.html. Decided by Gunnar: the
frontend half of the deploy workflow came forward (#119) rather than uploading by hand, because
the release mechanism needed testing anyway.
Image vulnerabilities come from Amazon Inspector, through ECR's pull-through cache#
Superseded · 2026-10-05 · #170 · by The container architecture is removed from the infrastructure
Since #557 no image is scanned. The cache, Inspector and the registry's scanning configuration went from the account root; the Go backend runs as zips. What follows is how the images were scanned.
Revised in part on 2026-11-15 (#559): image-findings.yml, which turned the findings into an issue,
went with the Quarkus backend, whose image was the one scanned. The cache and Inspector stay until
the containers' infrastructure is removed.
ECS pulls the backend image from ECR, which caches it from Quay on first use. Amazon Inspector scans what lands there, continuously, and a workflow every six hours turns fixable HIGH and CRITICAL findings in recently used images into one GitHub issue (#162, image scanning). Decided by Gunnar, partly as a demonstration of the AWS-native route.
Rejected: a scheduled Trivy scan in CI. It would have cost nothing and reused a tool the repository already has, and was the recommendation. It scans a tag rather than what ECS runs, though, and it shows nothing in AWS. Rejected: Quay's own scanning and notifications. Its results are available through Quay's public API, so access was not the issue, but its notifications cannot leave out vulnerabilities without a fix. That is most of what the base image reports, so every mail would have been noise. Inspector adds what neither has: rescans when a CVE is published, the link between an image and the ECS tasks that ran it, and a filter on whether a fix exists. Cost: under a dollar a month (doc/deployment/cost.md). The notification is a GitHub issue rather than email, like the SonarCloud gate's.
qa's test accounts are a Cognito pool, and its client secret is in OpenTofu state#
Accepted · 2026-10-07 · #190, #197
Revised in part on 2026-11-15 (#557): the SSM SecureString went with ECS, the one thing that read it; the Go backend's function gets the client secret in its settings, as it has since #554.
Decision (#190, D2 and D4 on #141). qa's live tests sign in with two accounts in a Cognito user pool, a second provider beside Google. The accounts have no stored password — the live-test run sets one per run. The app client's secret, which Cognito generates, is accepted in OpenTofu state and handed to ECS through an SSM SecureString.
Why Cognito. Google forbids automating its sign-in, so a test needs a provider whose login page a machine may fill in. Cognito is managed, in the same account, and free at two users (Lite plan).
Why no stored password. A password set at the start of each run and kept in memory cannot leak from a store or go stale, and costs nothing; Secrets Manager would have cost $0.40 a month and a role that reads it.
Why the client secret in state is acceptable. Unlike Google's, it cannot be kept out: the client resource holds it whatever is done. The state bucket is encrypted and readable only by administrators and the environment's own roles, and the secret signs nobody in without an account's password, which exists only during a test run. The Google secret stays out of state as before.
Why SSM rather than Secrets Manager for it. A standard SecureString parameter is free, and needs no rotation either; Secrets Manager's features buy nothing here.
The monitoring user reads no files and no secrets#
Accepted · 2026-10-31 · #430
Revised in part on 2026-11-15 (#557): the flow-log buckets went with the VPC, and their line with them.
Revised in part (#554, #576): the group is also denied every Lambda function's settings, which hold the Go backend's origin secret and, in qa, the Cognito client secret.
Decision. The monitoring user keeps AWS's ReadOnlyAccess, and its group denies, even with
MFA, every read of an object in the environments' attachment and flow-log buckets, of an SSM
parameter in this account, and of a Cognito app client (deployment/aws-tofu/account/main.tf),
beside the state bucket's objects it was denied already.
Why. ReadOnlyAccess reads data, not just configuration: with it the user could copy every
file people had attached, in both environments, read who connected where from the flow logs, and
read qa's Cognito client secret through its SSM parameter or the client itself. Watching the
environments needs none of it. Gunnar's choice (2026-10-31).
Rejected: a policy that lists what the user may read. Narrower, but it has to follow every service the project adds, and a dashboard that stops working is how the gap would be found. The deny list is short and covers what this project stores; a new kind of data that should be private gets a line in it.
The attachments bucket refuses to be destroyed#
Accepted · 2026-11-01 · #435
Decision (#435). aws_s3_bucket.attachments carries lifecycle { prevent_destroy = true }, so
a plan that would destroy it while it is declared fails before anything is applied — removing the
declaration takes the flag with it
(attachment storage).
Why. It holds people's files, unversioned and not backed up, and until now the only thing between a
plan that replaced it — a renamed environment or project — and their loss was
S3 refusing DeleteBucket on a bucket that is not empty, at apply time, and not at all once it was.
Teardown is unaffected: the bucket is foundation, and env.sh down never plans its destruction.
The price. Retiring an environment for good takes a deliberate step — tofu state rm of the
bucket in that environment, then deleting it by hand — and the flag holds in qa as well as prod,
since prevent_destroy cannot come from a variable. qa's files are test data, but a destroy there is just as unintended.
The backend moves to Lambda, Go and DynamoDB, after a spike#
Accepted · 2026-11-09 · #535
Revised in part: the spike passed at 512 MB, not the 256 MB the gate named; 256 MB missed it by about 50 ms (serverless.md, #535).
An environment bills about $1.86 a day while up, almost all of it by the hour, and taking it down when idle is a chore that gets forgotten. Per-request billing makes an always-up environment cost about a dollar a month, so the backend is to be ported to Go on Lambda (arm64), its data to one DynamoDB table, behind API Gateway's HTTP API and the existing CloudFront distribution. serverless.md has the design, the prices and the drawbacks, the largest being that it ties the backend to AWS.
It is decided behind a gate: a spike of GET /api/tasks in qa must start cold in under 500 ms
before anything is ported. Until the port is done, every other decision in this chapter holds,
and the container architecture stays documented as the alternative; the tag pre-serverless is
the way back.
Rejected: S3 as the only store, one document per user. Simplest to run, but concurrency and clean-up would be built by hand, and the whole board would become the unit of consistency. Rejected: Quarkus on Lambda with SnapStart for now: the language Gunnar knows, but 0.6 to 1 s cold; it is the fallback if the spike fails. Rejected: Rust, faster to start than Go by an amount nobody would notice, and much slower to write. Rejected: Aurora Serverless v2 as a cheaper database for the current architecture: at least $0.07 an hour while active against $0.019 for the RDS instance, cheaper only when idle most of the time it is up.
The Go backend runs as four functions, behind a header, watched by seven alarms#
Accepted · 2026-11-12 · #554, #575, #576
Revised in part: an eighth alarm, the API's server errors, joined once no route answered 501 any more (#558) -- at two in one five-minute period at first, Claude's threshold, and at five since Gunnar raised it on 2026-11-13, so that only a clear pattern mails; the rest stands.
Revised in part: a fifth function, logship, sends the logs on to the monitoring server (#508,
below).
It has no alarm: a failed batch is in CloudWatch all the same.
Revised in part on 2026-11-16 (#607): a ninth alarm on the API's request count, 20,000 in an hour, and the stage's throttle down to 10 a second with bursts of 20 (At most 500 tasks per user).
Revised in part on 2026-11-30 (#277): a sixth function, push, sends a change to a task to its
owner's other devices; the API invokes it asynchronously, on its alias live
(Push goes straight to APNs and FCM). A tenth
alarm, on its errors, by Gunnar's choice, since a push that fails is otherwise seen by no one. Its
resources are in push.tf beside the other jobs.
Taken by Claude while Gunnar was away; he went through it on 2026-11-12 and kept it. The resources
are in serverless.tf and serverless-jobs.tf;
serverless.md says what each is given.
Four functions, not one. api behind the HTTP API; streams on the table's stream; orphans
hourly and replay daily at 03:30 Berlin time, on EventBridge Scheduler. Each has a role for
exactly the calls it makes, so the API's role cannot list tables and the clean-up's cannot write.
The HTTP API is reached only through CloudFront, which sends a header with a secret the
function checks in constant time; a missing or empty secret refuses everything. The secret is
generated by OpenTofu and lives in state and the function's settings. The function's settings are
readable only by roles that can read this environment's state, the read-only group being denied
them (account/main.tf); CloudFront's configuration, which that group reads, still shows the
header, which lets its members past CloudFront and no further. A Secrets Manager secret would cost
$0.40 a month to prove only where a request came from. Rejected: a CloudFront-signed request or a WAF rule, the one more
machinery, the other $5 a month before any traffic.
The stream gives up after five retries or an hour. A failing record holds its shard, so the retries are capped, and the files it leaves are deleted by the orphan clean-up after seven days. Rejected: an on-failure queue, one more thing to watch for files that are cleaned up anyway -- but for the last file attachment in the table, whose files the clean-up leaves until there is one again, since it deletes nothing from a table without one; that takes an hour of failures on that one removal, which the stream alarm reports long before. A failed scheduled run is not retried either: the next run does the same work.
Seven alarms, $0.10 a month each, the one fixed cost of the Go backend: the API function's errors and throttles, the stream more than ten minutes behind, the scheduled functions' errors, and the table's throttled reads and writes. One event in five minutes raises one; no data is no alarm. Rejected for now: the HTTP API's 5xx answers, since every unported route answers 501 on purpose until the port is done; #558 watches the answers.
A restore does not stop deletions (serverless.md): the replay runs once more after the switch, and until then an account deleted in the minutes around the restore is back. Stopping deletions would take the API down for the restore's length.
The Go backend is deployed by moving an alias after a check#
Accepted · 2026-11-13 · #555
Revised in part: logship (#508) is deployed with the other four, and a release from before it,
such as a rollback to v1.6.1, leaves it where it is rather than failing for its missing zip.
Revised in part on 2026-11-30 (#277): push is deployed with the other five in the same way, and a
release up to v1.8.4, from before it, leaves it where it is.
Decision. A release builds the Go backend's four functions once and attaches them to the
release; deploy-serverless.yml publishes each as a version described by the release, checks the
API's new version by invoking it, and only then moves each function's alias live, which API
Gateway, the stream and the schedules invoke. A failure before the move leaves every alias where it
was; one during it tries to move each back, and names any it cannot. Unlike the containers'
blue/green, a deploy is not rolled back on alarms after the fact: at TaskFest's traffic an alarm
may come an hour later or never, and a rollback is a deploy of the previous release's zips. Claude's
decision, as #555 left it to Claude; Gunnar agreed to the alias update on 2026-11-13, and the
rollback on alarms #555 named is dropped, which Gunnar confirmed on 2026-11-13.
Cost. A change of the functions' settings by OpenTofu reaches what serves only through a deploy, since a published version keeps the settings it was published with: a restore, or a new origin secret, is followed by redeploying the release that runs (serverless.md).
Rejected: a traffic-weighted canary, with CodeDeploy or a weighted alias. TaskFest's few requests could not tell a good version from a bad one within a deploy, and CodeDeploy would add its own setup and roles; the check before the alias moves catches what a canary mostly would. Rejected: OpenTofu publishing a version on every apply, which would keep settings and code together but move the alias back to an older release's code whenever an apply ran after a deploy.
The Go backend's logs go to the shared monitoring server through a subscription filter#
Accepted · 2026-11-13 · #508
Revised in part on 2026-11-17 (#631): prod sends its logs too, by Gunnar's choice.
Decision. Where an environment names the monitoring server (monitoring_endpoint), a
CloudWatch Logs subscription filter on each of the Go backend's log groups invokes logship, a
fifth Go function, which posts the lines to the server's VictoriaLogs over HTTPS with basic auth.
The dashboard's latency, status and cold-start figures come from those lines -- the HTTP API's
access log and Lambda's REPORT lines -- rather than from a metrics pipeline. qa only, for now;
the variable is there for prod. Claude's decision, as Gunnar left #508's remaining choices to
Claude on 2026-11-13, after the move to Lambda had made #513's plan for the containers obsolete.
Why. The Go backend runs on Lambda, so there is no task beside it for #513's sidecars to run in, and nothing to scrape: it serves no metrics. CloudWatch stays the record, which the alarms' metric filters read, so sending is best effort and nothing about the backend depends on it.
Rejected:
- A Lambda extension in each function (the Telemetry API), which would send without CloudWatch in
between: one more layer in every function's start and every deploy, for a dashboard's sake.
- Firehose to an HTTP endpoint, which buffers and retries better but bills by the GB with a 5 KB
minimum per record, and VictoriaLogs reads no Firehose format.
- Pulling CloudWatch's metrics from the server, with an exporter: CloudWatch bills
GetMetricData by the metric requested, about $10 a month at a one-minute resolution.
- Metrics from the Go code, pushed to VictoriaMetrics: more code in the backend for figures its
logs already carry.
Cost. One more function to build, deploy and keep, and the sign-in's user leaves AWS, which
the privacy texts say for every environment that sends.
prod starts the Go backend with an empty table#
Accepted · 2026-11-10 · #557
Revised in part on 2026-11-15 (#557): Gunnar deleted the final RDS snapshots, and with them the containers' data; nothing can bring it back now.
Revised in part on 2026-11-15 (#557): api_backend and what env.sh up did went with the containers'
infrastructure; the way back is the tag pre-serverless, and the final RDS snapshots are kept
(below).
Decision (Gunnar). No task, draft, attachment or account moves from the containers' PostgreSQL
to the Go backend's DynamoDB table: prod's cut-over starts it empty, as qa's did. The containers'
data stays in their final RDS snapshot, kept until Gunnar deletes it, and api_backend =
"containers" with env.sh up brings it back with the Quarkus backend until #559 removes that.
Why. Not written down when it was taken, on #547. Claude's reading, for Gunnar to confirm: TaskFest is a demo, and a migration between two data models, with its tests and a cut-over window, would cost more than its few users signing in once more and adding their tasks again.
Cost. Everyone on prod starts afresh, and what was there is reachable only by switching back.
The container architecture is removed from the infrastructure#
Accepted · 2026-11-15 · #557
Revised in part on 2026-11-15 (#557): Gunnar deleted the final RDS snapshots the same day, so the way back through the tag starts with an empty database.
Decision. With both environments on the Go backend, everything only the container
architecture needed is removed from OpenTofu: from each environment the RDS instance, its subnet
group and the one-off tasks, the ECS cluster, service, task definitions, roles and log group with
its saved queries, the load balancer and its target groups, CloudFront's VPC origin and the
regional certificate it used, the VPC with its subnets, routes, security groups and flow logs, the
lifecycle role, the up-time reminder, the containers' half of the orphan alert, the SSM copy of the
Cognito client secret, and the deploy role's ECS and RDS grants; from the account root ECR's
pull-through cache, its repository template, Inspector and the registry's scanning configuration.
api_backend, running and the containers' variables go with them, so /api/* always goes to the
Go backend. env.sh shrinks to up <env> and account, an administrator's, with the plan
shown and the saved plan applied; up, down, status, migrate and db-bootstrap stop with a
note instead of doing something else. Claude's choices, within #557's done-when, for Gunnar to
review.
Why. Nothing reached the containers any more, and keeping their infrastructure applied kept its rules, its roles and its checks alive for a way back the tag keeps better. The VPC goes too, since no function runs in one; keeping it would have kept flow logs of a network nothing uses.
The way back is the tag pre-serverless: the code, the infrastructure and these pages as they
were. Going back would restore a final snapshot into a new instance, as env.sh up did.
What stays, and what is left by hand. The final RDS snapshots, taskfest-<env>-db-final-…,
were never in OpenTofu, and stay until Gunnar deletes them; they hold the containers' data. So do
the repositories ECR's cache created, quay/ghilling/taskfest-*, with their images, which are
deleted by hand once Inspector is off. The Quarkus backend's files at the top level of the
attachment buckets stay where they are. A flow-log bucket that still holds records stops its
destroy, and is emptied by hand first.
Cost. About $0.10 a month less per environment for the up-time reminder, and Inspector's
rescans; nothing else billed while the environments were down. The price is the way back: a
git checkout of the tag and an apply of its infrastructure, not a variable.