This query has an issue with an error
aws iam list-access-keys --user-name "User1_aws" --query AccessKeyMetadata.Status[?Value == 'Inactive'] --output text
The below query gives me both inactive and active keys as I have 2 keys one active and one inactive but it returns both keys for the same user even I put the filter for inactive key only. Can anyone help me with this
aws iam list-access-keys --user-name "user_aws" --query 'AccessKeyMetadata[].AccessKeyId' && AccessKeyMetadata.Status[?Value == 'Inactive'] --output text
CodePudding user response:
This will help you.
aws iam list-access-keys --user-name "aws-user" --query 'AccessKeyMetadata[?Status == `Inactive`].AccessKeyId'