> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenetlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prerequisites

> What the account needs before any deploy path: a VPC with no NAT in VPC Lattice–supported AZs, the exact VPC endpoint list, a customer-managed KMS key and its encryption-context rules, Aurora PostgreSQL, an S3 Object Lock audit bucket, and the IAM roles.

**The deployment boundary**: private subnets with no internet route, callers reaching the services only through Amazon VPC Lattice as their own IAM roles, AWS APIs reached only through VPC endpoints, data encrypted under your own KMS key, and an audit bucket nobody can rewrite.

The CloudFormation template and the Terraform module create the KMS key, Aurora cluster, audit bucket, endpoints, roles and VPC Lattice services for you. The Helm chart creates none of the AWS side — on EKS you bring all of this. Either way, check this page first.

## When to use it

Before your first deploy, and when a security review asks what the deployment needs from the account.

Audit an existing VPC and account against these prerequisites — read-only, changes nothing.

Audit my AWS account for Tenet PII Engine (Enterprise) prerequisites, following [https://docs.tenetlabs.com/pii-engine/deploy/prerequisites](https://docs.tenetlabs.com/pii-engine/deploy/prerequisites.md). Make read-only AWS CLI calls only; do not create or modify anything.

Ask me for: AWS Region, VPC id, the private subnet ids I plan to use, the platform (EKS with Helm, or ECS with CloudFormation/Terraform), and, if I have them, the KMS key ARN, Aurora cluster identifier, audit bucket name, and the detect and rehydrate role ARNs.

Check and report pass/fail for each:

1. Subnets span ≥ 2 AZs (`aws ec2 describe-subnets`, report the AZ IDs), none of their route tables has a route to an internet gateway or NAT gateway (`aws ec2 describe-route-tables`), and each AZ ID is one VPC Lattice supports in the Region (for example use1-az3 in us-east-1 is not).
2. The `com.amazonaws.<region>.vpc-lattice` and `com.amazonaws.<region>.s3` managed prefix lists exist (`aws ec2 describe-managed-prefix-lists`); report their ids.
3. Whether the VPC is already associated with a VPC Lattice service network (`aws vpc-lattice list-service-network-vpc-associations --vpc-identifier <vpc>`); if so, report the service network ARN (it must be passed as ExistingServiceNetworkArn / existing\_service\_network\_arn).
4. VPC endpoints (`aws ec2 describe-vpc-endpoints --filters Name=vpc-id,Values=<vpc>`): interface endpoints with private DNS for kms, sts, metering-marketplace, logs, secretsmanager; ecr.api and ecr.dkr endpoints whose service is in us-east-1 (com.amazonaws.us-east-1.ecr.api / .ecr.dkr — cross-Region outside us-east-1) and, outside us-east-1, a com.amazonaws.us-east-1.s3 interface endpoint; an S3 gateway endpoint on the subnets' route tables; plus ecs, ecs-agent, ecs-telemetry for ECS; plus vpc-lattice and tagging for EKS; plus ec2 and eks for an EKS cluster with no internet route. List what's missing. For ECS, if they all exist, tell me to set CreateVpcEndpoints=false.
5. `c9g.xlarge` offered in the Region (`aws ec2 describe-instance-type-offerings --location-type region --filters Name=instance-type,Values=c9g.xlarge,c8g.xlarge`). On EKS, recommend c8g.xlarge.
6. If given a KMS key: KeyManager is CUSTOMER, KeySpec SYMMETRIC\_DEFAULT, enabled (`aws kms describe-key`); and in `aws kms get-key-policy`, the detect role is denied kms:Decrypt for tenet:purpose pii-vault-private-key and denied kms:ReEncrypt\* and kms:CreateGrant.
7. If given an audit bucket: `aws s3api get-object-lock-configuration` shows ObjectLockEnabled=Enabled and a default retention rule.
8. If given an Aurora cluster: engine aurora-postgresql, StorageEncrypted true, not publicly accessible.
9. If given role ARNs: they differ, and `aws iam simulate-principal-policy` allows aws-marketplace:MeterUsage for the detect role (rehydrate doesn't need it). Outside us-east-1, check the role that will deploy can create cross-Region endpoints (`vpce:AllowMultiRegion`).
   Output a checklist table and the exact fix for each failure. Stop after reporting.

## Network: no NAT, no internet route

* **DNS hostnames and DNS support enabled** on the VPC. Interface endpoints' private DNS needs both.
* **Private subnets in at least two AZs** (three recommended), one subnet per AZ. Detect replicas spread across AZs, and an interface endpoint takes at most one subnet per AZ.
* **AZs that VPC Lattice supports.** Lattice isn't offered in every AZ — `use1-az3` in us-east-1, for example. Targets in an unsupported AZ fail to register.
* **No route to a NAT gateway or internet gateway** from those subnets. The templates never create one, and nothing in the product needs one. The only exception is the opt-in usage-telemetry egress in the CloudFormation and Terraform templates, which you turn on deliberately.
* **No public IPs, no internet-facing load balancer.** Callers reach the services through VPC Lattice, as their own IAM roles; tasks and pods admit port `19991` only from the `com.amazonaws.<region>.vpc-lattice` prefix list.
* **One service network per VPC.** If your VPC is already associated with a VPC Lattice service network, the stack joins its services to that one (`ExistingServiceNetworkArn` / `existing_service_network_arn`) and you own that network's auth policy and VPC associations. On EKS, the `Gateway` you create is the service network.

Sites with no AWS API reachability at all aren't supported: the detect service checks the Marketplace subscription through the `metering-marketplace` endpoint at startup, and every Region pulls the image from AWS Marketplace in `us-east-1`. In-VPC through VPC endpoints is the supported shape.

## VPC endpoints

Create these with **private DNS enabled**, in the deployment Region, with a security group that admits 443 from the VPC. The services use standard AWS endpoint resolution, so private DNS is what routes them to the endpoints.

| Endpoint | Type | Needed by | Why |
| - | - | - | - |
| `com.amazonaws.<region>.kms` | Interface | All | Wrapping and unwrapping vault keys |
| `com.amazonaws.<region>.sts` | Interface | All | Credentials (IRSA on EKS); regional STS |
| `com.amazonaws.<region>.metering-marketplace` | Interface | All | Detect's subscription check at startup and its hourly usage reports. Detect doesn't start without it; rehydrate doesn't use it. |
| `com.amazonaws.us-east-1.ecr.api` | Interface | All | Image manifests. AWS Marketplace serves the image only from `us-east-1`, so this endpoint's service is in `us-east-1` in every Region — cross-Region (PrivateLink, service Region `us-east-1`) everywhere else. |
| `com.amazonaws.us-east-1.ecr.dkr` | Interface | All | Image pulls. Same as `ecr.api`. |
| `com.amazonaws.us-east-1.s3` | Interface | Outside `us-east-1` | The image layers, across Regions. A gateway endpoint can't cross Regions. An endpoint policy allowing `s3:GetObject` on `prod-us-east-1-starport-layer-bucket/*` is enough. |
| `com.amazonaws.<region>.logs` | Interface | All | Container logs to CloudWatch |
| `com.amazonaws.<region>.secretsmanager` | Interface | ECS; EKS if you sync secrets from it | Database credentials (and the opt-in telemetry key) |
| `com.amazonaws.<region>.s3` | **Gateway** | All | Audit writes; in `us-east-1`, also the image layers |
| `ecs`, `ecs-agent`, `ecs-telemetry` | Interface | ECS | The ECS agent's path to the control plane |
| `vpc-lattice`, `tagging` | Interface | EKS | The AWS Gateway API Controller builds the Lattice services through them, and each pod looks up its service ARN at startup |
| `ec2`, `eks` | Interface | EKS with no internet route | The nodes' own needs, not the chart's. Add `eks-auth` if you use EKS Pod Identity add-ons, and `elasticloadbalancing` if you run the AWS Load Balancer Controller. |
| `ssm`, `ssmmessages`, `ec2messages` | Interface | Optional | Session Manager shells on the hosts. Off by default — a host shell can read process memory. |

The CloudFormation template and Terraform module create the ECS set, including the cross-Region image endpoints outside `us-east-1` (`CreateVpcEndpoints` / `create_vpc_endpoints`). Creating a cross-Region endpoint needs `vpce:AllowMultiRegion`: Administrator and PowerUser roles have it, a deploy role scoped to specific actions doesn't. If the VPC already has private-DNS endpoints for any of them, turn creation off — a second private-DNS endpoint for the same service fails.

## Instances

* **Graviton, arm64.** ECS: default `c9g.xlarge`, `c8g.xlarge` where C9g isn't offered. EKS: use `c8g.xlarge` — on Graviton5 (`c9g`) the VPC CNI network policy agent can fail a map write and leave a rehydrate caller blocked ([aws-network-policy-agent issue](https://github.com/aws/aws-network-policy-agent/issues/686)). Confirm in your Region:

  ```bash theme={null}
  aws ec2 describe-instance-type-offerings --region "$AWS_REGION" --location-type region \
    --filters Name=instance-type,Values=c9g.xlarge,c8g.xlarge --query 'InstanceTypeOfferings[].InstanceType'
  ```

* **EC2 only — ECS on EC2 or EKS managed node groups.** Fargate isn't supported.

* **One detect replica per 4-vCPU node.** The detect worker uses 4 threads; plan nodes accordingly. [Sizing](https://docs.tenetlabs.com/pii-engine/operate/sizing.md).

* **On-Demand vCPU quota** (Standard instances). ECS: 8 vCPUs for the default two detect tasks, 12 with rehydration. EKS: 16 with rehydration (four `c8g.xlarge`), 8 without — plus headroom if node group updates add a surge node.

## Customer-managed KMS key

A symmetric key you own (`SYMMETRIC_DEFAULT`). It wraps the vault keys and, in the templates, encrypts Aurora storage, the audit bucket, the log groups and the database secret. Tenet never appears in its key policy.

Each vault key is a key pair: a lookup key (for dedupe and `session_ref`) and an X25519 private key that opens stored values. The detect service creates each pair, wraps both halves with `kms:Encrypt`, and keeps only the public half — so it **can't decrypt a stored value**. Only rehydrate unwraps the private key. Each wrapped half carries its own encryption context:

```json theme={null}
{"tenet:purpose": "pii-vault-lookup-key",  "tenet:key_id": "<key id>", "tenet:deployment": "<deployment id>", "tenet:public_key": "<base64>"}
{"tenet:purpose": "pii-vault-private-key", "tenet:key_id": "<key id>", "tenet:deployment": "<deployment id>", "tenet:public_key": "<base64>"}
```

Every key-policy and IAM statement for vault keys must pin **both** `kms:EncryptionContext:tenet:purpose` and `kms:EncryptionContext:tenet:deployment` = your deployment id. `tenet:key_id` and `tenet:public_key` change with every key, so don't pin them.

| Role | Allow | Deny |
| - | - | - |
| detect | `kms:Encrypt` for `pii-vault-lookup-key`, `pii-vault-private-key`; `kms:Decrypt` for `pii-vault-lookup-key` | `kms:Decrypt` for `pii-vault-private-key`; `kms:ReEncrypt*` and `kms:CreateGrant`, unconditionally |
| rehydrate | `kms:Decrypt` for `pii-vault-lookup-key`, `pii-vault-private-key` | — |

Put the detect Denies in the key policy **and** in the detect role's own policy, so no IAM policy attached later can lift them. If a pinned value differs from what the runtime sends, the KMS call is denied — see [Troubleshooting](https://docs.tenetlabs.com/pii-engine/troubleshooting.md).

> [!WARNING]
>
> Pick the deployment id once — 3–63 characters, lowercase letters, digits and hyphens, e.g. `acme-prod-use1` — and never change it. It's bound into every wrapped key and stamped into the vault; the services refuse to start if it changes.

If you lose the key, the vault and the audit objects can't be read, and Tenet can't help.

## Aurora PostgreSQL vault

* **Aurora PostgreSQL**, encrypted with the CMK, in the private subnets, not publicly accessible. The templates create Serverless v2 (0.5–8 ACUs, writer + reader).

* **Engine version**: the templates default to `16.15`. Confirm it's offered in your Region:

  ```bash theme={null}
  aws rds describe-db-engine-versions --engine aurora-postgresql --region "$AWS_REGION" \
    --query "DBEngineVersions[?starts_with(EngineVersion,'16.')].EngineVersion" --output text
  ```

* **Credentials** go to the services as libpq's `PGUSER`/`PGPASSWORD`. `TENET_VAULT_URL` carries host, port, database and `sslmode` — **never a password**; the services refuse to start if it has one.

* **Security group**: port 5432 from the detect and rehydrate services only.

* The vault holds only sealed values, keyed digests and TTLs. Rows expire with the session TTL (1 hour by default).

## S3 audit bucket with Object Lock

Needed by **both** services: rehydrate writes a record per re-identify call, and detect writes a record before each session erasure. Give each its own prefix (the templates use `rehydrate/` and `erasure/`).

* **Object Lock enabled** (which requires versioning). Both services check this at startup and refuse to run without it.
* **A default retention rule.** The templates default to 2190 days (6 years). Use `COMPLIANCE` mode in production — nobody, including the root user, can delete or shorten retention. `GOVERNANCE` exists for trial stacks you want to tear down.
* **SSE-KMS with the CMK**, public access blocked, TLS required.
* **Writes only from the two service roles.** The templates' bucket policy denies `PutObject` to every other principal and `BypassGovernanceRetention` to everyone; each role's own policy confines it to its prefix.

## IAM roles

Two workload roles, never shared — the chart rejects the same role for both.

| Role | Needs |
| - | - |
| **detect** | `aws-marketplace:MeterUsage` on `*`. KMS as in the table above, with both encryption-context conditions. `s3:PutObject` on `<bucket>/<erasure prefix>*` and `s3:GetBucketObjectLockConfiguration` on the bucket; `kms:GenerateDataKey` with `kms:ViaService = s3.<region>.amazonaws.com` if the bucket uses SSE-KMS. EKS: `vpc-lattice:ListServices`. |
| **rehydrate** | No metering permission: it isn't billed and doesn't check the subscription. KMS `Decrypt` as above. `s3:PutObject` on `<bucket>/<rehydrate prefix>*`, `s3:GetBucketObjectLockConfiguration` on the bucket, and `kms:GenerateDataKey` via S3 as for detect. EKS: `vpc-lattice:ListServices`. |

AWS accepts detect's `MeterUsage` only from the ECS task role or IRSA — not node roles, EKS Pod Identity or long-term keys. On EKS these are IRSA roles; on ECS they're task roles, plus a separate execution role per service.

**Callers** are your own roles, listed by ARN in the deploy inputs (detect, erasure and rehydrate invokers). Each needs `vpc-lattice-svcs:Invoke` on the service in its own IAM policy, as well as being named in the service's auth policy. List IAM **role** ARNs only — users, root and wildcards are refused at startup. The full matrix — execution roles, invokers, break-glass, audit reader — is in [Architecture](https://docs.tenetlabs.com/pii-engine/concepts/architecture.md).

## Gotchas

* **`metering-marketplace` unreachable means no detect.** The subscription check runs before detect serves; a missing endpoint or missing `MeterUsage` permission fails startup with the AWS error. [Billing](https://docs.tenetlabs.com/pii-engine/concepts/billing.md).
* **Both roles need `s3:GetBucketObjectLockConfiguration`**, not just `PutObject`. Without it the startup check fails and the service won't start.
* **Endpoint policies.** If you restrict endpoint policies, the KMS, Logs, Secrets Manager and S3 endpoints must allow your account's resources, and the S3 gateway must also allow ECR's layer bucket for your Region.

## Links

* [Architecture — every network edge and IAM role](https://docs.tenetlabs.com/pii-engine/concepts/architecture.md)
* [Deploy on EKS with Helm](https://docs.tenetlabs.com/pii-engine/deploy/eks-helm.md)
* [Deploy on ECS with CloudFormation](https://docs.tenetlabs.com/pii-engine/deploy/ecs-cloudformation.md)
* [Deploy on ECS with Terraform](https://docs.tenetlabs.com/pii-engine/deploy/terraform.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.