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

China region not added? #192

Open
AFV-Aon opened this issue Jul 15, 2020 · 8 comments
Open

China region not added? #192

AFV-Aon opened this issue Jul 15, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@AFV-Aon
Copy link

AFV-Aon commented Jul 15, 2020

Tried to update the regions through the latest version of botocore, but cn-north-1 and cn-northwest-1 are not there.

Is there a way to manually add the region to the session? Some modules fail because there is no --region attribute on them.

Thanks!

@sebastian-mora
Copy link
Contributor

Hi, have you tried running the command update_regions from Pacu cli? This will attempt to update boto to the latest version and query available regions/endpoints. Once this is done you can view the imported regions with the regions command. Additionally, you will also need to meet the AWS requirements to access these regions as documented here. 👍

@AFV-Aon
Copy link
Author

AFV-Aon commented Jul 22, 2020

I tried using update_regions command inside pacu framework (I don't think that command works on CLI?), however China region just doesn't show up.

@sebastian-mora
Copy link
Contributor

To confirm the credentials you are using have access to those regions? For those regions, you need an account specifically registered in/by China. Accounts registers outside won't have access to those endpoints.

@AFV-Aon
Copy link
Author

AFV-Aon commented Jul 23, 2020

Yes, the account is hosted on cn-north-1 and cn-northwest-1 (confirmed via AWS console). It's just that update_regions doesn't add those 2 regions.

@sebastian-mora
Copy link
Contributor

Thanks for the additional information. Taking a look at the update_regions() function here and I see it is pulling the regions from the file ./botocore/data/endpoints.json and writing them to the file modules/service_regions.json. While I am not sure why your botocore file does not include these regions I found a reference to the format here . It might be possible to add they regions manually but, I don't have an account with access to those regions to verify.

@sebastian-mora sebastian-mora added bug Something isn't working and removed bug Something isn't working labels Jul 23, 2020
@AFV-Aon
Copy link
Author

AFV-Aon commented Jul 27, 2020

I modified pacu.py update_regions() function manually and added 'aws-cn':

Line 694: if partition['partition'] == 'aws' or partition['partition'] == 'aws-cn':

This actually breaks things like the list command:

Pacu (xxx:No Keys Set) > list

[2020-07-27 11:35:58] Pacu encountered an error while running the previous command. Check sessions/xxx/error_log.txt for technical details. [LOG LEVEL: MINIMAL]

<class 'KeyError'>: 'inspector'

Traceback (most recent call last):
File "pacu.py", line 1561, in run_gui
self.idle()
File "pacu.py", line 1441, in idle
self.idle()
File "pacu.py", line 1441, in idle
self.idle()
File "pacu.py", line 1441, in idle
self.idle()
[Previous line repeated 1 more time]
File "pacu.py", line 1439, in idle
self.parse_command(command)
File "pacu.py", line 457, in parse_command
self.parse_list_command(command)
File "pacu.py", line 578, in parse_list_command
self.list_modules('')
File "pacu.py", line 985, in list_modules
regions += self.get_regions(service)
File "pacu.py", line 220, in get_regions
if type(regions[service]) == dict and regions[service].get('endpoints'):
<class 'KeyError'>: 'inspector'

It would be good to try and fix this code so the china region can be successfully added to a session.

Thanks!

@DaveYesland DaveYesland added the enhancement New feature or request label Mar 18, 2021
@zhujian0805
Copy link

any update for this issue?

@zhujian0805
Copy link

Created a PR for this issue:
#307

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

4 participants