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

ec2:DescribeRegions used even when region is specified #387

Closed
Hermain opened this issue Oct 17, 2024 · 4 comments
Closed

ec2:DescribeRegions used even when region is specified #387

Hermain opened this issue Oct 17, 2024 · 4 comments

Comments

@Hermain
Copy link

Hermain commented Oct 17, 2024

My company denies ec2:DescribeRegions probably in an effort to prevent us from using any other region than the default one.

Now when I run aws-nuke (v3.27.0) with a config like this:

regions:
  - eu-cental-1
blocklist:
  - "999999999999"  
accounts:
  "1111...": {}  
__global__:
  - property: tag:Purpose
    type: "regex"
    value: "^(?!.*(terratest))"
resource-types:
  includes:
    - S3Bucket

I get the following error:
FATA[0001] failed to get regions: UnauthorizedOperation: You are not authorized to perform this operation. User: ----- is not authorized to perform: ec2:DescribeRegions with an explicit deny in a service control policy

Why is describe regions even executed and why ec2 when I only include buckets?
Is there any way around this?

@Hermain
Copy link
Author

Hermain commented Oct 17, 2024

I found the --default-region flag now it works:
aws-nuke run --default-region eu-central-1

@ekristen
Copy link
Owner

It's part of the bootstrap and discovery of the account prior to doing the initial run. I've never heard of blocking that call before, that's strange, it won't prevent you from using another region on it's own.

It is part of an automatic region discovery feature.

@Hermain
Copy link
Author

Hermain commented Oct 22, 2024

Since using the --default-region flag prevents this blocked call and this seems to be very specific to my organisation I'm content and I close the issue.

@Hermain Hermain closed this as completed Oct 22, 2024
@ekristen
Copy link
Owner

That's interesting. @Hermain it seems that perhaps the DescribeRegions is only blocked in specific regions in your accounts as --default-region would have no impact on whether or not DescribeRegions is called or not, but I'm glad that you have it working.

I do think though that I should make it so that we only call that API if all is specified in the regions config, otherwise it is an unnecessary call to be making.

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

No branches or pull requests

2 participants