Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property roleLastUsed from AWS::IAM::Role has always been null #52

Open
hgmiguel opened this issue Dec 1, 2023 · 1 comment
Open

Property roleLastUsed from AWS::IAM::Role has always been null #52

hgmiguel opened this issue Dec 1, 2023 · 1 comment

Comments

@hgmiguel
Copy link

hgmiguel commented Dec 1, 2023

I need to get the last used date from a role, but it is recorded as null. Is it possible to obtain that information from config?

"roleLastUsed": null

@iainelder
Copy link

iainelder commented Dec 12, 2023

I can confirm that the property is missing in my environment. I run a query like this:

SELECT
  configuration.arn,
  configuration.roleLastUsed
WHERE
  resourceType = 'AWS::IAM::Role'
;

And get a result where roleLastUsed is null for all the resources.

@hgmiguel it looks like AWS Config doesn't even record that property for the role.

Use this Bash command to use the AWS CLI to list a number of base configuration items for IAM roles.

aggregator="..."
aws configservice batch-get-aggregate-resource-config \
--configuration-aggregator-name "$aggregator" \
--resource-identifiers "$(
    aws configservice list-aggregate-discovered-resources \
    --configuration-aggregator-name "$aggregator" \
    --resource-type AWS::IAM::Role \
    --max-items 1 \
    --query ResourceIdentifiers
)" \
| jq '.BaseConfigurationItems | map(.configuration |= fromjson)'

All the base configuration items have a configuration.roleLastUsed property of null.

[
  {
    "version": "1.3",
    "accountId": "...",
    "configurationItemCaptureTime": "YYYY-MM-DDTHH:mm:ss.nnnnnnnn+01:00",
    "configurationItemStatus": "ResourceDiscovered",
    "configurationStateId": "...",
    "arn": "...",
    "resourceType": "AWS::IAM::Role",
    "resourceId": "...",
    "resourceName": "...",
    "awsRegion": "global",
    "availabilityZone": "Not Applicable",
    "resourceCreationTime": "YYYY-MM-DDTHH:mm:ss+01:00",
    "configuration": {
      "path": "...",
      "roleName": "...",
      "roleId": "...",
      "arn": "...",
      "createDate": "YYYY-MM-DDTHH:mm:ss.000Z",
      "assumeRolePolicyDocument": "...",
      "instanceProfileList": [],
      "rolePolicyList": [],
      "attachedManagedPolicies": [],
      "permissionsBoundary": null,
      "tags": [],
      "roleLastUsed": null
    },
    "supplementaryConfiguration": {}
  }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants