Last active
September 12, 2019 15:42
-
-
Save jtroberts83/85d0b432491b73fcc80f82ea0e82b322 to your computer and use it in GitHub Desktop.
Terminate EC2s launch with public IP
This file contains 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
- name: no-ec2-public-ips-realtime | |
resource: ec2 | |
description: | | |
If a EC2 instance is launched with a public IP attached initially | |
it will get terminated. | |
mode: | |
type: cloudtrail | |
events: | |
- RunInstances | |
filters: | |
- type: event | |
key: "detail.requestParameters.networkInterfaceSet.items[0].associatePublicIpAddress" | |
value: true | |
actions: | |
- type: terminate | |
force: true | |
- name: ec2-find-existing-public-ips | |
resource: ec2 | |
description: | | |
If a EC2 instance has a public IP attached, take some action. | |
filters: | |
- "PublicIpAddress": present | |
actions: | |
<DO SOMETHING HERE> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment