Skip to content

Negating a Regex Operation - Help with creating a policy! #8570

Answered by ajkerrigan
gabfelp asked this question in General
Discussion options

You must be logged in to vote

The idea of negating a regex is fine, though regex matches against InstanceId seem unlikely to be useful (you have no control over an instance id, and i-abcd12345 isn't exactly human-readable).

If you have a specific list of resources you want to exclude, something like this is more common:

filters:
  - type: value
    key: InstanceId
    op: not-in
    value:
      - i-12345
      - i-23456
      - i-34567
      - ...

Often using value_from to maintain a skip list outside the policy.

If you're matching based on patterns rather than explicit IDs, you can look for regex patterns the way you mentioned. Maybe you want to skip resources with a certain string in their Name tags:

filters:
  - not

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gabfelp
Comment options

@ajkerrigan
Comment options

Answer selected by gabfelp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants