Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Region selection for trailscraper select #232

Open
be-rock opened this issue Dec 8, 2021 · 3 comments
Open

Region selection for trailscraper select #232

be-rock opened this issue Dec 8, 2021 · 3 comments

Comments

@be-rock
Copy link

be-rock commented Dec 8, 2021

Hi,

Thanks for this great library. What is the best way to set this up? I am running from an ec2 instance with an instance profile that has access to the cloudtrail api but seeing:

trailscraper select --use-cloudtrail-api \ 
                      --filter-assumed-role-arn my-assumed-role \ 
                      --from 'one hour ago' \ 
                      --to 'now'
...
(large python stacktrace trimmed)
botocore.exceptions.NoRegionError: You must specify a region.

It does not look like there is a region option with trailscraper select --help.

Thanks again.

@be-rock be-rock changed the title Region selection for select Region selection for trailscraper select Dec 8, 2021
@flosell
Copy link
Owner

flosell commented Dec 8, 2021

Hi @be-rock,

thanks for raising this, I've reproduced the issue, looks like this is happening if you don't have a default region set (this is to be expected on an EC2 instance but maybe not in most interactive environments where I normally test :)).
It is indeed a bit unintuitive and should probably be fixed by hardcoding a region (assuming that CloudTrail is a global API, need to double check this before implementing anything).

In the meantime, you can work around this by setting a default region through the AWS_DEFAULT_REGION environment variable, e.g.

$ AWS_DEFAULT_REGION=us-east-1 trailscraper select --use-cloudtrail-api \
                      --filter-assumed-role-arn my-assumed-role \
                      --from 'one hour ago' \
                      --to 'now'

@be-rock
Copy link
Author

be-rock commented Dec 8, 2021

Thanks @flosell for the prompt response and thorough feedback, that does indeed do it. Such a simple solution, thanks again!!

@be-rock be-rock closed this as completed Dec 10, 2021
@flosell
Copy link
Owner

flosell commented Dec 10, 2021

Reopening this to find a more permanent fix for this (and make the workaround easier to find for others)

@flosell flosell reopened this Dec 10, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants