> ## 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.

# AWS Secrets Manager

> Store Kafka admin and observability credentials in AWS Secrets Manager with separate CI and runtime permissions.

> [!NOTE]
>
> Written for the EKS paths, where the pod's AWS identity reads the secret. The VM path's documented route is [`file://` or `env://`](https://sariva.mintlify.site/connecting-clusters/file-env). On a VM the code would read Secrets Manager with the VM's own AWS credentials (for example an EC2 instance role), but that is not yet proven live.

Use this page when Kafka credentials for a cluster live in AWS Secrets Manager.

There are two different credential leaves:

| Leaf | Used by | Who can read it |
| - | - | - |
| `<stage>/<env>/clusters/<cluster>/kafka-admin` | GitHub Actions / Terraform | GitHub Actions OIDC role only |
| `<stage>/<env>/clusters/<cluster>/observability-reader` | Sariva runtime monitoring | Sariva pod AWS identity only |

⚠WARNING

Do not grant the Sariva platform pod access to the `kafka-admin` secret. The pod reads only `observability-reader` at runtime.

## Admin Kafka key — customer-created

Create this after the Kafka cluster exists and after you mint the cluster-scoped admin Kafka key.

```bash theme={null}
aws secretsmanager create-secret \
  --region <region> \
  --name <stage>/<env>/clusters/<cluster>/kafka-admin \
  --description "Terraform admin Kafka credential for <cluster>" \
  --secret-string '{"api_key":"<admin-kafka-api-key>","api_secret":"<admin-kafka-api-secret>"}'
```

GitHub Actions reads this secret during Terraform apply. The pod does not.

## Observability key — Sariva-created path

Ask Sariva to create the observability credential and store it in AWS Secrets Manager:

```text theme={null}
@sariva-platform create observability credential for cluster <cluster>, store in AWS Secrets Manager
```

Sariva opens a GitOps PR. GitHub Actions applies Terraform and writes the runtime credential to:

```text theme={null}
<stage>/<env>/clusters/<cluster>/observability-reader
```

The value is JSON:

```json theme={null}
{
  "api_key": "<observability-kafka-api-key>",
  "api_secret": "<observability-kafka-api-secret>"
}
```

AWS appends a random suffix to the ARN. Look up by name for manual operations and use a wildcard in IAM resource patterns:

```text theme={null}
arn:aws:secretsmanager:<region>:<account>:secret:<stage>/*/clusters/*/observability-reader*
```

## Runtime read permission

Grant the pod AWS identity read access only to the observability leaf:

```json theme={null}
{
  "Sid": "ReadKafkaObservabilitySecrets",
  "Effect": "Allow",
  "Action": [
    "secretsmanager:GetSecretValue",
    "secretsmanager:DescribeSecret"
  ],
  "Resource": "arn:aws:secretsmanager:<region>:<account>:secret:<stage>/*/clusters/*/observability-reader*"
}
```

## Attach the credential reference

After the secret exists and the pod can read it, patch the Kafka cluster if the watcher did not already attach the reference:

```bash theme={null}
sariva cluster patch \
  --alias <cluster> \
  --credentials-ref arn:aws:secretsmanager:<region>:<account>:secret:<stage>/<env>/clusters/<cluster>/observability-reader-<suffix> \
  --api-url "$SARIVA_PLATFORM_URL"
```

## Gate failures

| Reason code | Cause | Fix |
| - | - | - |
| `credentials_resolve_failed: AccessDenied` | Pod AWS identity policy missing `GetSecretValue` on this ARN | Attach the read statement above |
| `credentials_resolve_failed: ResourceNotFoundException` | ARN typo, wrong account/region, deleted secret, or secret scheduled for deletion | `aws secretsmanager describe-secret --secret-id <name-or-arn>` |
| `credentials_payload_shape_mismatch` | JSON missing `api_key` / `api_secret` | Fix the secret payload per the payload-shape table |

ⓘINFO

For repeat tests, deleting a Secrets Manager secret normally starts a recovery window that locks the name. Use `--force-delete-without-recovery` only in disposable test environments when you need to recreate the same name immediately.


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