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

# Wire the pod's AWS identity

> Give the Sariva platform pod an AWS identity with EKS Pod Identity before it first needs to call AWS APIs.

> [!NOTE]
>
> Kubernetes/EKS only. On a VM, skip this page.

The Sariva platform runs as a pod in your EKS cluster. Some features require that pod to call AWS APIs directly:

* read observability credentials from **AWS Secrets Manager** or **AWS SSM Parameter Store**;
* read app logs from **CloudWatch**;
* check app pod health through the **EKS** API;
* connect to **Amazon MSK** with IAM auth;
* call **AWS Bedrock** if Bedrock is selected as the LLM backend.

For EKS, use **EKS Pod Identity** for the Sariva platform pod. Do **not** manually annotate the Helm-managed ServiceAccount with an IRSA role. The Helm chart owns the ServiceAccount, and a later Helm upgrade can remove manual annotations. A Pod Identity association is external to the Helm chart and survives Helm upgrades.

ⓘINFO

**Wire this before the pod first needs AWS access.** This is not always a hard gate before the initial Helm install. If you start with Claude API, Confluent Cloud, and Kubernetes Secrets only, you can skip this page initially. If you later switch a Kafka credential reference to AWS Secrets Manager or SSM, create the Pod Identity association and restart the pod before registering or patching that Kafka cluster.

## When pod AWS identity is required

| Runtime choice | Required? | Why |
| - | -: | - |
| Claude API + Confluent Cloud + Kubernetes Secret credentials | No | The pod does not call AWS APIs for Kafka credentials. |
| AWS Secrets Manager credential store | Yes | The pod reads `observability-reader` credentials at runtime. |
| AWS SSM Parameter Store credential store | Yes | The pod reads `observability-reader` parameters at runtime. |
| AWS Bedrock | Yes | The pod calls Bedrock APIs. |
| MSK IAM auth | Yes | The pod signs MSK requests with AWS identity. |
| CloudWatch log scanning | Yes | The pod queries CloudWatch Logs. |
| Cross-account pod health | Yes | The pod assumes or uses an AWS role to inspect app workloads. |

⚠WARNING

**The pod reads observability credentials only.** Do not grant the Sariva platform pod access to the Kafka admin key at `<stage>/<env>/clusters/<cluster>/kafka-admin`. The admin key is for GitHub Actions / Terraform. The pod needs read access only to `<stage>/<env>/clusters/<cluster>/observability-reader`.

## Credential-store mapping at Kafka cluster connection time

| Credential reference | How the pod reads it | Pod AWS identity required? |
| - | - | -: |
| `k8s://<namespace>/<secret-name>` | Kubernetes API with Kubernetes RBAC | No AWS identity |
| `arn:aws:secretsmanager:...:<stage>/<env>/clusters/<cluster>/observability-reader-<suffix>` | AWS Secrets Manager API | Yes |
| `arn:aws:ssm:...:parameter/<stage>/<env>/clusters/<cluster>/observability-reader` | AWS SSM API | Yes |
| MSK IAM auth | AWS-signed MSK requests | Yes |

## 1. Set variables

Use the namespace and ServiceAccount from the Sariva Helm release. The default release uses namespace `sariva-platform` and ServiceAccount `sariva-platform`.

```bash theme={null}
export AWS_REGION="us-east-1"
export AWS_ACCOUNT_ID="$(aws sts get-caller-identity --query Account --output text)"
export EKS_CLUSTER_NAME="<your-eks-cluster-name>"

export RELEASE_NS="sariva-platform"
export SARIVA_PLATFORM_SA="sariva-platform"
export POD_IDENTITY_ROLE_NAME="sariva-observability-reader-role"
```

## 2. Create the Pod Identity trust policy

Create `pod-identity-trust-policy.json`:

```bash theme={null}
cat > pod-identity-trust-policy.json <<'EOF'
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "pods.eks.amazonaws.com"
      },
      "Action": [
        "sts:AssumeRole",
        "sts:TagSession"
      ]
    }
  ]
}
EOF
```

Create the IAM role:

```bash theme={null}
aws iam create-role \
  --role-name "$POD_IDENTITY_ROLE_NAME" \
  --assume-role-policy-document file://pod-identity-trust-policy.json

export POD_IDENTITY_ROLE_ARN="$(aws iam get-role \
  --role-name "$POD_IDENTITY_ROLE_NAME" \
  --query 'Role.Arn' \
  --output text)"

echo "$POD_IDENTITY_ROLE_ARN"
```

## 3. Attach only the runtime permissions the pod needs

### Example: AWS Secrets Manager observability credentials only

Use this when the pod only needs to read Kafka observability credentials from AWS Secrets Manager:

```bash theme={null}
cat > pod-observability-secrets-read-policy.json <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ReadKafkaObservabilitySecrets",
      "Effect": "Allow",
      "Action": [
        "secretsmanager:GetSecretValue",
        "secretsmanager:DescribeSecret"
      ],
      "Resource": "arn:aws:secretsmanager:${AWS_REGION}:${AWS_ACCOUNT_ID}:secret:<stage>/*/clusters/*/observability-reader*"
    }
  ]
}
EOF

aws iam put-role-policy \
  --role-name "$POD_IDENTITY_ROLE_NAME" \
  --policy-name observability-secrets-read \
  --policy-document file://pod-observability-secrets-read-policy.json
```

AWS Secrets Manager appends a random suffix to the secret ARN. Keep the trailing `*` on `observability-reader*`.

### Example: AWS SSM observability credentials only

```json theme={null}
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ReadKafkaObservabilityParameters",
      "Effect": "Allow",
      "Action": ["ssm:GetParameter"],
      "Resource": "arn:aws:ssm:<REGION>:<ACCOUNT>:parameter/<stage>/*/clusters/*/observability-reader"
    },
    {
      "Sid": "DecryptObservabilityParameterWhenUsingCustomerManagedKey",
      "Effect": "Allow",
      "Action": ["kms:Decrypt"],
      "Resource": "arn:aws:kms:<REGION>:<ACCOUNT>:key/<kms-key-id>"
    }
  ]
}
```

### Add other feature permissions only when enabled

| Feature | Add |
| - | - |
| CloudWatch log scanning | `logs:StartQuery` scoped to the app log-group ARN (with a trailing `:*`); `logs:GetQueryResults`, `logs:StopQuery`, and `logs:DescribeLogGroups` on `*` (these three don't support resource-level scoping). |
| Cross-account pod health **or** logs | `sts:AssumeRole` **and** `sts:TagSession` for the customer-created reader role ARN. Both are required — this Pod Identity role carries transitive session tags, so the chained assume fails `AccessDenied` without `sts:TagSession` here (and on the reader role's trust policy). See [Cross-account reader setup](https://sariva.mintlify.site/install-setup/cross-account-reader.md). |
| MSK IAM auth | `kafka-cluster:Connect`, `DescribeCluster`, `DescribeTopic`, and `DescribeGroup` scoped to the MSK cluster/topic/group ARNs. |
| Bedrock | Bedrock invoke permissions for the selected model and region. |

The cross-account assume statement, written out — add one `Resource` entry per target account's reader role (a JSON array if several):

```json theme={null}
{
  "Sid": "AssumeCrossAccountReaders",
  "Effect": "Allow",
  "Action": ["sts:AssumeRole", "sts:TagSession"],
  "Resource": "arn:aws:iam::<TARGET_ACCOUNT_ID>:role/<READER_ROLE_NAME>"
}
```

Keep `sts:TagSession` in the **same** statement as `sts:AssumeRole`. Omitting it — or scoping `Resource` to the wrong ARN — makes every cross-account read fail `AccessDenied` (the reader role's trust policy needs the matching `sts:TagSession` too; see [Cross-account reader setup](https://sariva.mintlify.site/install-setup/cross-account-reader.md)).

!DANGER

Do not use one broad AWS policy for every possible future feature. Add only the statements for features you actually enable.

## 4. Install the EKS Pod Identity Agent add-on

The Pod Identity association in the next step only takes effect if the **EKS Pod Identity Agent** add-on is running on the cluster — and it is **not** installed by default. Install it once per cluster:

```bash theme={null}
aws eks create-addon \
  --cluster-name "$EKS_CLUSTER_NAME" \
  --addon-name eks-pod-identity-agent \
  --region "$AWS_REGION"
```

Confirm it is running (one pod per node, all ready):

```bash theme={null}
kubectl -n kube-system get daemonset eks-pod-identity-agent
```

If the add-on is missing you can still create the association below, but the pod will get `NoCredentialsError` until the agent is installed.

## 5. Create the EKS Pod Identity association

Create the association between the IAM role and the Sariva platform Kubernetes ServiceAccount:

```bash theme={null}
aws eks create-pod-identity-association \
  --cluster-name "$EKS_CLUSTER_NAME" \
  --namespace "$RELEASE_NS" \
  --service-account "$SARIVA_PLATFORM_SA" \
  --role-arn "$POD_IDENTITY_ROLE_ARN" \
  --region "$AWS_REGION"
```

If the Sariva platform pod is already running, restart it so it receives the new identity:

```bash theme={null}
kubectl -n "$RELEASE_NS" rollout restart deploy/sariva-platform
kubectl -n "$RELEASE_NS" rollout status deploy/sariva-platform
```

ⓘINFO

This is safe after install. It is a normal rolling restart. The admin bearer seed is idempotent, `platform.db` remains on the PVC, and existing API keys are not recreated or lost.

⚠WARNING

**The association is scoped to this EKS cluster.** It survives Helm upgrades, but if you delete and recreate the EKS cluster the association is gone. The IAM role itself persists (IAM is account-level), so after a cluster rebuild just re-run this association step and restart the pod.

## 6. Verify pod identity after deploy

Port-forward or use any shell that can reach the cluster, then find the deployment:

```bash theme={null}
export RELEASE_NS="sariva-platform"

kubectl -n "$RELEASE_NS" get deploy
kubectl -n "$RELEASE_NS" exec deploy/sariva-platform -- \
  python -c "import boto3; print(boto3.client('sts').get_caller_identity()['Arn'])"
```

Expected result: the printed ARN is an assumed-role session for the Pod Identity IAM role you associated.

If the command fails, check:

| Symptom | Cause |
| - | - |
| `NoCredentialsError` | EKS Pod Identity association is missing, Pod Identity agent is not installed, or the pod was not restarted after the association. |
| `AccessDenied` on `GetSecretValue` | The role is associated but the policy does not cover the observability secret path. |
| Wrong role ARN | The ServiceAccount or namespace in the association does not match the Helm release. |

## Add pod identity later before registering AWS credential refs

If the platform is already running and you later move Kafka credentials to AWS Secrets Manager or SSM:

1. Create or update the Pod Identity role and policy.
2. Create the Pod Identity association for the Sariva platform ServiceAccount.
3. Restart the pod.
4. **Then** register or patch the Kafka cluster with the AWS credential reference.

!DANGER

Do not register or patch a Kafka cluster with an AWS Secrets Manager or SSM credential reference before the pod has AWS read access to the observability credential path. The platform must hold the AWS role first, or credential resolution fails.

## Continue the deployment path

> [card] [Next: deploy the Sariva platform](https://sariva.mintlify.site/install-setup/deploy-platform.md)
>
> Install the Helm chart using `values.yaml`, `config/customer_config.yaml`, and the runtime Secret. Pod Identity can also be associated later before the pod first needs AWS access.

> [card] [Back to deployment path](https://sariva.mintlify.site/deploy/aws-eks-cc.md)
>
> Return to the supported deployment path checklist.


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