---
title: "Create the IAM users"
url: "https://docs.mekodata.ai/byoc/prerequisites/aws-iam/"
---

# Create the IAM users

The IAM users, policies, and Bedrock model access that Meko BYOC needs

Meko reaches AWS with two sets of access keys. Each belongs to its own IAM user with the narrowest policy that works.

| IAM user             | Install variables                       | Used by                                        | Needs                                                                     |
|----------------------|-----------------------------------------|------------------------------------------------|---------------------------------------------------------------------------|
| `meko-byoc-bedrock`  | `BEDROCK_KEY`, `BEDROCK_SECRET`         | API server, MCP server, knowledge-base workers | Bedrock Titan embeddings, and read and write on the knowledge-base bucket |
| `meko-byoc-langfuse` | `LANGFUSE_S3_KEY`, `LANGFUSE_S3_SECRET` | Langfuse web and worker                        | Read and write on the Langfuse bucket                                     |

The install hands the first key to the API server, the MCP server and the knowledge-base workers alike. They are one principal, so they share one policy.

Set these variables. They are the ones from [Create the S3 buckets](/byoc/prerequisites/aws-s3-buckets/); skip any you still have set.

```sh
export BEDROCK_REGION=us-east-1
export KB_S3_BUCKET=meko-kb-store
export LANGFUSE_S3_REGION=us-east-2
export LANGFUSE_S3_BUCKET=meko-traces-store
```

## Enable the Bedrock model

Meko embeds memories, knowledge-base documents, and search queries with **Amazon Titan Text Embeddings V1** (`amazon.titan-embed-text-v1`). Make sure the model is available in `BEDROCK_REGION`:

```sh
aws bedrock list-foundation-models --region "$BEDROCK_REGION" \
  --query "modelSummaries[?modelId=='amazon.titan-embed-text-v1'].modelId" --output text
```

The command prints the model ID. If it prints nothing, choose another Region. If a later call fails with `AccessDeniedException` while the policy is correct, open **Bedrock → Model access** in the AWS console, in `BEDROCK_REGION`, and enable the Titan Text Embeddings V1 model.

Every embedding call Meko makes goes to this one Region. Set `BEDROCK_REGION` once and keep it.

## Create the Bedrock and knowledge-base user

This policy allows one Bedrock action on one model, and four S3 actions on one bucket.

```sh
cat > meko-byoc-bedrock-policy.json <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "TitanEmbeddings",
      "Effect": "Allow",
      "Action": "bedrock:InvokeModel",
      "Resource": "arn:aws:bedrock:${BEDROCK_REGION}::foundation-model/amazon.titan-embed-text-v1"
    },
    {
      "Sid": "KnowledgeBaseObjects",
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
      "Resource": "arn:aws:s3:::${KB_S3_BUCKET}/*"
    },
    {
      "Sid": "KnowledgeBaseList",
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::${KB_S3_BUCKET}"
    }
  ]
}
EOF

aws iam create-user --user-name meko-byoc-bedrock
aws iam put-user-policy --user-name meko-byoc-bedrock \
  --policy-name meko-byoc-bedrock --policy-document file://meko-byoc-bedrock-policy.json
aws iam create-access-key --user-name meko-byoc-bedrock
```

The last command prints the access key once. Save `AccessKeyId` as `BEDROCK_KEY` and `SecretAccessKey` as `BEDROCK_SECRET`.

| Permission            | Resource                                               | Why Meko needs it                                                                                                          |
|-----------------------|--------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| `bedrock:InvokeModel` | The Titan Text Embeddings V1 model in `BEDROCK_REGION` | Embedding memories, knowledge-base documents, conversations, and search queries                                            |
| `s3:PutObject`        | Objects in the knowledge-base bucket                   | The API server stores uploaded documents, and copies them when a datapack is forked                                        |
| `s3:GetObject`        | Objects in the knowledge-base bucket                   | The knowledge-base workers read documents to index them. The API server serves downloads and checks that an upload arrived |
| `s3:DeleteObject`     | Objects in the knowledge-base bucket                   | Removing a document, and cleaning up abandoned uploads                                                                     |
| `s3:ListBucket`       | The knowledge-base bucket itself                       | Listing a datapack's documents. Without it, S3 answers a missing object with an access error instead of "not found"        |

The browser uploads with a short-lived URL that the API server signs with this key, so the key's `s3:PutObject` is what authorizes the upload.

## Create the Langfuse user

Langfuse uploads each conversation event to its own bucket before it ingests the event, and keeps media and exports there. Traces and observations are stored in the database, not in the bucket.

```sh
cat > meko-byoc-langfuse-policy.json <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "LangfuseObjects",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject",
        "s3:AbortMultipartUpload"
      ],
      "Resource": "arn:aws:s3:::${LANGFUSE_S3_BUCKET}/*"
    },
    {
      "Sid": "LangfuseList",
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::${LANGFUSE_S3_BUCKET}"
    }
  ]
}
EOF

aws iam create-user --user-name meko-byoc-langfuse
aws iam put-user-policy --user-name meko-byoc-langfuse \
  --policy-name meko-byoc-langfuse --policy-document file://meko-byoc-langfuse-policy.json
aws iam create-access-key --user-name meko-byoc-langfuse
```

