Skip to content

Instantly share code, notes, and snippets.

@jc1518
Last active September 1, 2022 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jc1518/ae4dc26e8e29613380cb9fa37b3df6c1 to your computer and use it in GitHub Desktop.
Save jc1518/ae4dc26e8e29613380cb9fa37b3df6c1 to your computer and use it in GitHub Desktop.
AWS config query sample - get ec2 instances with public IP address
SELECT
accountId,
configuration.instancdId,
configuration.publicIp,
configuration.ipv6Addresses
WHERE
resourceType = 'AWS::EC2::Instance'
AND (
configuration.publicIp BETWEEN '0.0.0.0'
AND '255.255.255.255'
OR configuration.ipv6Addresses BETWEEN '0:0:0:0:0:0:0:0'
AND 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment