Skip to content

Instantly share code, notes, and snippets.

@achantavy
Created June 16, 2023 19:31
Show Gist options
  • Select an option

  • Save achantavy/7b593f5539271f2df2f7b79b5f04a812 to your computer and use it in GitHub Desktop.

Select an option

Save achantavy/7b593f5539271f2df2f7b79b5f04a812 to your computer and use it in GitHub Desktop.
Find dangling elastic IPs with cartography
// github.com/lyft/cartography
// Get all A records
MATCH (dns:AWSDNSRecord{type:"A"})
// See which ones map to EIPs that are in our inventory
OPTIONAL MATCH (e:ElasticIPAddress{id: dns.value})
// Do some data massaging, variable renaming
WITH dns.name AS dns_name, dns.value AS dns_value, e.id AS eip
// Return only DNS names that **don't** map back to an EIP that we know about
WHERE eip IS NULL
RETURN dns_name, dns_value, eip ORDER BY dns_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment