简体   繁体   English

aws 查询以查找非活动键列表

[英]aws query to find the list of inactive keys

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.下面的查询为我提供了非活动键和活动键,因为我有 2 个键,一个是活动键,一个是非活动键,但它会为同一用户返回两个键,即使我只为非活动键设置了过滤器。 Can anyone help me with this谁能帮我这个

aws iam list-access-keys --user-name "user_aws" --query 'AccessKeyMetadata[].AccessKeyId' && AccessKeyMetadata.Status[?Value == 'Inactive'] --output text

This will help you.这会帮助你。

aws iam list-access-keys --user-name "aws-user" --query 'AccessKeyMetadata[?Status == `Inactive`].AccessKeyId'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM