Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Terminate EC2s launch with public IP
- 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
You can’t perform that action at this time.