0

I'm trying to get all associated resource relationship types for a specific EC2. Is it possible to use a wildcard in an AWS config query in the WHERE block with resourceType rather than having to declare each type?

What I am doing that's working:

SELECT
  *
WHERE
  resourceType IN (
    'AWS::EC2::InternetGateway',
    'AWS::EC2::NetworkACL',
    ...

  )
  AND relationships.resourceId = 'foo'

What I want to do, but it returns empty:

SELECT
  *
WHERE
  resourceType IN (
    'AWS::EC2::*'
  )
  AND relationships.resourceId = 'foo'

Have also tried but returns empty:

SELECT
  *
WHERE
  resourceType = 'AWS::EC2::*'
  AND relationships.resourceId = 'foo'
risail
  • 509
  • 5
  • 14
  • 37

2 Answers2

1

The wildcard to use is '%'.

So your example will look like this:

SELECT
  *
WHERE
  resourceType LIKE 'AWS::EC2::%'
  AND relationships.resourceId = 'foo'
playdoz
  • 114
  • 1
  • 7
0

I recommend to use AWS::EC2*.

https://aws.amazon.com/about-aws/whats-new/2022/12/target-multiple-resources-wildcard-configuration-aws-cloudformation-hooks/

Yunnosch
  • 26,130
  • 9
  • 42
  • 54
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – WhatsThePoint Feb 02 '23 at 18:44