Skip to content

Deploying Redactor on AWS (ECS on Fargate)

One CloudFormation template family — deploy/aws/redactor-fargate.yaml for self-hosted pilots and deploy/aws/redactor-fargate-marketplace.yaml for AWS Marketplace Quick Launch — serves both paths. Quick start and full configuration are parameter choices: leave the optional parameters empty and the stack creates everything; fill them in to bring your own database, certificate, identity provider, or destination. The shortest path, and the record of what has been tested on AWS, is aws-quickstart.md. This page is the reference for every choice.

Three properties hold in every configuration:

  • Two network planes. Port 8080 is the control plane (UI, configuration, every metadata read); port 8081 is the data plane (item submission and health). Each refuses the other's routes and has its own allowed CIDR, with no default. (network-exposure.md)
  • Sign-in at the load balancer, no passwords in Redactor. The control listener authenticates every request before forwarding it, with Cognito or your own OIDC provider. Redactor verifies the load balancer's signed identity token and takes each user's role from it; a user without a role is refused. Local password accounts are disabled, as AWS Marketplace container policy requires.
  • Two database roles. Migrations run as a schema-owning role in a one-off task; the service connects as a least-privilege role that cannot drop the append-only triggers guarding the decision log. (postgres-roles.md)

The choices

Area Quick start (default) Full configuration
Sign-in AuthMode=Cognito: a user pool in your account; AdminEmail receives an invitation AuthMode=Oidc: your provider (Okta, Entra ID, Google Workspace, your own Cognito)
Certificate CertificateArn empty: self-signed for the load balancer's name Your ACM certificate, with EndpointHostname
Database DatabaseMode=Create: encrypted private RDS, roles created by setup DatabaseMode=Existing: your PostgreSQL 15+, prepared as below
Output Destination=CreatedBucket: an encrypted S3 bucket ExistingBucket, SqsQueue, SnsTopic (Marketplace template) or Webhook, with DestinationTarget
Input The data endpoint (HTTP API) Also InputSource=CreatedBucket: an input bucket whose uploads are processed (S3 input)
Network Tasks share SubnetIds; AssignPublicIp=ENABLED TaskSubnetIds (private, with NAT or endpoints) and AssignPublicIp=DISABLED

The keys (tokenization, content digest, durable admission) are always generated by the stack's one-off redactor setup task, once, and never replaced on updates.

Sign-in

Cognito (default)

The stack creates a user pool, a hosted sign-in domain, and an app client for the load balancer. AdminEmail is created as the first administrator and receives a temporary password by email; the first sign-in asks for a new one.

Each user's role is the custom attribute custom:redactor_role, admin or viewer. Only administrators can set it (the app client cannot write it), and users sign in only through the hosted page. To add someone:

aws cognito-idp admin-create-user --user-pool-id <UserPoolId output> \
  --username person@example.com \
  --user-attributes Name=email,Value=person@example.com Name=email_verified,Value=true \
    Name=custom:redactor_role,Value=viewer

or use the Cognito console (Users → Create user, then edit the attribute). A user without the attribute signs in and sees "Your account has no access to Redactor yet".

The load balancer keeps a user's claims for the session (SessionTimeout, default 8 hours) and re-reads them each time the access token expires. The template sets the app client's tokens to 5 minutes, so a role change, a removed role, or a disabled user takes effect within about 5 minutes without anyone signing in again (measured 2026-11-16). When the session ends, Cognito signs the user back in without a password while its own session lasts.

The role is an attribute rather than a Cognito group because the load balancer forwards the claims from Cognito's user-info response, which includes custom attributes but not group membership.

Cognito's default email sender is limited to a small number of messages a day; configure Amazon SES on the user pool before inviting many users. Multi-factor authentication is not configured by the template.

Your own OIDC provider

Set AuthMode=Oidc and provide the issuer, the authorization, token and user-info endpoints, the client ID, and the ARN of a Secrets Manager secret holding the client secret. CloudFormation resolves that secret into the listener; it never reaches the task or the stack outputs, and the principal running the stack needs secretsmanager:GetSecretValue on it.

  • Register https://<EndpointHostname or load balancer name>:8080/oauth2/idpresponse as the callback.
  • Make the provider's user-info response carry a role claim, and name it in OidcRoleClaim (default groups). OidcAdminValues and OidcViewerValues (defaults redactor-admins, redactor-viewers) are the values that grant each role; admin wins when both match. Request whatever scope makes the claim appear (OidcScope, which must include openid).
  • IdpEgressCidr (default 0.0.0.0/0 in redactor-fargate.yaml; explicit required input in redactor-fargate-marketplace.yaml) is the HTTPS range the load balancer uses to reach the token and user-info endpoints. Enter 0.0.0.0/0 for Amazon Cognito or a public OIDC provider, or narrow it for a private provider with a stable range. The load balancer needs an internet route (public subnets or NAT) for public endpoints.

