# KMS AccessDeniedException when reading an encrypted S3 object or secret

AWS error fixes · Updated 17 November 2026

**Short answer:** The data is encrypted with a customer managed KMS key and the caller isn't allowed to use that key, even though S3 or Secrets Manager itself would allow the read. KMS checks the key policy first: unless it allows the caller directly, or delegates to IAM with a statement for the account, IAM permissions alone don't count. Grant kms:Decrypt (and kms:GenerateDataKey for writes) on the key ARN in both the key policy and, where needed, the caller's IAM policy.

## What you see

The service calls KMS on your behalf, so the KMS denial appears inside another service's error:

```
An error occurred (AccessDenied) when calling the GetObject operation:
User: arn:aws:sts::123456789012:assumed-role/reports-reader/i-0123456789abcdef0 is not authorized
to perform: kms:Decrypt on resource: arn:aws:kms:eu-west-2:123456789012:key/1a2b3c4d-…
because no identity-based policy allows the kms:Decrypt action

An error occurred (AccessDeniedException) when calling the GetSecretValue operation:
Access to KMS is not allowed
```

The tell-tale sign in S3 is that unencrypted (or SSE-S3) objects in the same bucket read fine while some objects fail. In Secrets Manager, `DescribeSecret` works but `GetSecretValue` fails.

## How KMS decides

Every KMS key has a key policy, and it's the primary control. IAM policies only apply if the key policy delegates to the account, usually through a statement allowing `arn:aws:iam::123456789012:root` to perform `kms:*`. So:

| Situation | What must allow the caller |
|---|---|
| Same account, key policy delegates to IAM | An IAM policy granting `kms:Decrypt` on the key ARN |
| Same account, key policy doesn't delegate | The key policy itself must name the role |
| Cross-account | Both the key policy (naming the other account or role) and the caller's IAM policy |
| AWS managed key (`aws/s3`, `aws/secretsmanager`) | Can't be shared cross-account; its policy can't be edited. Re-encrypt with a customer managed key |

Watch for conditions too: `kms:ViaService` limits use to calls coming through a particular service (for example `s3.eu-west-2.amazonaws.com`), and `kms:EncryptionContext` conditions must match what the service sends.

## Find the key and fix it

1. Identify the key protecting the data:

   ```
   aws s3api head-object --bucket reports-bucket --key 2026/11/summary.csv \
     --query SSEKMSKeyId --output text
   aws secretsmanager describe-secret --secret-id prod/db --query KmsKeyId --output text
   ```

2. Read its policy:

   ```
   aws kms get-key-policy --key-id arn:aws:kms:eu-west-2:123456789012:key/1a2b3c4d-… \
     --policy-name default --query Policy --output text | jq .
   ```

3. Grant the caller. In the IAM policy (same account with delegation, or cross-account):

   ```
   { "Effect": "Allow",
     "Action": ["kms:Decrypt"],
     "Resource": "arn:aws:kms:eu-west-2:123456789012:key/1a2b3c4d-…" }
   ```

   For uploads to an SSE-KMS bucket, add `kms:GenerateDataKey`; multipart uploads need `kms:Decrypt` as well.

4. For cross-account access, add a key policy statement naming the other account's role, then retry.

## Other KMS failures that look similar

- `DisabledException` or `KMSInvalidStateException`: the key is disabled or scheduled for deletion. Re-enable it or cancel deletion with `aws kms cancel-key-deletion` while you still can.
- `NotFoundException` for a key alias: the alias is in another region or account. Use the full key ARN.
- Lambda and ECS failing to read encrypted environment variables or secrets at start-up: the execution role, not the function's code identity, needs `kms:Decrypt`.

Avoid granting `kms:*` on `*`. Scope to the specific key ARN and to `Decrypt` (read) or `GenerateDataKey` (write).

## Questions

### Why can I read some S3 objects but not others in the same bucket?

The failing objects are encrypted with an SSE-KMS key that your role can't use. Check SSEKMSKeyId with head-object and grant kms:Decrypt on that key.

### What does Access to KMS is not allowed mean in Secrets Manager?

Secrets Manager couldn't decrypt the secret because the caller lacks kms:Decrypt on the secret's KMS key, or the key policy doesn't allow it.

### Can I share an aws/s3 managed key with another account?

No. AWS managed keys can only be used within their own account. Use a customer managed key and allow the other account in its key policy.

## When this happens away from your desk

KMS denials often break a service at start-up after a key or role change, so the first sign is tasks or functions failing to start. CloudConsole, a phone app for AWS, is built to show those alarms and start-up logs on your phone.

[About the CloudConsole app](https://cloudconsole.dev/aws-console-app) · [Download on the App Store](https://apps.apple.com/app/cloudconsole-for-aws/id6835419710)

## Sources

- [Key policies in AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)
- [Troubleshooting key access](https://docs.aws.amazon.com/kms/latest/developerguide/policy-evaluation.html)

## Related

- [S3 AccessDenied: Access Denied when calling an S3 operation](https://cloudconsole.dev/errors/s3-access-denied)
- [AccessDeniedException: User is not authorized to perform this action because no identity-based policy allows it](https://cloudconsole.dev/errors/accessdenied-no-identity-based-policy-allows)
- [aws secretsmanager get-secret-value](https://cloudconsole.dev/cli/secretsmanager-get-secret-value)
- [ResourceNotFoundException: Secrets Manager can't find the specified secret](https://cloudconsole.dev/errors/secretsmanager-cant-find-secret)
- [aws s3api head-object](https://cloudconsole.dev/cli/s3api-head-object)
- [ResourceInitializationError: unable to pull secrets or registry auth](https://cloudconsole.dev/errors/ecs-resourceinitializationerror)
- [KMSInvalidStateException: key is pending deletion](https://cloudconsole.dev/errors/kms-key-pending-deletion)

---

Source: https://cloudconsole.dev/errors/kms-access-denied

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
