tenet-pii-enterprise.yaml): one stack → a customer-managed KMS key, an Aurora PostgreSQL Serverless v2 vault, the VPC endpoints, an ECS cluster on c9g.xlarge, and the detect and rehydrate services, each behind its own Amazon VPC Lattice service whose IAM auth policy names your caller roles per route.
When to use it
You want ECS rather than EKS, and you want everything created and wired for you. It deploys into an existing VPC with private subnets and no NAT. Use the Terraform module for the same shape in Terraform.Deploy the CloudFormation stack — collects parameters, runs preflight checks, and stops for approval before creating anything.
What it creates
Deploy
Download the template:c9g.xlarge, so the default stack needs 8 vCPUs, 12 with rehydration. ImageUri is the Marketplace image from the release record, by digest, in every Region — don’t copy it. Outside us-east-1 the stack creates cross-Region endpoints to reach it, so the role that runs the stack needs vpce:AllowMultiRegion; Administrator and PowerUser roles already have it (The image in every Region).
The template is over CloudFormation’s inline size limit, so $TEMPLATE_BUCKET must be an S3 bucket you own in the deployment Region. Run the deploy as KeyAdminRoleArn — while the stack builds Aurora and its secret, that role needs CreateGrant and data-key access through RDS and Secrets Manager, which the key policy grants only via kms:ViaService.
CAPABILITY_AUTO_EXPANDis required. The template uses theAWS::LanguageExtensionstransform (soVaultDeletionPolicycan set the Aurora cluster’sDeletionPolicy). Without it the deploy fails before creating anything.- Trial stack you’ll delete: add
AuroraDeletionProtection=false VaultDeletionPolicy=Delete AuditObjectLockMode=GOVERNANCE. - Detection only:
EnableRehydration=false. No rehydrate service, task or execution role, or Lattice service is created. The audit bucket still is — detect audits erasures.
Callers
Each workload that calls the services needs four things:- Its IAM role in the right list:
DetectInvokerRoleArns(POST /detect,/redact,/deidentify),ErasureInvokerRoleArns(DELETE /sessions/{session_id}) orRehydrateInvokerRoleArns(POST /reidentify). The auth policies name exactly these roles, per path and method. Entries must be IAM role ARNs; the runtime refuses users, root and wildcards at startup. - The
DetectCallerPolicyorRehydrateCallerPolicyoutput attached to that role as an identity policy (vpc-lattice-svcs:Invokeon the service). A same-account caller needs both this and the auth policy; either alone is a403. - A network path: attach the
LatticeClientSecurityGroupIdoutput to the workload, or allow egress tcp/443 to thecom.amazonaws.<region>.vpc-latticeprefix list. - Signed requests: SigV4, service
vpc-lattice-svcs, the stack’s Region, headerx-amz-content-sha256: UNSIGNED-PAYLOAD, over HTTPS toDetectEndpointorRehydrateEndpoint. Thetenet-pii-latticeclient does this (pip install https://platform.tenetlabs.com/enterprise/current/tenet_pii_lattice.tar.gz; Python 3.11+,boto3); plain botocoreSigV4Authworks too. Reuse connections — each new connection pays a TLS handshake.
RequireRehydrateApprovalTag=true, a reidentify call must come from a role session tagged tenet-approval-id; your approval workflow sets it when it assumes the invoker role, and Lattice checks it on every call. Also put the approval id in the RoleSessionName: Lattice access logs record principal tags only on denied requests, while every audit record carries the caller’s role session ARN. requestId in /<NamePrefix>/lattice matches upstream_request_id in the audit record.
Callers in another VPC need that VPC associated with the service network (ServiceNetworkArn output) and listed in AllowedSourceVpcIds. Callers in another account need the service network or the services shared with AWS RAM, and their roles listed by ARN. The full model: Rehydration and audit.
Outputs
Parameters
Naming
Naming
Caller auth: IAM through VPC Lattice
Caller auth: IAM through VPC Lattice
Network
Network
Keys
Keys
Vault
Vault
Rehydration and audit
Rehydration and audit
Compute
Compute
Logs and alarms
Logs and alarms
Usage telemetry egress (opt-in)
Usage telemetry egress (opt-in)
The detect egress rule is tcp/443 to
0.0.0.0/0 through the NAT, not limited to Tenet’s endpoint — a compromised detect task could reach any HTTPS host. For tighter control, put AWS Network Firewall with a domain allowlist or an egress proxy on that path. Record contents: Monitoring.Bringing your own KMS key
WithKmsKeyArn set, the template can’t edit that key’s policy. Add these statements yourself — the log-group one before the first deploy (or the log groups fail to create), the rest once the stack has created the roles (<prefix>-detect-task, <prefix>-rehydrate-task, <prefix>-detect-exec, <prefix>-rehydrate-exec):
- The two
Denystatements keep detect out of the vault. Detect creates each vault key pair and wraps its private half, but can never unwrap it, so it can’t read back any value it stored. The stack’s detect role policy repeats both Denies, so they hold before you edit the key policy; keep them in the key policy anyway, so no IAM policy attached to the role later can lift them. Architecture — KMS design. DetectErasureAuditWritesViaS3lets detect write erasure records to the SSE-KMS audit bucket.- If your key policy delegates to IAM (the
rootstatement), add the log-group statement before the first deploy.
Gotchas
- The Aurora master secret rotates every 7 days. ECS injects
PGUSER/PGPASSWORDat task start, so running tasks keep the old password and fail on their next reconnect. After each rotation,aws ecs update-service --force-new-deploymentboth services — or create a dedicated least-privilege database user for the engine with its own rotation schedule (recommended). - Stack updates reset the detect count. With autoscaling on, every update sets the service back to
DetectDesiredCount, then autoscaling scales it up again. Update off-peak or raiseDetectDesiredCountfirst. - Health checks. Detect’s container check runs
tenet-pii-enterprise healthcheckagainst/healthz; its Lattice target group checks/readyz. Rehydrate’s container check uses--ready(/readyz), so a task that can’t reach the vault is replaced; its target group checks/readyztoo. The probes aren’t routed through Lattice — callers get404on them. - VPC Lattice isn’t in every AZ (for example
use1-az3in us-east-1). KeepPrivateSubnetIdsin supported AZs, or target registration fails for tasks placed there. - One service network per VPC. If
VpcIdis already associated with one, passExistingServiceNetworkArn. The stack then only adds its services; you own that network’s VPC associations and auth policy. The services’ own auth policies still apply. - Rollouts replace tasks in place.
50/100stops half the tasks, starts the new revision on the freed instances, then does the other half — during a rollout, 1 of 2 detect tasks serves. Deploy off-peak or raiseDetectDesiredCountfirst; or set100/200and leaveAsgMaxSizeheadroom for one surge instance per service. - Failed first create. The KMS key and audit bucket use
DeletionPolicy: RetainExceptOnCreate, so a rollback deletes them (the key enters a 30-day pending deletion). WithAuroraDeletionProtection=true, a failed create ends inROLLBACK_FAILED— disable protection on the cluster and continue the rollback. - “Invalid principals” on
VaultKey. IAM propagation can lag a role created seconds earlier. Retry the stack operation. - Tear-down. Stack delete keeps the KMS key and the audit bucket (in
COMPLIANCEmode nobody can delete audit objects before retention ends). SetAuroraDeletionProtection=falseand update before deleting;VaultDeletionPolicy=Snapshotleaves a final snapshot for you to delete. A delete can endDELETE_FAILEDon a Lattice target group with “Exceeded attempts to wait”, because ECS is still deregistering tasks — delete the stack again. If a delete sticks with services inDRAINING, see Troubleshooting. - One private subnet per AZ. Interface endpoints take at most one subnet per AZ.
- Tasks stop at startup with a metering error.
AWS Marketplace metering refused this deploymentmeans the account isn’t subscribed or the task role lacksaws-marketplace:MeterUsage;AWS Marketplace metering is unreachablemeans themetering-marketplaceendpoint is missing or unreachable. WithCreateVpcEndpoints=false, your existing endpoints must includemetering-marketplace. Troubleshooting.