nccgroup / aws-inventory

Discover resources created in an AWS account.
Apache License 2.0
707 stars 128 forks source link

does not inventory gov cloud regions #20

Open khyberkanwar opened 5 years ago

khyberkanwar commented 5 years ago

I tried to inventory AWS Gov Cloud regions using this tool, however, the tool was not recognizing US GovCloud regions of (us-gov-east-1 and us-gov-west-1).

The problem stems from get_available_regions() call on the session object. By default, it only returns AWS public regions. In order for it to return GovCloud regions (or for that matter China regions), a second argument named partition_name has to be passed in for boto3 to return GovCloud regions list.

I made the brute force change below to get this tool to work with GovCloud accounts.

Modified File: aws-inventory.py

Changed the following line from: available_regions = frozenset(boto_session.get_available_regions(svc_name)) to: available_regions = frozenset(boto_session.get_available_regions(svc_name, 'aws-us-gov'))

Similar type of change will be needed to inventory accounts that have resources in AWS China regions.

Thanks. Khalid

ncc-erik-steringer commented 4 years ago

Cleaning out issues. It looks like the steps I need to take here are:

ncc-erik-steringer commented 4 years ago

@khyberkanwar , I just pushed 7691936318c73dc70c0216f3092813cd5e195a18 in the develop branch. Any chance you could pull and review?

And, for anyone with eyes on this that has access to AWS GovCloud or AWS China, please take a shot with that commit and let me know if it works.