Created
March 23, 2022 13:42
-
-
Save anthonydahanne/f55c3d33d7f8be8bfe07afa4f5cadab7 to your computer and use it in GitHub Desktop.
Retrieve last accessed services in AWS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ARN=arn:aws:iam::xxx:user/xxx | |
JOB_ID=$(aws iam generate-service-last-accessed-details --arn $ARN --output=json | jq -r .JobId) | |
aws iam get-service-last-accessed-details --job-id $JOB_ID --output=json | jq '[.ServicesLastAccessed[] | select (.TotalAuthenticatedEntities | contains(1))] | sort_by(.LastAuthenticated)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment