SSM Runbook Fails

  • Name of the Runbook: AWSConfigRemediation-RevokeUnusedIAMUserCredentials
  • error: line 74, in get_user_name resource_name = list_discovered_resources_response.get("resourceIdentifiers")[0].get("resourceName") IndexError: list index out of range IndexError - list index out of range. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.

when I try to run this runbook, it fails with that error. I tried inputting different IAM resource identifiers (group, user, role...). Config is also enabled. What should I do?

asked 2 months ago170 views
1 Answer

IAMResourceId is a IAM resource unique identifier. You need to obtain the UserId from a CLi/APi Call.

The unique ID for an IAM resource is not available in the IAM console. To get the unique ID, you can use the following AWS CLI commands or IAM API calls.

aws iam get-user --user-name <username>

This will return the UserId. This is what needs to be passed to the Document as the IAMResourceID


    "User": {
        "Path": "/",
        "UserName": "myuser",
        "UserId": "DFG87DFG87DFGDFG6",
        "Arn": "arn:aws:iam::111111111111:user/myuser",
        "CreateDate": "2023-04-23T12:26:53+00:00"
profile picture
answered 2 months ago
profile picture
reviewed 2 months 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.

Guidelines for Answering Questions