Save `AccessKeyId` as `LANGFUSE_S3_KEY` and `SecretAccessKey` as `LANGFUSE_S3_SECRET`.

| Permission                | Resource                       | Why Langfuse needs it                                                     |
|---------------------------|--------------------------------|---------------------------------------------------------------------------|
| `s3:PutObject`            | Objects in the Langfuse bucket | Writing incoming events, media uploads, and batch exports                 |
| `s3:GetObject`            | Objects in the Langfuse bucket | Reading stored events back to process them, and serving media and exports |
| `s3:DeleteObject`         | Objects in the Langfuse bucket | Deleting stored objects when Langfuse removes data                        |
| `s3:AbortMultipartUpload` | Objects in the Langfuse bucket | Cleaning up a large upload that fails partway                             |
| `s3:ListBucket`           | The Langfuse bucket itself     | Listing stored objects                                                    |

### Use an IAM role instead (EKS IRSA)

If you would rather not create an access key for Langfuse, give its Kubernetes service account an IAM role through [IAM roles for service accounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html). Your cluster needs an IAM OIDC provider.

1. Create a role with the same Langfuse policy as above. Its trust policy names the Langfuse service account, which is `meko-langfuse` in the namespace you install into:
   
   ```json
   {
     "Version": "2012-10-17",
     "Statement": [
       {
         "Effect": "Allow",
         "Principal": { "Federated": "arn:aws:iam::<account id>:oidc-provider/<cluster OIDC issuer, without https://>" },
         "Action": "sts:AssumeRoleWithWebIdentity",
         "Condition": {
           "StringEquals": {
             "<cluster OIDC issuer, without https://>:sub": "system:serviceaccount:<namespace>:meko-langfuse",
             "<cluster OIDC issuer, without https://>:aud": "sts.amazonaws.com"
           }
         }
       }
     ]
   }
   ```
2. At [install](/byoc/deploy-aws/), leave `LANGFUSE_S3_KEY` and `LANGFUSE_S3_SECRET` blank and set `EXTRA_VALUES` to:
   
   ```sh
   EXTRA_VALUES="--set langfuse.s3AuthMode=iam-role --set-string langfuse.serviceAccount.annotations.eks\.amazonaws\.com/role-arn=<role ARN>"
   ```

The `BEDROCK_KEY` user has no role equivalent. It stays an access key.

## Check the keys

Check each key with the calls Meko will make, before you install. Use a subshell so the key isn't left in your shell:

```sh
# Bedrock and the knowledge-base bucket
(
  export AWS_ACCESS_KEY_ID=<BEDROCK_KEY> AWS_SECRET_ACCESS_KEY=<BEDROCK_SECRET> AWS_PAGER=
  echo hello > /tmp/meko-check.txt
  aws bedrock-runtime invoke-model --region "$BEDROCK_REGION" \
    --model-id amazon.titan-embed-text-v1 --cli-binary-format raw-in-base64-out \
    --body '{"inputText":"check"}' /dev/null
  aws s3api put-object --bucket "$KB_S3_BUCKET" --region "$BEDROCK_REGION" \
    --key _meko-check/check.txt --body /tmp/meko-check.txt
  aws s3api get-object --bucket "$KB_S3_BUCKET" --region "$BEDROCK_REGION" \
    --key _meko-check/check.txt /dev/null
  aws s3api list-objects-v2 --bucket "$KB_S3_BUCKET" --region "$BEDROCK_REGION" \
    --prefix _meko-check/ --max-items 1
  aws s3api delete-object --bucket "$KB_S3_BUCKET" --region "$BEDROCK_REGION" \
    --key _meko-check/check.txt
)
```

```sh
# Langfuse bucket
(
  export AWS_ACCESS_KEY_ID=<LANGFUSE_S3_KEY> AWS_SECRET_ACCESS_KEY=<LANGFUSE_S3_SECRET> AWS_PAGER=
  echo hello > /tmp/meko-check.txt
  aws s3api put-object --bucket "$LANGFUSE_S3_BUCKET" --region "$LANGFUSE_S3_REGION" \
    --key _meko-check/check.txt --body /tmp/meko-check.txt
  aws s3api get-object --bucket "$LANGFUSE_S3_BUCKET" --region "$LANGFUSE_S3_REGION" \
    --key _meko-check/check.txt /dev/null
  aws s3api delete-object --bucket "$LANGFUSE_S3_BUCKET" --region "$LANGFUSE_S3_REGION" \
    --key _meko-check/check.txt
)
```

Every call must succeed. A new IAM access key can take a few seconds to work. Remove `/tmp/meko-check.txt` when you are done.

Note

Invite emails are off in BYOC, so no key needs `ses:SendEmail`. To turn them on later, see [Upgrade](/byoc/upgrade/).

## Next

[Get an OpenAI key](/byoc/prerequisites/openai-key/).
