AWS KMS AccessDenied by Service - Which Principal Needs Which Action, and in Which Policy
First Published:
Last Updated:
KMS.AccessDeniedException. When delivering messages from an Amazon SNS topic to an encrypted queue, messages are not received. When creating volumes from an Amazon EBS snapshot shared with another account, the operation fails. When you try to encrypt an AWS CloudTrail trail with an AWS KMS key, the trail cannot be created. In all these cases, the issue stems from insufficient permissions on the AWS KMS key. However, determining which principal requires which KMS action, and in which policy, varies depending on the service.This article outlines the required KMS key permissions for six services: SQS, SNS, EBS, CloudTrail, Amazon S3, and AWS Secrets Manager. It details the principals that need to call the KMS key, the necessary KMS actions, and where to define those permissions within the policies, on a service-by-service basis. Additionally, it explains what the denial messages tell you and provides a troubleshooting sequence to follow when simply adding permissions does not resolve the issue. The primary resources consulted include the AWS KMS Developer Guide, the user and developer guides for each service, articles from the AWS re:Post Knowledge Center, and the IAM User Guide's page on denial messages.
Based on the available documentation, the answers are as follows. The principal that needs to call the key varies depending on the service. For SQS, the role sending messages requires permissions for
kms:GenerateDataKey and kms:Decrypt. When delivering messages from SNS to an encrypted SQS queue, the queue's key policy must grant permissions to the SNS service principal. CloudTrail, acting as a service principal, directly calls the key itself. When a key is used across accounts, both the key policy in the account that owns the key and the IAM policy in the calling account are required. AWS managed keys cannot have their key policies modified. As far as the sources state, SQS and S3 require customer managed keys for cross-account usage, while SQS and SNS require customer managed keys when sending from AWS services to queues or topics. However, there is an exception for sharing EBS snapshots, announced on November 16, 2026.This article is neither a comprehensive guide to understanding IAM denial messages nor a reference for cryptographic design. It does not cover methods for sharing keys with other accounts, nor does it discuss pricing. Instead, for each service, it shows only who calls, which action is required, and where to write it, in the words of the documentation. The information presented was verified as of November 26, 2026.
Related articles on this site:
- AWS IAM AccessDenied Reference - Reading the Error and Locating the Deciding Statement
- IAM Policy Evaluation Logic Step-by-Step - Explicit Deny, RCP, SCP, Resource Policy, Identity Policy, Permission Boundary, and Session Policy
- AWS KMS Envelope Encryption and Data Key Caching Patterns - Design Decisions for the AWS Encryption SDK and Multi-Region Keys
- AWS Organization Guardrails - Service Control Policies, Resource Control Policies, and Data Perimeter Design
- Encryption Controls by Service on AWS Storage - What Is On by Default, Which Key You Can Choose, and What Turning It On Does Not Re-encrypt
- Resource-Based Policies by Service on AWS - Where the Second Policy Lives, What It Can Say, and When It Is Required
- Amazon S3 Security and Access Control Guide - Bucket Policies, IAM, Access Points, Block Public Access, and Encryption
- AWS Secrets Manager and Parameter Store Decision Guide - Storing, Rotating, and Accessing Secrets and Configuration
- AWS History and Timeline regarding AWS Key Management Service - Overview, Functions, Features, Summary of Updates, and Introduction to KMS
Table of Contents
- 1. Scope and How to Read the Tables
- 2. Three Places to Write a KMS Permission
- 3. Three Kinds of Caller
- 4. Reading the Denial
- 5. The Service Rows
- 6. Where an AWS Managed Key Is Not Enough
- 7. Condition Keys That Commonly Miss
- 8. When the Fix Does Not Fix It
- 9. Frequently Asked Questions About AWS KMS AccessDenied by Service
- 10. Summary
- 11. References
1. Scope and How to Read the Tables
This chapter defines the scope of this article, how to read the tables, and the terminology used throughout. The key takeaways are as follows:- Permissions for KMS can be defined in three places: key policies, IAM policies, and grants. SCPs, RCPs, permissions boundaries, and VPC endpoint policies only narrow permissions; they do not grant them.
- Callers of a key fall into three kinds: the user's role calls the key directly, a service calls the key on behalf of the user, or a service principal calls the key for itself.
- Denial messages may or may not name the policy that denied the call. In some cases, services wrap KMS denials in different error messages, while in others, no error is returned and logs or messages simply stop arriving.
- The situations where AWS managed keys are insufficient vary by service. SQS and S3 require customer managed keys for cross-account usage, while SQS and SNS require them for usage by service principals. There is an exception for sharing EBS snapshots.
- If adding permissions does not resolve the issue, first use CloudTrail to check the caller and the key. Then, examine the key's status, key policy, IAM policy, grants, restrictive policies, and condition keys in that order.
1.1 Who This Article Is For
This article is intended for AWS developers and infrastructure engineers who are working with SQS, SNS, EBS, CloudTrail, S3, and Secrets Manager, and who combine these services across accounts or with one another while keeping them encrypted. Specifically, this article is for readers who may believe any of the following to be true:- Denials related to KMS can be resolved simply by adding the
kms:Decryptpermission to their role's IAM policy. - Within the same account, AWS managed keys are sufficient.
- No service can hand data to another account unless it uses a customer managed key.
- The denial message always identifies which policy is causing the denial.
- Adding the
kms:ViaServicecondition will restrict all calls from services.
Depending on the service and the caller, each of these holds only in part or not at all.
1.2 What This Article Covers and What It Does Not
This article addresses the permissions involved when six services use symmetric encryption KMS keys. The services are discussed in Chapter 5. Details are provided for SQS, SNS, EBS, and CloudTrail. For S3 and Secrets Manager, only the table entries and key points are presented, with more detailed information directed to previously published resources.This article does not cover the following:
- The structure of IAM denial messages and a general overview of how to interpret them based on different policy types. The previously published AWS IAM AccessDenied Reference - Reading the Error and Locating the Deciding Statement covers them. This article focuses solely on the error formats generated by KMS, which are addressed in Chapter 4.
- Encryption design considerations, such as envelope encryption, data key caching, and key management strategies. The previously published AWS KMS Envelope Encryption and Data Key Caching Patterns - Design Decisions for the AWS Encryption SDK and Multi-Region Keys covers them.
- Where service configurations for keys are located and what is encrypted by default. The previously published Encryption Controls by Service on AWS Storage - What Is On by Default, Which Key You Can Choose, and What Turning It On Does Not Re-encrypt covers them.
- Key sharing using AWS Resource Access Manager, cross-account replicas in Secrets Manager, and what remains after sharing is discontinued.
- Encryption of event data stores within CloudTrail Lake. CloudTrail Lake is one of the services moving to maintenance, and it stopped accepting new customers on May 31, 2026 (as noted in AWS Service Availability Updates). This article focuses solely on the trail-related aspects.
- Asymmetric keys, HMAC keys, external key stores, and multi-Region keys.
- Pricing and the number of KMS calls.
1.3 How to Read the Tables
Table 2 in Chapter 5 presents one row for each service scenario. The columns are as follows:- Service and Scenario: Which operation uses the key.
- Caller: From the point of view of KMS, whose permissions the call is evaluated with. One of the three kinds in Chapter 3.
- KMS Actions: The actions that the documentation says are required, spelled as in the documentation. Asterisks are kept as the documentation shows them.
- Where to Allow: Whether to write the permission in the key policy, an IAM policy, or a grant.
- Source: The page that supports the row.
When pages list different actions for the same scenario, this article does not decide which is correct and lists both with their sources.
1.4 Terms Used in This Article
This article uses the following terms with the following meanings:- Key Policy: A resource-based policy associated with a KMS key. The Key policies in AWS KMS page describes a key policy as the resource policy for a KMS key.
- IAM Policy: An identity-based policy associated with IAM users and roles.
- Grant: A mechanism that allows a specific principal to use a key for specific operations only. AWS services often create it on behalf of users.
- Customer Managed Key: A key created and managed by the user, for which the user can define the key policy.
- AWS Managed Key: A key created for the user's account by an AWS service. Its alias begins with
aws/(for example,aws/sqsandaws/ebs). While the key policy can be viewed, it cannot be modified. - AWS Owned Key: A key held by an AWS service within its own service account. Users cannot view or modify the key policy for these keys.
- Service Principal: A principal that represents an AWS service itself (e.g.,
cloudtrail.amazonaws.com). - Caller: The principal whose permissions KMS uses to evaluate a call. When a service sends the KMS call but KMS evaluates it with the permissions of a user's role, this article calls the user's role the caller.
- Inference: An inference of this article, not a statement in any source. This article marks an inference in the same sentence.
2. Three Places to Write a KMS Permission
This chapter outlines three locations where you can write KMS permissions, and details policies that restrict those permissions. In conclusion, every key has a key policy, and IAM policies are ineffective unless the key policy allows them. When working across accounts, both key policies and IAM policies are required.2.1 Key Policy - Every Key Has One
The Key policies in AWS KMS page of the AWS KMS Developer Guide explains the relationship between key policies and IAM policies.Unless the key policy explicitly allows it, you cannot use IAM policies to allow access to a KMS key. Without permission from the key policy, IAM policies that allow permissions have no effect.
A key policy is in the same account and Region as its key. The Troubleshooting AWS KMS permissions page states:
Key policies are always defined in the AWS account and Region that owns the KMS key.
The Troubleshoot access denied error messages page of the IAM User Guide states that, for services that support resource-based policies, within the same account, either an identity-based policy or a resource-based policy is sufficient. In this article's inference, KMS is an exception to this general rule. In KMS, even within the same account, a key cannot be accessed using only an IAM policy unless the key policy explicitly delegates that permission to the IAM policy.
2.2 IAM Policy - Effective Only When the Key Policy Delegates
The default key policy that a key gets when it is created grants the account holding the key the permissionkms:*. The Default key policy page describes this statement's function: to grant access to the account and enable the IAM policy. With this statement in place, principals within the same account can use the key solely through IAM policies.When crossing account boundaries, both policies are required. The page "Allowing users in other accounts to use a KMS key" states:
Cross-account access requires permission in the key policy of the KMS key and in an IAM policy in the external user's account.
The same page divides the function of these two policies as follows:
The key policy determines who can have access to the KMS key. The IAM policy determines who does have access to the KMS key. Neither the key policy nor the IAM policy alone is sufficient—you must change both.
According to the same page, the IAM policy of the calling account is only effective within the scope of actions permitted by the key policy. Only cryptographic operations,
CreateGrant, DescribeKey, GetKeyRotationStatus, GetPublicKey, ListGrants, RetireGrant, and RevokeGrant are effective across accounts. If the Region where the key resides is not enabled in the calling account (an opt-in Region), the account permissions will not be effective.The
Resource field in the IAM policy should contain the ARN of the key. The Amazon SQS Key management page in the SQS Developer Guide states:While you can configure global permissions to send to and receive from Amazon SQS, AWS KMS requires explicitly naming the full ARN of KMS keys in specific regions in the Resource section of an IAM policy.
The SNS Developer Guide also contains similar wording. When referencing a key across accounts, use either the key's ARN or an alias ARN. If you only specify the key ID or alias name, AWS will treat the key as belonging to your own account (as described in the "Allowing users in other accounts to use a KMS key" page).
2.3 Grants - Mostly Written by Services
A grant allows a specific principal to use a key for specific operations only. AWS services create many grants on behalf of their users. In EBS, a grant is generated when an instance uses an encrypted volume (see Section 3.4).Only principals allowed to perform the
kms:CreateGrant action can create grants. According to the Default key policy page, the default key policy applied when creating a key through the console grants the key's users the permissions kms:CreateGrant, kms:ListGrants, and kms:RevokeGrant, subject to the kms:GrantIsForAWSResource condition. This condition allows operations on grants only from AWS services integrated with KMS, and prevents users from directly invoking grant operations.A grant may take some time to become fully effective after it is created. The "Grants in AWS KMS" page states:
It typically takes less than a few seconds for the change to propagate throughout the system, but in some cases it can take several minutes. If you try to use a grant before it fully propagates through the system, you might get an access denied error.
According to the same page, you can immediately use the grant's permissions, even before the grant is fully propagated, by providing the grant token returned during grant creation.
2.4 Policies That Only Narrow - SCPs, RCPs, Permissions Boundaries, and VPC Endpoint Policies
The Troubleshooting AWS KMS permissions page lists the following, in addition to key policies, IAM policies, and grants, as policies that KMS evaluates:Other types of policies that might apply to the request to use the KMS key, such as AWS Organizations service control policies and VPC endpoint policies. These policies are optional and allow all actions by default, but you can use them to restrict permissions otherwise given to principals.
These policies do not grant permissions; they only restrict those granted by key policies and IAM policies.
- SCPs (Service Control Policies) define the maximum permissions that IAM users and roles can have within an organization. According to the Service control policies (SCPs) page, SCPs do not affect service-linked roles.
- RCPs (Resource Control Policies) define the maximum permissions that can be applied to organizational resources. According to the Resource control policies in AWS KMS page, RCPs do not apply to AWS managed keys. According to the Resource control policies (RCPs) page, RCPs also do not affect the
kms:RetireGrantpermission. - Permissions boundaries define the maximum permissions that IAM users and roles can have (see the Troubleshoot access denied error messages page).
- VPC endpoint policies restrict calls that pass through VPC endpoints.
The Requirements for Amazon EBS encryption page also states that identity-only roles (see Section 3.4) used by instances must adhere to both SCPs and key policies.
Identity-only roles are subject to service control policies (SCPs), and KMS key policies.
2.5 Same Account and Across Accounts
Table 1 outlines which policies are required when accessing a key within the same account and when accessing a key across accounts.
| Scenario | Key Policy | IAM Policy | Grant | Source |
|---|---|---|---|---|
| Same account, key policy explicitly identifies the principal | Requires granting permissions to the principal and actions | Not required | Not required | Key policies in AWS KMS |
| Same account, key policy grants permissions to the account (default key policy) | Requires granting permissions to the account | Requires granting permissions to the principal, actions, and key ARN | Not required | Default key policy |
| Same account, using a grant | Requires allowing kms:CreateGrant for the principal that creates the grant | Not required | Requires granting permissions to the principal and actions | Grants in AWS KMS |
| Across accounts | In the account that holds the key, grant permissions to either the calling account or the principal | In the calling account, grant permissions to the principal, actions, and key ARN | Can be used in place of IAM policies | Allowing users in other accounts to use a KMS key |
| Any scenario | No explicit Deny | No explicit Deny | — | Troubleshooting AWS KMS permissions |
As the last row of Table 1 shows, an explicit Deny in any policy overrides an Allow. SCPs, RCPs, permissions boundaries, session policies, and VPC endpoint policies can also stop a call by denying it or by lacking an Allow.
Regarding grants for cross-account access, the Allowing users in other accounts to use a KMS key page states that principals in the calling account cannot use the key unless they are granted permissions through an IAM policy or a grant.
3. Three Kinds of Caller
This chapter lists three kinds of caller that call a KMS key. In conclusion, even for the same key, the caller differs by service. When the caller differs, where to write the permission and which condition keys you can use also differ.
3.1 Your Role Calls AWS KMS Directly
When your application uses the AWS SDK to callEncrypt, Decrypt, or GenerateDataKey, your application's role is the direct caller. You must grant this role permission through either the key policy or the IAM policy. Because the calls bypass any service, the kms:ViaService condition does not apply.3.2 A Service Calls on Your Behalf - Forward Access Sessions and kms:ViaService
When sending messages to SQS, reading objects from S3, or retrieving values from Secrets Manager, users do not directly call KMS. Instead, a service calls KMS on behalf of the user. The IAM User Guide describes this mechanism on the Forward access sessions page as follows:Forward access sessions (FAS) is an IAM technology used by AWS services to pass your identity, permissions, and session attributes when an AWS service makes a request on your behalf.
The same page gives an S3 example, described as follows:
When KMS receives the FAS request it checks the permissions of the role and only authorizes the decryption request if data-reader has the correct permissions on the KMS key.
In other words, even though the service sends the call to KMS, KMS checks the permissions of the user's role. In this type of scenario, the user's role requires both permissions to perform the service's operations and permissions to access the KMS key.
This type of call can utilize the
kms:ViaService condition key. The AWS KMS condition keys page describes this as follows:The kms:ViaService condition key limits use of an KMS key to requests from specified AWS services. This condition key only applies for Forward access sessions.
The table on the same page lists the following services that correspond to
kms:ViaService: SQS (sqs.AWS_region.amazonaws.com), SNS (sns.AWS_region.amazonaws.com), EBS (ec2.AWS_region.amazonaws.com), S3 (s3.AWS_region.amazonaws.com), and Secrets Manager (secretsmanager.AWS_region.amazonaws.com). CloudTrail is not listed in this table.The Secrets Manager User Guide describes how Secrets Manager functions in this manner, as follows:
When Secrets Manager uses a KMS key in cryptographic operations, it acts on behalf of the user who is accessing or updating the secret value.
3.3 A Service Principal Calls for Itself
Some services, rather than acting on behalf of a user, call KMS directly as a service principal. This occurs when services like CloudTrail encrypt logs, SNS delivers messages to encrypted SQS queues, or other AWS services send events to encrypted queues or topics.The re:Post Knowledge Center article, "How do I resolve the AWS KMS key policy error?" categorizes two types of scenarios as follows:
For the AWS services that support the condition key and make the requests with a forward access session, use the kms:ViaService AWS KMS condition key.
AWS services that make direct calls to AWS KMS must have the service principal in the Principal element.
In this article's inference, a service principal is neither an IAM user nor an IAM role and cannot have IAM policies, so the permission for this kind of call is written in the key policy, not in an IAM policy. An AWS managed key, whose key policy cannot be changed, cannot be used for this kind of call (see Section 6.3).
For this type of scenario, add the
aws:SourceArn and aws:SourceAccount conditions to the statement to prevent confused deputy scenarios (see Section 7.4).3.4 Grants to an Identity-Only Role - Amazon EBS on an Instance
EBS combines the types described in Section 3.2 with grants. When users create volumes or launch instances, they use keys through EC2 (thekms:ViaService value is ec2.AWS_region.amazonaws.com). When an instance uses an encrypted volume, a grant is issued to the instance's identity-only role. The "Requirements for Amazon EBS encryption" page states:When an instance attempts to interact with an encrypted AMI, volume, or snapshot, a KMS key grant is issued to the instance's identity-only role.
According to the same page, users do not create or delete an identity-only role, and it has no policies. When an application on an instance reads objects from S3, for example, it uses the instance's role or other credentials, rather than the identity-only role. As described in Section 2.4, identity-only roles are subject to SCPs and key policies. The same page also notes that when writing SCPs or key policies to deny access based on network location, it is necessary to ensure that these policies do not apply to identity-only roles.
In this article's inference, the three kinds mix within one configuration. For example, in a scenario where a topic distributes messages to an encrypted SQS queue, and another role receives messages from the queue, the role publishing to the topic would use the type described in Section 3.2, SNS distributing to the queue would use the type described in Section 3.3, and the role receiving messages from the queue would also use the type described in Section 3.2. When troubleshooting denials, it is important to first determine at which stage the access was blocked.
4. Reading the Denial
This chapter outlines what can and cannot be gleaned from KMS denial messages. This article leaves the explanation of message structure and the general guide to reading denials by policy type to AWS IAM AccessDenied Reference - Reading the Error and Locating the Deciding Statement. In conclusion, KMS denials can appear in various forms: by explicitly stating the policy type, by omitting it, by being wrapped in another error message, or by not appearing as an error at all.4.1 What the Message Names, and What It Does Not
According to the IAM User Guide's Troubleshoot access denied error messages page, an explicit denial message names the denying policy type in the formwith an explicit deny in a type policy, and an implicit denial message uses the form because no type policy allows the action action. The same page also notes the following.Some AWS services do not support this access denied error message format. The content of access denied error messages can vary depending on the service making the authorization request.
An article in the SQS Knowledge Center provides an example of a KMS denial returned by SQS, as follows:
"An error occurred (KMS.AccessDeniedException) when calling the SendMessage operation: User: arn:aws:iam::xxxxx:user/xxxx is not authorized to perform: kms:GenerateDataKey on resource: arn:aws:kms:us-east-1:xxxx:key/xxxx with an explicit deny."
This example ends with
with an explicit deny and does not name the policy type. In this article's inference, a message of this form shows that the denial is explicit and shows the denied principal, action, and key ARN, but not which policy denied the call. You will need to sequentially investigate potential denials from key policies, IAM policies, SCPs, RCPs, permissions boundaries, and VPC endpoint policies.4.2 "No Resource-Based Policy Allows" Points to the Key Policy
The AWS Security Blog's Best practices for setting up Amazon Macie with AWS Organizations describes a scenario where Macie's service-linked role cannot use a key, citing an example of KMS's implicit denial.The Macie service-linked role (AWSServiceRoleForAmazonMacie) is not authorized to decrypt S3 objects in Macie member accounts, because no resource-based policy allows the kms:Decrypt action.
As stated in Section 1.4, KMS resource-based policies are key policies. In this article's inference, when KMS denies a call in the
because no resource-based policy allows form, the key policy allows that action to neither the principal nor its account. Adding permissions to an IAM policy will not resolve the issue. However, this article has only verified this pattern in one instance. This article does not claim that KMS's implicit denials always take this form.4.3 When the Message Does Not Separate "Missing" from "Not Allowed"
Some services return the same message to indicate that a key is missing and that a key cannot be used. The SNS Developer Guide describes the SNSKMSAccessDeniedException as follows:The ciphertext references a key that doesn't exist or that you don't have access to.
A Knowledge Center article on AWS Lambda gives the following message for when environment variables cannot be decrypted:
"Lambda was unable to decrypt your environment variables because the KMS access was denied. Please check your KMS permissions. KMS Exception: AccessDeniedException KMS Message: The ciphertext refers to a customer master key that does not exist, does not exist in this region, or you are not allowed to access."
In this article's inference, when you receive a message in this form, check the key's ARN, the key's Region, and whether the key still exists before adding permissions. A key policy exists only in the key's Region (see Section 2.1).
4.4 When the Service Does Not Return a KMS Error
In scenarios where the service principal initiates the call (as described in Section 3.3), denials may not be returned as errors from the user's call. The CloudTrail documentation, "Configure AWS KMS key policies for CloudTrail," states:If encryption is enabled on a trail, and the KMS key is disabled, or the KMS key policy is not correctly configured for CloudTrail, CloudTrail cannot deliver logs.
Errors may occur when creating or modifying trails. A CloudTrail Knowledge Center article lists
InsufficientEncryptionPolicyException as a potential error, along with the following message.Insufficient permissions to access S3 bucket or KMS key
This message does not differentiate between whether the issue originates from the S3 bucket or the KMS key.
The SNS and SQS Knowledge Center article names SNS delivery status logging as a way to troubleshoot delivery problems from SNS to SQS. In this article's inference, a delivery failure caused by a denial from the queue's key is not returned as an error to the call that published to SNS. Also in this article's inference, when events or messages do not arrive, first suspect whether the key policy of the receiving queue or topic allows the sending service principal.
4.5 When the Key State Is the Cause
A failure caused by the key state returns an error different from a permission failure. The "Key states of AWS KMS keys" page describes errors that occur when using disabled keys or keys that are pending deletion, as follows:DisabledException: <key ARN> is disabled.
KMSInvalidStateException: <key ARN> is pending deletion (or pending replica deletion).
In the table on that page, cryptographic operations on keys that are pending deletion will return either a
DisabledException or a KMSInvalidStateException. In this article's inference, these errors do not go away when you fix key policies or IAM policies. When the service wraps a KMS error, it is important to examine the name of the error within the wrapped message. The SNS page lists KMSDisabledException and KMSInvalidStateException separately from KMSAccessDeniedException.4.6 When the Message Carries an Authorization ID - IAM Access Troubleshooter
On November 17, 2026, IAM announced Access Troubleshooter (as noted in "What's New: AWS IAM announces Access Troubleshooter to debug access denied errors"). For supported APIs, the access denied error message includes an authorization ID. When you pass the ID to theGetRequestAuthorizationDetails API in the same Region where the denial occurred, the response lists the policies evaluated for the request, the type of each policy, and the result of each check. The call requires the iam:GetRequestAuthorizationDetails permission. The "Supported services" section of the IAM User Guide page lists AWS Key Management Service and Amazon Simple Queue Service, and states that only some of the APIs of each listed service are supported.The same page lists the cases where no authorization ID is returned, including the following:
The request type isn't supported by Access Troubleshooter yet. This includes requests made by a service on your behalf and anonymous requests.
In this article's inference, a denial on a call that a service makes on your behalf (Section 3.2) does not carry an authorization ID. This article could not confirm whether a call that a service principal makes for itself (Section 3.3) carries one. When the message has no ID, read it as described in Sections 4.1 to 4.3. Because the feature was announced on November 17, 2026, check the IAM User Guide for changes to the supported services after this article's check date.
4.7 What This Article Could Not Confirm
This article could not confirm the following forms with examples in the sources:- Specific examples of the messages returned by KMS when session policies deny KMS calls. The examples in the IAM User Guide illustrate actions for other services (e.g.,
codecommit:ListRepositories). For SCPs, permissions boundaries, and VPC endpoint policies, the AWS re:Post Knowledge Center article "How can I resolve 400 errors with access denied for AWS KMS ciphertext in AWS Glue?" provides examples ofkms:Decryptdenials. - Whether KMS's explicit denial messages include the policy's ARN.
5. The Service Rows
For six services, this chapter lists the caller, the KMS actions, and where to allow them for each scenario. In conclusion, even within one service, the sender and the receiver need different actions, and when a service delivers to another service, the caller becomes a service principal.Table 2 lists the service rows. The actions in the cells are spelled as in the documentation.
| Service and Scenario | Caller | KMS Actions | Where to Allow | Source |
|---|---|---|---|---|
SQS: Sending (SendMessage) | Sending Role (via SQS) | kms:GenerateDataKey, kms:Decrypt | Key policy or IAM policy. For cross-account access, both are required. | Amazon SQS Key management in the SQS Developer Guide, SQS Knowledge Center |
SQS: Receiving (ReceiveMessage) | Receiving Role (via SQS) | kms:Decrypt | Key policy or IAM policy. For cross-account access, both are required. | Amazon SQS Key management in the SQS Developer Guide |
| SQS: Service Sending to Queue | Service Principal (events.amazonaws.com, s3.amazonaws.com, sns.amazonaws.com) | kms:Decrypt, kms:GenerateDataKey | Key policy for the queue's key (customer managed key). | Amazon SQS Key management in the SQS Developer Guide |
SNS: Publishing (Publish) | Publishing Role (via SNS) | kms:GenerateDataKey*, kms:Decrypt | Key policy or IAM policy. | Managing Amazon SNS encryption keys and costs in the SNS Developer Guide |
| SNS: Service Publishing to Topic | Service Principal. Some services use IAM roles. | kms:GenerateDataKey*, kms:Decrypt | Key policy for the topic's key (customer managed key). | Managing Amazon SNS encryption keys and costs in the SNS Developer Guide |
| SNS: Delivering to an encrypted SQS queue | sns.amazonaws.com | GenerateDataKey, Decrypt (from SNS Developer Guide). kms:GenerateDataKey*, kms:Decrypt (from Knowledge Center examples). | Key policy for the queue's key (customer managed key). | SNS Developer Guide, SNS and SQS Knowledge Center |
| EBS: Creating and Using Encrypted Volumes | The user's role (through EC2) and the instance's identity-only role (through a grant) | kms:CreateGrant, kms:Decrypt, kms:DescribeKey, kms:GenerateDataKeyWithoutPlaintext, kms:ReEncrypt | Key policy or IAM policy. Instance requires a grant. | Requirements for Amazon EBS encryption in the EBS User Guide |
| EBS: Using Shared Snapshots | Principal in the receiving account | kms:DescribeKey, kms:CreateGrant, kms:GenerateDataKey, kms:GenerateDataKeyWithoutPlaintext, kms:ReEncrypt, kms:Decrypt | Key policy for the account holding the key, and IAM policy for the receiving account. | Share the KMS key used to encrypt a shared Amazon EBS snapshot in the EBS User Guide |
| CloudTrail: Encrypting Logs | cloudtrail.amazonaws.com | kms:GenerateDataKey*, kms:DescribeKey. Same page also lists kms:Decrypt. | Key policy. | Configure AWS KMS key policies for CloudTrail in the CloudTrail User Guide |
| CloudTrail: Reading Logs | Principal that reads the logs | kms:Decrypt | Key policy. For cross-account access, also requires the caller's IAM policy. | Configure AWS KMS key policies for CloudTrail in the CloudTrail User Guide |
| S3: Writing Objects | Writing Role (via S3) | kms:GenerateDataKey. For multipart uploads, also kms:Decrypt. | Key policy or IAM policy (Section 5.5). For cross-account access, both are required. | S3 Knowledge Center |
| S3: Reading Objects | Reading Role (via S3) | kms:Decrypt | Key policy or IAM policy (Section 5.5). For cross-account access, both are required. | S3 Knowledge Center |
| Secrets Manager: Retrieving Secret Values | Retrieving Role (via Secrets Manager) | Decrypt | Key policy or IAM policy. | Secret encryption and decryption in AWS Secrets Manager in the Secrets Manager User Guide |
5.1 Amazon SQS
SQS encryption offers two options: SSE-SQS, which uses keys managed by SQS, and SSE-KMS, which uses keys from KMS (see the "Encryption at rest in Amazon SQS" page). This article focuses on SSE-KMS.Regarding sender permissions, the Amazon SQS Key management page of the SQS Developer Guide states:
Therefore, the producer must have the kms:Decrypt and kms:GenerateDataKey permissions for the KMS key.
According to the same page, the sender's
kms:Decrypt call verifies the integrity of a new data key before the key is used. For the receiver, it states:Therefore, the consumer must have the kms:Decrypt permission for any KMS key that is used to encrypt the messages in the specified queue.
The same page further explains that when a queue is configured as a dead-letter queue, the receiver also requires
kms:Decrypt on the key that encrypted the messages in the source queue. An article in the SQS Knowledge Center also lists GenerateDataKey and Decrypt for the sender and Decrypt for the receiver. The two sources list the same actions.When AWS services send messages to a queue, a customer managed key is required. The "Amazon SQS Key management" page lists Amazon CloudWatch Events (
events.amazonaws.com), S3 event notifications (s3.amazonaws.com), and SNS topic subscriptions (sns.amazonaws.com) as potential event sources. It provides an example of a key policy that grants the service principal the kms:Decrypt and kms:GenerateDataKey permissions.Regarding cross-account queue usage, an article in the SQS Knowledge Center states:
To access an SSE Amazon SQS queue from a different account, the queue must use a customer managed key. You can't use an AWS managed key because only customer managed key policies can be modified.
When changing a queue's key, the old key should be retained. The "Amazon SQS Key management" page explains that messages encrypted with the old key will remain encrypted with that key, and decryption will require the old key. The key policy for the old key must continue to grant SQS the
kms:Decrypt and kms:GenerateDataKey permissions. The same page recommends disabling or deleting the old key after all messages encrypted with it have been processed.5.2 Amazon SNS
Regarding permissions for the publishing side, the Managing Amazon SNS encryption keys and costs page of the SNS Developer Guide states:The publisher must have the kms:GenerateDataKey* and kms:Decrypt permissions for the AWS KMS key.
The SQS sender uses
kms:GenerateDataKey (no asterisk), while the SNS publisher uses kms:GenerateDataKey* (with an asterisk). In this article's inference, kms:GenerateDataKey* covers kms:GenerateDataKey.When AWS services publish to a topic, they should use customer managed keys and grant the service principal
kms:GenerateDataKey* and kms:Decrypt in the key policy. The same page lists 14 services in a table, including Amazon CloudWatch (cloudwatch.amazonaws.com), Amazon CloudWatch Events (events.amazonaws.com), and S3 (s3.amazonaws.com). The page also notes that for some services, it may be necessary to specify an IAM role rather than the service principal in the key policy.Some Amazon SNS event sources require you to provide an IAM role (rather than the service principal) in the AWS KMS key policy:
The same page lists seven services, including Amazon EC2 Auto Scaling, AWS CodePipeline, and AWS Config, as applicable services.
When SNS delivers to an encrypted SQS queue, the key policy of the queue's key must allow the SNS service principal. The Setting up Amazon SNS topic encryption with encrypted Amazon SQS queue subscription page of the SNS Developer Guide states:
To allow Amazon SNS to send messages to encrypted Amazon SQS queues, the customer managed key associated with the Amazon SQS queue must have a policy statement that grants Amazon SNS service-principal access to the AWS KMS API actions GenerateDataKey and Decrypt.
The SNS and SQS Knowledge Center article shows a key policy example for the same scenario, with
kms:GenerateDataKey* and kms:Decrypt.{
"Effect": "Allow",
"Principal": {
"Service": "sns.amazonaws.com"
},
"Action": [
"kms:GenerateDataKey*",
"kms:Decrypt"
],
"Resource": "*"
}
This example has no condition. The Amazon SQS Key management page lists SNS among the services that support
aws:SourceArn when they send to an encrypted queue. In this article's inference, you can add the topic's ARN with aws:SourceArn to the key policy of the queue's key (see Section 7.4).The same article states that when a topic is in an opt-in Region, the service principal should use a Regional format, such as
sns.af-south-1.amazonaws.com. The article also notes that if a key is not specified for the queue, the queue will utilize an AWS managed key, and that only principals in the same account can use this key.5.3 Amazon EBS
Regarding permissions for users who utilize encrypted volumes, the Requirements for Amazon EBS encryption page of the EBS User Guide lists five actions.kms:CreateGrant
kms:Decrypt
kms:DescribeKey
kms:GenerateDataKeyWithoutPlaintext
kms:ReEncrypt
The fifth,
kms:ReEncrypt, is spelled as on this page. The AWS KMS permissions page divides the permissions for the ReEncrypt operation into two: kms:ReEncryptFrom (on the key used to decrypt) and kms:ReEncryptTo (on the key used to encrypt). In this article's inference, a policy should either list both actions or, as shown in the example on the KMS page, use kms:ReEncrypt*.The Requirements for Amazon EBS encryption page also says not to allow
kms:CreateGrant broadly, and to use the kms:GrantIsForAWSResource condition so that only grants that AWS services create on the user's behalf are allowed. The grant to the instance's identity-only role is described in Section 3.4.When sharing snapshots with another account, you must also share the customer managed key used to encrypt the snapshot. The Share the KMS key used to encrypt a shared Amazon EBS snapshot page says to allow the following six actions to users of the shared key.
kms:DescribeKey
kms:CreateGrant
kms:GenerateDataKey
kms:GenerateDataKeyWithoutPlaintext
kms:ReEncrypt
kms:Decrypt
Compared to the five actions listed for general users, this page includes one additional action:
kms:GenerateDataKey. The key policy example in the AWS Knowledge Center article "Why can't I create a snapshot of my encrypted Amazon EC2 instance?" also lists these same six actions. The sharing page shows how to add the recipient's account ID to the Allow use of the key and Allow attachment of persistent resources statements of the key policy. On the recipient's account, these permissions must also be granted through an IAM policy, as described in Section 2.2.A snapshot encrypted with an AWS managed key cannot be shared as it is. Associated KMS keys, announced on November 16, 2026, are an exception to this boundary. This is discussed in Section 6.5.
Snapshots may also be transferred to another account during incident response, when providing evidence. A separate article published on the same day, Preserving Volatile Evidence on Amazon EKS - Container Checkpoints, Isolation Order, and What Each Step Destroys, covers volatile evidence on Amazon EKS nodes, together with the order of response steps. Handing over snapshots, re-encrypting them with keys, and locking them are covered in the published article Forensic Evidence on AWS - Acquisition Order, the Forensics Account, Re-Encryption, and EBS Snapshot Lock.
5.4 AWS CloudTrail
CloudTrail calls the key for itself as the service principalcloudtrail.amazonaws.com (Section 3.3). The Configure AWS KMS key policies for CloudTrail page of the CloudTrail User Guide lists three key policy elements required for the trail:- Allow CloudTrail to encrypt log files and digest files.
- Allow the principals that need it to decrypt log files and digest files.
- Allow CloudTrail to access key attributes (using
kms:DescribeKey).
An example of the encryption statement is:
{
"Sid": "AllowCloudTrailEncryptLogs",
"Effect": "Allow",
"Principal": {
"Service": "cloudtrail.amazonaws.com"
},
"Action": "kms:GenerateDataKey*",
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:SourceArn": "arn:aws:cloudtrail:region:account-id:trail/trail-name"
},
"StringLike": {
"kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:account-id:trail/*"
}
}
}
The same page provides an example statement granting the
kms:Decrypt permission to the CloudTrail service principal, which is necessary for CloudTrail to decrypt logs.For principals that need to read the logs, the
kms:Decrypt permission is required. The example on the same page adds a Null condition that requires kms:EncryptionContext:aws:cloudtrail:arn to be present. The page also states that users with only encryption permissions, but not decryption permissions, will be unable to read the encrypted logs.When the principal reading the logs is in a different account, the same page separates two cases. If the S3 bucket is in a different account, the key policy must grant the other account
kms:Decrypt permission, and the other account's IAM policy must also grant access to the key. If the bucket and the key are in the same account, a read role should be created on the account holding the key. The key policy should then grant that role kms:Decrypt permission, and the other account should be granted the ability to assume that role.When writing logs to an existing bucket using an S3 bucket key, caution is advised. The same page states:
If you are using an existing S3 bucket with an S3 Bucket Key, kms:Decrypt permissions are required to create or update a trail with SSE-KMS encryption enabled.
The Encrypting CloudTrail log files, digest files, and event data stores with AWS KMS keys (SSE-KMS) page of the CloudTrail User Guide says to create the key in the same Region as the S3 bucket that receives the log files and digest files.
If the key is disabled or the key policy does not align with CloudTrail's requirements, CloudTrail will be unable to deliver logs (see Section 4.4). When creating a key through the CloudTrail console, CloudTrail automatically applies the necessary key policy.
5.5 Amazon S3
The permissions for S3's SSE-KMS and the design for cross-account access are covered in the published Amazon S3 Security and Access Control Guide - Bucket Policies, IAM, Access Points, Block Public Access, and Encryption. This article gives only the rows in Table 2 and two points that are easy to get wrong.The first point is multipart uploads. The Amazon S3 Knowledge Center article, "Why can't I upload a large file to Amazon S3 with AWS KMS key encryption?" states:
To use an AWS KMS key to encrypt a multipart upload, you must have kms:GenerateDataKey and kms:Decrypt permissions.
In this article's inference, when smaller files upload successfully but only large files fail, suspect a missing
kms:Decrypt permission. According to the same article, high-level AWS CLI aws s3 commands, AWS SDKs, and many third-party programs automatically use multipart uploads for large files.The second point is where to write the permissions. The same article states that if an IAM user or role is in the same account as the KMS key, the permissions must be in the key policy, and if the user or role is in a different account, they must be in both the key policy and the IAM policy. In this article's inference, when the user or role is in the same account, an IAM policy may suffice if the key policy is configured to delegate permissions at the account level (as discussed in Section 2.2).
When sending S3 event notifications to an encrypted SQS queue or an SNS topic, ensure that the key policy for the receiving key allows
s3.amazonaws.com (Sections 5.1 and 5.2).5.6 AWS Secrets Manager
Secrets Manager calls the key on behalf of users (see Section 3.2). The Secret encryption and decryption in AWS Secrets Manager page of the Secrets Manager User Guide describes how it callsDecrypt to retrieve secret values using GetSecretValue, and how it calls GenerateDataKey when writing values using PutSecretValue. The same page also notes that to restrict key usage to calls originating from Secrets Manager, you should specify secretsmanager.<Region>.amazonaws.com in the kms:ViaService condition. The design for encryption and sharing is covered in the published AWS Secrets Manager and Parameter Store Decision Guide - Storing, Rotating, and Accessing Secrets and Configuration.6. Where an AWS Managed Key Is Not Enough
This chapter outlines situations where an AWS managed key is insufficient, and the exceptions to that rule. In conclusion, AWS managed keys cannot have their key policies modified. Therefore, as far as the sources state, they cannot be used for cross-account access in SQS and S3, or for calls from service principals in SQS and SNS. This article does not write this as a rule for every service. There is an exception for sharing EBS snapshots, which utilizes associated KMS keys.6.1 Why the Boundary Exists
The AWS KMS keys page describes AWS managed keys as follows:Specifically, it can only be used in the context of the AWS service you’re operating in and it can only be used by principals within the account that the key exists.
According to the AWS KMS condition keys page, all AWS managed keys have the
kms:ViaService condition in their key policy, allowing them to be used only by calls from the service that created the key. The key policy for the AWS managed key used by Secrets Manager (aws/secretsmanager), for example, includes both the kms:CallerAccount and kms:ViaService conditions (see the Secret encryption and decryption in AWS Secrets Manager page).The same AWS KMS keys page also describes AWS managed keys as an older type of key that is no longer created for new services as of 2021. New services now use AWS owned keys. Of the six services discussed in this article, SQS, SNS, EBS, S3, and Secrets Manager have AWS managed keys (
aws/sqs, aws/sns, aws/ebs, aws/s3, and aws/secretsmanager).Table 3 lists instances where AWS managed keys are insufficient, categorized by service.
| Service | Cross-Account Access | Access from Service Principal | Source |
|---|---|---|---|
| SQS | Not supported. Requires customer managed keys. | Not supported. Event sources require a customer managed key. | SQS Knowledge Center, Amazon SQS Key management |
| SNS | No explicit documentation found on the SNS page. | Not supported. Event sources require a customer managed key. | Managing Amazon SNS encryption keys and costs |
| EBS | A snapshot cannot be shared by granting create-volume permission alone. It can be shared using associated KMS keys (announced November 16, 2026). | — | Share an Amazon EBS snapshot with other AWS accounts, Associated KMS keys |
| S3 | Not supported. Requires customer managed keys. | — | Using server-side encryption with AWS KMS keys (SSE-KMS) |
| Secrets Manager | Key policies restrict access to the same account using kms:CallerAccount. | — | Secret encryption and decryption in AWS Secrets Manager |
6.2 Across Accounts
The S3 page describing using server-side encryption with AWS KMS keys (SSE-KMS) states the following:Objects encrypted using SSE-KMS with AWS managed keys can't be shared cross-account. If you need to share SSE-KMS data cross-account, you must use a customer managed key from AWS KMS.
An article in the SQS Knowledge Center also states that customer managed keys are required for cross-account queues (Section 5.1). In this article's inference, the AWS managed key of Secrets Manager does not allow calls from principals in other accounts, because the
kms:CallerAccount condition in its key policy names the key's account.6.3 In the Same Account, When a Service Principal Calls
The limits of AWS managed keys are not confined to scenarios that cross accounts. Even within the same account, when a service principal makes a call (as described in Section 3.3), AWS managed keys cannot be used. The SQS and SNS pages both put using a customer managed key as the first step of the procedure for letting AWS services send events. In this article's inference, the reason is that permissions for service principals are specified in the key policy, not in an IAM policy, and the key policy for AWS managed keys cannot be modified.6.4 RCPs Do Not Apply to AWS Managed Keys
Even if RCPs are used to restrict the usage of organizational keys, they do not apply to AWS managed keys (see Section 2.4). In this article's inference, a design that uses RCPs to stop external principals from using keys covers customer managed keys only.6.5 The Exception - Associated KMS Keys for Amazon EBS Snapshots
On November 16, 2026, EBS announced a feature that allows you to additionally associate customer managed keys with encrypted snapshots (as noted in "What's New: Amazon EBS now supports associating additional KMS keys with snapshots"). As of this article's check date (November 26, 2026), the announcement is ten days old.The "Associated KMS keys" page in the EBS User Guide states that this feature also allows sharing snapshots encrypted with AWS managed keys.
This also enables you to share snapshots encrypted with an AWS managed key, which otherwise can't be shared across accounts.
That same page lists the conditions for using an associated key across accounts, stating that the key policy of the associated key must permit the principal of the other account, and the IAM policy of that principal must also permit the associated key.
Granting one without the other is not sufficient.
According to the "Considerations" section on that same page, only customer managed keys can be associated; AWS managed keys cannot. Furthermore, to create a volume from an encrypted snapshot, you must have access to the original key that encrypted the snapshot.
To create a volume from an encrypted snapshot, you must have access to the existing KMS key that encrypts the snapshot.
The page also states that associating and disassociating keys requires both the
ec2:AssociateKmsKeyId and ec2:DisassociateKmsKeyId IAM permissions, as well as the KMS permissions necessary for EBS to use the key (as described in Section 5.3). If an association, disassociation, or copy request fails with an authorization error, the error identifies the KMS key that you are not authorized to use.The page also states that the other account can copy the snapshot using the associated key. In this article's inference, the other account copies the snapshot into its own account with the associated key and creates volumes from that copy. Creating a volume directly from the shared snapshot requires permission on the original key.
The "Share an Amazon EBS snapshot with other AWS accounts" page presents two statements.
You can only share snapshots that are encrypted with a customer managed key. You can't share a snapshot that is encrypted under an AWS managed key by granting create-volume permission alone. To share such a snapshot across accounts, first associate a customer managed KMS key with the snapshot.
In this article's inference, this exception is limited to EBS snapshots. It is not a general rule that AWS managed keys can cross accounts. Because the feature was announced on November 16, 2026, check the Amazon EBS User Guide for changes after this article's check date.
7. Condition Keys That Commonly Miss
This chapter lists condition keys that are easy to get wrong when narrowing KMS permissions. In conclusion,kms:ViaService does not apply to calls made by service principals, while aws:SourceArn and aws:SourceAccount should be used in policies for service principals where the service supports them.7.1 kms:ViaService
kms:ViaService applies only to calls made through forward access sessions (see Section 3.2). In this article's inference, calls initiated directly by a service principal (Section 3.3) do not have the kms:ViaService key. The IAM User Guide, on the IAM JSON policy elements: Condition page, states the following:A context key that is not present in the request is considered a mismatch.
In this article's inference, including the
kms:ViaService condition in a statement that allows a service principal will cause the statement to not match the calls, so it does not allow them. This not only fails to narrow them but can also cause the calls to be denied. CloudTrail is not listed in the table on the AWS KMS condition keys page.The value of
kms:ViaService includes the Region, such as sqs.us-east-1.amazonaws.com. In this article's inference, when services in other Regions call the key, list the values for each Region.The AWS KMS condition keys page lists
kms:ViaService as a condition key that can be used in both key policies and IAM policies.7.2 kms:CallerAccount
kms:CallerAccount limits key use by the caller's account. According to the AWS KMS condition keys page, this condition key is single-valued and should not be combined with set operators like ForAnyValue or ForAllValues.7.3 kms:EncryptionContext:context-key
kms:EncryptionContext:context-key limits key use by the encryption context. The CloudTrail statement puts the trail ARN pattern in kms:EncryptionContext:aws:cloudtrail:arn (see Section 5.4). The IAM User Guide's Troubleshoot access denied error messages page names this condition key in an example of denials caused by condition key names not being case sensitive.When S3 bucket keys are enabled, the encryption context changes. The Reducing the cost of SSE-KMS with Amazon S3 Bucket Keys page of the S3 User Guide states:
S3 Bucket Keys use the bucket ARN as encryption context. Before you enable an S3 Bucket Key, update your IAM policies or AWS KMS key policies to use your bucket ARN as the encryption context.
7.4 aws:SourceArn and aws:SourceAccount
When defining key policies to allow service principals, include eitheraws:SourceArn or aws:SourceAccount to specify which resources the call is permitted for. The Amazon SQS Key management page lists these two as conditions to prevent the confused deputy problem, and recommends using aws:SourceAccount when the resource ARN is unknown.The CloudTrail page recommends using
aws:SourceArn, while noting that aws:SourceAccount can be used, but is not recommended.The aws:SourceAccount condition key is also supported, but not recommended. The value of aws:SourceAccount is the account ID of the trail owner, or for organization trails, the management account ID.
The SNS page states that these conditions are not supported when EventBridge sends to an encrypted topic.
Adding the aws:SourceAccount, aws:SourceArn, and aws:SourceOrgID to a AWS KMS policy is not supported for EventBridge-to-encrypted topics.
In this article's inference, adding these conditions to a statement that allows EventBridge to send to an encrypted topic can stop events from arriving.
7.5 kms:GrantIsForAWSResource
kms:GrantIsForAWSResource allows permissions only for grants created on behalf of users by AWS services. The EBS page says to allow kms:CreateGrant with this condition (Section 5.3). The default key policy also applies this condition to the grant permissions of key users (Section 2.3). In this article's inference, removing this condition would permit the creation of grants that do not pass through AWS services.8. When the Fix Does Not Fix It
This chapter outlines a process to follow when granting permissions does not resolve the issue. This order is this article's inference and is not a procedure in any source.- In CloudTrail, search for denied KMS events and verify the principal that made the request, the key's ARN, and the error code. According to the Allowing users in other accounts to use a KMS key page, operations that use a KMS key from another account are logged in both the account making the request and the account that owns the key. The principal that made the request (the user's role or a service principal) tells you which kind in Chapter 3 applies.
- Verify the key's ARN and Region. Confirm that the IAM policy's
Resourcefield references the correct key's ARN and is not referencing a key in a different Region (see Sections 2.1, 2.2, and 4.3). - Check the key's status. If the key is disabled or pending deletion, granting permissions will not resolve the issue (see Section 4.5).
- Examine the key policy. If the principal is a service principal, verify that the key policy explicitly lists the service principal. If the principal is a user role, confirm that the key policy either explicitly allows the principal or delegates access to an account. If the key is an AWS managed key, check whether the case is one in Chapter 6.
- Review the IAM policy of the account making the request. If the request is crossing accounts, ensure that the IAM policy in the requesting account allows the key's ARN and the necessary actions.
- Verify any grants. For services that utilize grants, such as EBS, confirm that the policy allows the
kms:CreateGrantaction. - Examine restrictive policies. Check SCPs, RCPs, permissions boundaries, session policies, and VPC endpoint policies for any explicit denials or missing permissions (see Section 2.4).
- Validate condition keys. Verify that the Region in the
kms:ViaServicevalue, the value ofkms:EncryptionContext:context-key, and the value ofaws:SourceArnmatch the actual request (see Chapter 7). - Allow time for changes to propagate. Changes to key policies and grants may not take effect immediately (see Section 2.3). The Troubleshooting AWS KMS permissions page notes that key policy changes are eventually consistent.
- Check the old key. After you change the key of an SQS queue, old messages are decrypted with the old key (see Section 5.1).
9. Frequently Asked Questions About AWS KMS AccessDenied by Service
9.1 I added kms:Decrypt to my IAM role, but the call is still denied. Why?
The key policy may not delegate to IAM policies. Unless the key policy allows it, the permissions defined in the IAM policy will not take effect (see Section 2.1). Across accounts, the key policy in the account that owns the key also needs the permission (see Section 2.2). In some cases, such as when performing SQS operations, you may need to includekms:GenerateDataKey in addition to kms:Decrypt (see Section 5.1).9.2 Is an AWS managed key enough within a single account?
It is enough if principals in the same account only use it through the service. However, it is not sufficient when a service principal needs to use it. For example, when SNS delivers to an encrypted SQS queue, or when an AWS service such as S3 event notifications sends to a queue or topic, SQS and SNS require a customer managed key (see Section 6.3).9.3 Can I share an EBS snapshot encrypted with an AWS managed key?
Since the announcement on November 16, 2026, you can share such a snapshot using associated KMS keys. To do so, associate a customer managed key with the snapshot and then share that key with the recipient's account. Sharing the associated key requires both a key policy and the recipient's IAM policy. To create a volume directly from the shared snapshot, access to the original key is required (see Section 6.5).9.4 Why does kms:ViaService not restrict CloudTrail?
kms:ViaService only applies to forward access sessions initiated on behalf of users. CloudTrail, however, directly calls the key itself, and is not listed in the table on the AWS KMS condition keys page. In this article's inference, if a statement that allows CloudTrail includes the kms:ViaService condition, that statement will not match CloudTrail's calls and will not allow them (see Section 7.1). CloudTrail's policy should be restricted using aws:SourceArn and kms:EncryptionContext:aws:cloudtrail:arn (see Sections 7.3 and 7.4).9.5 The error says "with an explicit deny" but does not name the policy. Where should I look?
Similar to the SQS example, KMS denials may sometimes be returned without indicating the type of policy. In this article's inference, check the following in order: key policies, IAM policies, SCPs, RCPs, permissions boundaries, session policies, and VPC endpoint policies (see Section 4.1 and Chapter 8). If the message carries an authorization ID, IAM Access Troubleshooter returns the evaluated policies and their types (see Section 4.6).9.6 Which action names should I write for EBS: kms:ReEncrypt or kms:ReEncryptFrom and kms:ReEncryptTo?
The EBS page writeskms:ReEncrypt. The AWS KMS permissions page separates permissions into kms:ReEncryptFrom and kms:ReEncryptTo. In this article's inference, a policy should either include both of these actions, or use kms:ReEncrypt* (as described in Section 5.3).10. Summary
- You can specify KMS permissions in three places: key policies, IAM policies, and grants. IAM policies are ineffective unless the key policy allows them. When accessing across accounts, both key policies and IAM policies are required.
- SCPs, RCPs, permissions boundaries, and VPC endpoint policies only narrow permissions; they do not grant them. RCPs do not apply to AWS managed keys.
- Callers of a key fall into three kinds: the user's role calls the key directly, a service calls the key on behalf of the user, or a service principal calls the key for itself. EBS combines these with grants.
- For SQS, the sending side requires
kms:GenerateDataKeyandkms:Decrypt, while the receiving side requireskms:Decrypt. For SNS, the publishing side requireskms:GenerateDataKey*andkms:Decrypt. For SNS to deliver to an encrypted SQS queue, the key policy of the queue's key must allowsns.amazonaws.com. - CloudTrail requires you to grant
kms:GenerateDataKey*andkms:DescribeKeytocloudtrail.amazonaws.comin the key policy, andkms:Decryptto the principals that read the logs. The key should be in the same Region as the S3 bucket that receives the logs. - Denial messages may not name the policy type, and the service may wrap the error in a different message. In other cases, no error is returned and logs or messages simply stop arriving.
- The situations where AWS managed keys are insufficient vary by service. SQS and S3 require customer managed keys for cross-account access, while SQS and SNS require them for access from service principals. Sharing EBS snapshots is an exception, covered by associated KMS keys announced on November 16, 2026.
- If adding permissions does not resolve the issue, first use CloudTrail to check the caller and the key. Then, examine the key's status, key policy, IAM policy, grants, restrictive policies, and condition keys in that order.
11. References
- AWS Key Management Service Developer Guide: Key policies in AWS KMS
- AWS Key Management Service Developer Guide: Default key policy
- AWS Key Management Service Developer Guide: Allowing users in other accounts to use a KMS key
- AWS Key Management Service Developer Guide: Troubleshooting AWS KMS permissions
- AWS Key Management Service Developer Guide: Grants in AWS KMS
- AWS Key Management Service Developer Guide: AWS KMS condition keys
- AWS Key Management Service Developer Guide: AWS KMS permissions
- AWS Key Management Service Developer Guide: AWS KMS keys
- AWS Key Management Service Developer Guide: Key states of AWS KMS keys
- AWS Key Management Service Developer Guide: Resource control policies in AWS KMS
- IAM User Guide: Troubleshoot access denied error messages
- IAM User Guide: Troubleshoot access denied error messages with authorization ID
- IAM User Guide: Forward access sessions
- IAM User Guide: IAM JSON policy elements: Condition
- AWS Organizations User Guide: Service control policies (SCPs)
- AWS Organizations User Guide: Resource control policies (RCPs)
- Amazon SQS Developer Guide: Amazon SQS Key management
- Amazon SQS Developer Guide: Encryption at rest in Amazon SQS
- Amazon SNS Developer Guide: Managing Amazon SNS encryption keys and costs
- Amazon SNS Developer Guide: Setting up Amazon SNS topic encryption with encrypted Amazon SQS queue subscription
- Amazon EBS User Guide: Requirements for Amazon EBS encryption
- Amazon EBS User Guide: Share the KMS key used to encrypt a shared Amazon EBS snapshot
- Amazon EBS User Guide: Share an Amazon EBS snapshot with other AWS accounts
- Amazon EBS User Guide: Associated KMS keys
- Amazon S3 User Guide: Using server-side encryption with AWS KMS keys (SSE-KMS)
- Amazon S3 User Guide: Reducing the cost of SSE-KMS with Amazon S3 Bucket Keys
- AWS CloudTrail User Guide: Configure AWS KMS key policies for CloudTrail
- AWS CloudTrail User Guide: Encrypting CloudTrail log files, digest files, and event data stores with AWS KMS keys (SSE-KMS)
- AWS Secrets Manager User Guide: Secret encryption and decryption in AWS Secrets Manager
- AWS re:Post Knowledge Center: How do I troubleshoot "AccessDenied" or "AccessDeniedException" errors on Amazon SQS API calls?
- AWS re:Post Knowledge Center: How do I configure my cross-account or cross-Region Amazon SQS endpoint to the Amazon SNS topic?
- AWS re:Post Knowledge Center: Why can't I create a snapshot of my encrypted Amazon EC2 instance?
- AWS re:Post Knowledge Center: Why can't I upload a large file to Amazon S3 with AWS KMS key encryption?
- AWS re:Post Knowledge Center: How do I resolve the AWS KMS key policy error?
- AWS re:Post Knowledge Center: How do I resolve Lambda function "KMS Exception" permission errors?
- AWS re:Post Knowledge Center: How do I resolve CloudTrail encryption permission errors when I create or update my trail?
- AWS re:Post Knowledge Center: How can I resolve 400 errors with access denied for AWS KMS ciphertext in AWS Glue?
- AWS Security Blog: Best practices for setting up Amazon Macie with AWS Organizations
- AWS What's New: Amazon EBS now supports associating additional KMS keys with snapshots
- AWS What's New: AWS Service Availability Updates
- AWS What's New: AWS IAM announces Access Troubleshooter to debug access denied errors
References:
Tech Blog with curated related content
Written by Hidekazu Konishi