Created
June 16, 2023 19:31
-
-
Save achantavy/7b593f5539271f2df2f7b79b5f04a812 to your computer and use it in GitHub Desktop.
Find dangling elastic IPs with cartography
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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