Module Smaws_Client_KMS.GetKeyLastUsage

Returns usage information about the last successful cryptographic operation performed with a specified KMS key, including the operation type, timestamp, and associated CloudTrail event ID.

The TrackingStartDate in the GetKeyLastUsage response indicates the date from which KMS began recording cryptographic activity for a given key. Use this value together with KeyCreationDate to understand the key's usage history:

For multi-Region KMS keys, primary and replica keys track last usage independently. Each key in a multi-Region key set maintains its own usage information.

The ReEncrypt operation uses two keys: a source key for decryption and a destination key for encryption. Usage information is recorded for both keys independently, each with the CloudTrail event ID from the respective key owner's account.

Do not use GetKeyLastUsage as the sole indicator when scheduling a key for deletion. Instead, first disable the key and monitor CloudTrail for DisabledException entries, as there could be infrequent workflows that are dependent on the key. By looking for this exception, you can identify potential dependencies and workload failures before they occur.

Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

Required permissions: kms:GetKeyLastUsage (key policy)

Related operations:

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

val error_to_string : [ Smaws_Lib.Protocols.AwsJson.error | `DependencyTimeoutException of Types.dependency_timeout_exception | `InvalidArnException of Types.invalid_arn_exception | `KMSInternalException of Types.kms_internal_exception | `NotFoundException of Types.not_found_exception ] -> string
val request : 'http_type Smaws_Lib.Context.t -> Types.get_key_last_usage_request -> (Types.get_key_last_usage_response, [> Smaws_Lib.Protocols.AwsJson.error | `DependencyTimeoutException of Types.dependency_timeout_exception | `InvalidArnException of Types.invalid_arn_exception | `KMSInternalException of Types.kms_internal_exception | `NotFoundException of Types.not_found_exception ]) Stdlib.result
val request_with_metadata : 'http_type Smaws_Lib.Context.t -> Types.get_key_last_usage_request -> (Types.get_key_last_usage_response Smaws_Lib.Response.t, [> Smaws_Lib.Protocols.AwsJson.error | `DependencyTimeoutException of Types.dependency_timeout_exception | `InvalidArnException of Types.invalid_arn_exception | `KMSInternalException of Types.kms_internal_exception | `NotFoundException of Types.not_found_exception ] * Smaws_Lib.Response.metadata) Stdlib.result