How do I use the AWSSupport-ListEC2Resources Automation runbook to get information for all the EC2 resources in my account?

3 minute read
0

I want to use the AWSSupport-ListEC2Resources runbook by Automation, a capability of AWS Systems Manager, to see information about my Amazon Elastic Compute Cloud (Amazon EC2) instances and related resources for all AWS Regions in my AWS account.

Short description

By default, the AWSSupport-ListEC2Resources runbook gets information about the following resources from all Regions and lists the resource information in the runbook's output:

  • EC2 Auto Scaling groups
  • EC2 instances
  • Elastic IP addresses
  • Network interfaces
  • Elastic Load Balancing (ELB) load balancers
  • Amazon Machine Images (AMIs)
  • Amazon Elastic Block Store (Amazon EBS) volumes
  • EBS volume snapshots

You can store the output in an Amazon Simple Storage Service (Amazon S3) bucket, and upload it as a .csv file.

Resolution

Prerequisites

Before you start the runbook, make sure that your AWS Identify and Access Management (IAM) user or role has the required permissions. For more information, see Required IAM permissions.

Run the AWSSupport-ListEC2Resources runbook

  1. Open the AWSSupport-ListEC2Resources runbook.
  2. Choose Execute automation.
  3. Enter the following input parameters:
    • AutomationAssumeRole (optional): Enter the ARN of the IAM role that allows Automation to perform actions for you. If a role isn't specified, then Automation uses the permissions of the user that starts the runbook.
    • S3 Bucket (optional): Enter the name of the S3 bucket where you uploaded the information.
    • DisplayResourceDeletionDocumentation (optional): If this parameter is set to true, then the runbook creates links in the output that take you to documentation on how to delete resources.
    • RegionsToQuery (optional): By default, all Regions are selected. However, you can choose specific Regions that you want to get Amazon EC2 related information from.
  4. Choose Execute. The runbook performs the following steps and gets information for your account and the Regions that you specify:
    • aws:executeAwsApi: Gets the Regions that you turned on for your account.
    • aws:executeScript: Confirms that the Regions for your account support the Regions that you specified in the RegionsToQuery: parameter.
    • aws:branch: If you didn't turn on Regions for your account, then the runbook ends.
    • aws:executeScript: Lists all EC2 instances.
    • aws:executeScript: Lists all AMIs.
    • aws:executeScript: Lists all EBS volumes.
    • aws:executeScript: Lists all Elastic IP addresses.
    • aws:executeScript: Lists all elastic network interfaces.
    • aws:executeScript: Lists all Auto Scaling groups.
    • aws:executeScript: Lists all load balancers.
    • aws:executeScript: If you listed a bucket in the Bucket parameter, then the runbook uploads the information to the S3 bucket.
  5. After the runbook completes, check the details of all the listed resources in the runbook's Output section. If you specified an S3 bucket, then you see a .csv file in the S3 bucket.

Note: To help you troubleshoot, manage, and reduce costs on your AWS resources, AWS Support maintains a subset of the Systems Manager provided predefined runbooks. These runbooks are prefixed with "AWSSupport-" or "AWSPremiumSupport-".

Related information

Run an automation

Setting up Automation

AWS OFFICIAL
AWS OFFICIALUpdated 9 months ago