What the provider must do, because the load balancer forwards only the user-info response, never the ID token:

  • Put the role claim in user-info. In Okta, add a groups claim to the authorization server (Security → API → the server → Claims) as an ID Token claim, included always, filtered to the Redactor groups; ID-token claims are also returned by user-info. Verified with Okta on 2026-11-17. Providers that put groups or app roles only in the ID token (reported for Microsoft Entra ID; not yet tested) cannot supply roles this way.
  • Allow refresh tokens and keep access tokens short if role changes and removals must take effect within a session. Request offline_access in OidcScope (for example openid email offline_access) and set the access token lifetime to a few minutes in the provider's access policy; the load balancer then re-reads user-info at each refresh. With Okta and 5-minute tokens, changes took effect within 5 minutes. Without refresh tokens, a user keeps their role until SessionTimeout (default 8 hours).
  • Request email in OidcScope so actions are recorded under the user's email; otherwise the provider's opaque subject ID is recorded.
  • Grant the app an access policy. A new Okta authorization server can have no access policy, in which case no app receives tokens.

Rotating the OIDC client secret without downtime: create the new client secret in your IdP (keep the previous secret active during cutover), store the new value in a new Secrets Manager secret, and run a stack update with OidcClientSecretArn set to the new ARN (and OidcClientId updated if using a second client). CloudFormation updates ControlListener in place (~30 seconds) without restarting ECS tasks or dropping active ALB sessions; once a fresh sign-in succeeds, revoke the old secret in your IdP and delete the old Secrets Manager secret. Updating a secret value in place under the same ARN does not trigger a CloudFormation listener change on its own, because UpdateStack reports no changes unless a parameter or template changes.

Delete the stack before deleting the client-secret secret. CloudFormation resolves the secret reference on the control listener even when deleting it, so a missing secret fails the deletion (seen 2026-11-17). To recover, retry with aws cloudformation delete-stack --retain-resources ControlListener (the listener goes with the load balancer); if the retry then fails on ControlTargetGroup, delete that target group by hand and delete the stack again.

What Redactor checks

Redactor reads only the signed x-amzn-oidc-data header. It checks the ES256 signature with the key AWS publishes for the token's key ID, that the signer is this stack's own load balancer, and the expiry. The unsigned x-amzn-oidc-identity and x-amzn-oidc-accesstoken headers are ignored. The task therefore needs outbound HTTPS to public-keys.auth.elb.<region>.amazonaws.com. Settings: network-exposure.md.

Certificate and host name

With CertificateArn empty, setup generates a self-signed certificate (RSA 2048, 825 days) for the load balancer's DNS name and EndpointHostname, if set, and imports it into ACM. Browsers and clients warn; curl needs -k. For anything beyond a pilot, supply an ACM certificate for a name you control, set EndpointHostname to that name, and point it at the LoadBalancerDnsName output with a DNS alias or CNAME.

Bringing your own database

DatabaseMode=Existing needs:

  • PostgreSQL 15+ that the task subnets can reach, with storage encryption on before it holds anything (StorageEncrypted: true with a KMS key you control). The configuration store holds operator-supplied deny lists, which are identifying data, and an unencrypted RDS instance cannot be encrypted in place. (postgres-roles.md)
  • The two roles, created with deploy/sql/01-roles.sql as the master user before the first launch, because the migration that grants redactor_app its working set only grants to a role that exists.
  • Two DSN secrets in Secrets Manager, passed as OwnerDsnSecretArn and RuntimeDsnSecretArn:
aws secretsmanager create-secret --name redactor/owner-dsn --secret-string \
  'postgres://redactor_owner:<owner-password>@<db-endpoint>:5432/redactor?sslmode=require'
aws secretsmanager create-secret --name redactor/runtime-dsn --secret-string \
  'postgres://redactor_app:<app-password>@<db-endpoint>:5432/redactor?sslmode=require'

The service refuses a DSN whose sslmode does not require TLS, and the repository's development password, at startup. verify-full needs the RDS CA bundle, which the distroless image does not carry.

Restoring a retained RDS snapshot into a new stack: when a previous stack is deleted, CloudFormation retains its final encrypted RDS snapshot plus TokenKeySecret, ContentHmacKeySecret, AdmissionKeySecret, OwnerDsnSecret, and RuntimeDsnSecret. Restore the snapshot to a new RDS instance, create updated owner/runtime DSN secrets pointing at the restored endpoint, and launch a DatabaseMode=Existing stack passing both new DSN ARNs and the original stack's retained TokenKeySecretArn, ContentHmacKeySecretArn, and AdmissionKeySecretArn. Passing the retained keys preserves HMAC digest verification and tokenization continuity and is required whenever the snapshot came from a DurableAdmission=true deployment (startup refuses a mismatched admission key against the stored admission_settings check). redactor setup never writes to supplied external key secrets.

With DatabaseMode=Create, setup does all of this itself: it reads the RDS-managed master secret (only the setup task can), creates both roles and the redactor database, and writes both DSN secrets. The service never sees the master or owner credential.

Where output goes

Every pipeline without its own destination profile delivers to the deployment destination (REDACTOR_EGRESS_SPEC), one destination per item:

Destination DestinationTarget Task role gets
CreatedBucket (default) unused s3:PutObject on the new bucket
ExistingBucket bucket name, same Region s3:PutObject on that bucket
SqsQueue queue URL sqs:SendMessage on that queue
SnsTopic (Marketplace template) topic ARN sns:Publish on that topic
Webhook HTTPS URL; WebhookAuthSecretArn optional, sent as Authorization nothing

S3 objects are written at <pipeline>/<outcome>/<yyyy>/<mm>/<dd>/<item_id>.json (s3-egress.md). A queue encrypted with a customer-managed KMS key also needs kms:GenerateDataKey for the task role, which the template does not add. Delivery states are explicit: delivery-states.md.

Reading input from S3

With InputSource=CreatedBucket the stack creates an input bucket, an input queue the bucket notifies, and a failure queue. Each UTF-8 text file uploaded (at most 1 MiB) is processed as one item through InputPipeline; files that cannot be processed are reported to the failure queue with a reason. Details, including duplicates and the metadata that carries the object key: s3-input.md.

Network

  • ControlAllowedCidr: operators only. Sign-in is mandatory, but this stays a separate network boundary.
  • DataAllowedCidr: the workloads that submit items. They can submit and read health, nothing else.
  • LoadBalancerScheme: internal for VPN or peered access, internet-facing otherwise.
  • Tasks accept traffic only from the load balancer's security group. With AssignPublicIp=DISABLED, the task subnets need a route to ECR, Secrets Manager, CloudWatch Logs, the destination, and the load balancer public-key endpoint (NAT, or VPC endpoints plus NAT for the public-key endpoint).

Launching

aws cloudformation deploy \
  --stack-name redactor \
  --template-file deploy/aws/redactor-fargate.yaml \
  --capabilities CAPABILITY_IAM \
  --parameter-overrides \
    AppImage='<ecr>/redactor@sha256:<digest>' \
    PresidioImage='<ecr>/redactor-presidio-analyzer@sha256:<digest>' \
    VpcId=vpc-… SubnetIds=subnet-…,subnet-… \
    LoadBalancerScheme=internet-facing \
    ControlAllowedCidr=203.0.113.10/32 DataAllowedCidr=203.0.113.0/24 \
    AdminEmail=admin@example.com

Both image parameters refuse anything not pinned by digest. In order, the stack creates the secrets, the database, the bucket and the load balancer; runs redactor setup (keys, certificate, database roles); creates the user pool and listeners; runs redactor migrate as the owner; and starts the service as the runtime role. A failing setup or migration fails the stack with the task's exit reason; a failing service start trips the deployment circuit breaker and rolls back.

Options

  • Comprehend Medical. EnableComprehendMedical=true adds exactly comprehendmedical:DetectPHI to the task role and enables the detector. It bills per character in your account and sends text to that AWS API; it is off by default. Documents larger than the 20,000-byte request ceiling are sent as sequential, overlapping requests, and overlap is billed again. A failed or expired request stops later calls and forces review instead of treating a partial scan as clean. Run a billed multibyte and request-boundary probe in the target account before production use.
  • Durable admission (DurableAdmission, default true): 202 Accepted is returned only after the input is committed, encrypted, to PostgreSQL (durable-admission.md).
  • Ingest keys (RequireIngestKey, default true): every submission needs a key created in the UI (Access), so every item is attributable to a named key.

Upgrades

Update the stack with new image digests. The migrate task definition changes with the image, so migrations re-run as the owner before the service rolls. Setup re-runs and leaves every filled secret unchanged. The deployment is single-replica by design (stop-then-start), so expect a brief ingest gap of a few minutes while the analyzer loads its model; submitters see refusals and should retry (supported-topology.md).

Deleting

The stack keeps the output bucket, the key and DSN secrets, and a final database snapshot; delete those separately once they are no longer needed. The imported certificate and the user pool are deleted with the stack.

Auditing out of band

redactor verify-ledger walks the decision log's hash chain and exits 0 only if it is intact. Run it against a replica or a restored snapshot:

aws ecs run-task --cluster <stack name> \
  --task-definition <MigrateTaskDefinitionArn> \
  --overrides '{"containerOverrides":[{"name":"migrate","command":["verify-ledger"]}]}' \
  --launch-type FARGATE --network-configuration '…as the stack uses…'

What has been tested

The AWS test record is in aws-quickstart.md. The authenticated-edge probes that must pass before a Marketplace release are in aws-authenticated-edge.md.

Last updated November 22, 2026 · Suggest an improvement