Replies: 7 comments 1 reply
-
I think what your looking for would be an enhancement to allow the value filter to match against execution variables. so the us-east-1 .. alternatively it would be nice if we can inject a normalized region value into the bucket so this is a bit simpler to express, instead of trying to match the default api value here and special casing us-east-1. |
Beta Was this translation helpful? Give feedback.
-
@kapilt I'm happy to look into this deeper but I'm not familiar with the code. Any suggestions where I would start to add this type of functionality? |
Beta Was this translation helpful? Give feedback.
-
@kapilt any suggestions for where I could start to code this type of feature enhancement? |
Beta Was this translation helpful? Give feedback.
-
We got a question about this in Gitter today. I think the recap is that we can make a filter that "works" today but is pretty awkward because of the way the S3 API reflects us-east-1 (null) and eu-west-1 (EU):
We already do some location normalization here - perhaps we could use that to add a normalized region column like |
Beta Was this translation helpful? Give feedback.
-
I think the challenge has always been how to make it backwards compatible, or if we need to make some sort of v2 resource, or maybe just a specialized location filter. |
Beta Was this translation helpful? Give feedback.
-
Ah maybe a special filter is better 🤔 . I was thinking If we added a new |
Beta Was this translation helpful? Give feedback.
-
Thanks @ajkerrigan for providing the solution, it works!!!!! |
Beta Was this translation helpful? Give feedback.
-
Howdy! I want to run a simple "custodian run" command against untagged S3 resources in all AWS regions, but filter on the buckets that actually exist in that particular region. (e.g. when I
run
in us-east-1, I only want to work with untagged S3 resources that live in us-east-1; when Irun
in us-east-2, I only want to work with untagged S3 resources that live in us-east-2; etc.) I can get this filter to work for all regions except us-east-1 and need help building a filter string that works for all regions, including us-east-1. What would an appropriate policy filter look like that saysshow me any resources where "tag:Name" is absent and the bucket's Location.LocationConstraint value is the current region "{region}" (e.g. us-east-1, us-east-2, us-west-1, us-west-2, etc.)
?Here's the command I'm running:
My policy file that works for all regions except us-east-1 is this:
With Kapil's help on gitter (thank you, Kapil!) I know that us-east-1 is a bit special - it shows up as
null
instead ofus-east-1
in custodian's output.I tried this policy file:
But that defeats the purpose of the Location.LocationConstraint filter I was working towards (e.g. it returns every bucket for every region, rather than only the buckets that exist in the particular region I'm iterating over).
I tried this policy file:
But that doesn't return any results for us-east-1. (I assume something in my
and
filter is incorrect.)Based on the JMESPath tutorials, I tried this policy file:
But that returns the error:
I feel like I'm missing something with the JMESPath string but can't figure it out. Any help would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions