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

does not inventory gov cloud regions #20

Open
khyberkanwar opened this issue Feb 21, 2019 · 2 comments
Open

does not inventory gov cloud regions #20

khyberkanwar opened this issue Feb 21, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@khyberkanwar
Copy link

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

@bitsandsalsa bitsandsalsa added the enhancement New feature or request label Mar 16, 2019
@ncc-erik-steringer
Copy link
Collaborator

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

  • Add a --partition option to the tool for AWS GovCloud/China support. Maybe allow the choices aws-us-gov and aws-cn ?
  • Feed the partition option, if set, to get_available_regions
  • Verify it works.

@ncc-erik-steringer
Copy link
Collaborator

ncc-erik-steringer commented Sep 9, 2020

@khyberkanwar , I just pushed 7691936 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.

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

No branches or pull requests

3 participants