Skip to content

How do I use the CLI to see the details of a CMK rotation status? Documentation seems inaccurate

0

I have referred to the CLI docs (https://awscli.amazonaws.com/v2/documentation/api/latest/reference/kms/get-key-rotation-status.html) when creating a script that generates a list of the keys and outputs the rotation status, but the output only seems to indicate 'True' or 'False' as it related to the key and not all of the details included in that documentation. Am I doing something wrong

Code sample of my script

The output in the documentation seems to include more rotation information and I would like to capture that as well.

Example from AWS CLI documentation (linked above)- { "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "KeyRotationEnabled": true, "NextRotationDate": "2024-02-14T18:14:33.587000+00:00", "RotationPeriodInDays": 365 }

1 Answer
2

Hello.

Looking at the code, it says "awscli", but I think it should be "aws" to run AWS CLI commands.
So I think you need to do something like this:

aws kms get-key-rotation-status --key-id 

In fact, when I ran the above command in my AWS account, I saw the response described in the documentation.
Also, since you seem to be using Python, I think it would be a good idea to use "boto3" instead of running the AWS CLI.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/kms/client/get_key_rotation_status.html#

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.