Module Smaws_Client_KMS.CreateGrant

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 creating grants in several programming languages, see Use CreateGrant with an Amazon Web Services SDK or CLI.

The CreateGrant operation returns a GrantToken and a GrantId.

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 KeyId parameter.

Required permissions: kms:CreateGrant (key policy)

Related operations:

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency.

val request : Smaws_Lib.Context.t -> Types.create_grant_request -> (Types.create_grant_response, [> Smaws_Lib.Protocols.AwsJson.error | `DependencyTimeoutException of Types.dependency_timeout_exception | `DisabledException of Types.disabled_exception | `DryRunOperationException of Types.dry_run_operation_exception | `InvalidArnException of Types.invalid_arn_exception | `InvalidGrantTokenException of Types.invalid_grant_token_exception | `KMSInternalException of Types.kms_internal_exception | `KMSInvalidStateException of Types.kms_invalid_state_exception | `LimitExceededException of Types.limit_exceeded_exception | `NotFoundException of Types.not_found_exception ]) Stdlib.result