Adds a grant to a KMS key.
A grant is a policy instrument that allows Amazon Web Services principals to use KMS keys in cryptographic operations. It also can allow them to view a KMS key (DescribeKey) and create and manage grants. When authorizing access to a KMS key, grants are considered along with key policies and IAM policies. Grants are often used for temporary permissions because you can create one, use its permissions, and delete it without changing your key policies or IAM policies.
For detailed information about grants, including grant terminology, see Grants in KMS in the Key Management Service Developer Guide . For examples of working with grants in several programming languages, see Programming grants.
CreateGrant operation returns a
GrantToken and a
When you create, retire, or revoke a grant, there might be a brief delay, usually less than five minutes, until the grant is available throughout KMS. This state is known as eventual consistency. Once the grant has achieved eventual consistency, the grantee principal can use the permissions in the grant without identifying the grant.
However, to use the permissions in the grant immediately, use the
CreateGrant returns. For details, see Using a
grant token in the
Key Management Service Developer Guide
CreateGrant operation also returns a
GrantId. You can
GrantId and a key identifier to identify the grant in the RetireGrant and RevokeGrant operations. To find the grant
ID, use the ListGrants or ListRetirableGrants
The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys in the Key Management Service Developer Guide.
Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key
ARN in the value of the
Required permissions: kms:CreateGrant (key policy)