使用AWS SDK for Python(Boto3)库编写以下代码:
import boto3
# Create a KMS client
kms = boto3.client('kms')
# Specify the key ID or ARN
key_id_or_arn = 'YOUR_KEY_ID_OR_ARN'
# Get key usage history
response = kms.get_key_rotation_status(KeyId=key_id_or_arn)
# Print the last key usage date
print(response['LastKeyRotationDate'])
此代码使用AWS SDK for Python(Boto3)库中的方法来获取密钥使用历史记录,并打印出最近的密钥使用日期。