Skip to content

Instantly share code, notes, and snippets.

@JohnTheodore
Created September 11, 2017 20:19
Show Gist options
  • Save JohnTheodore/033c8a9da9ec754d4e74af63b246559c to your computer and use it in GitHub Desktop.
Save JohnTheodore/033c8a9da9ec754d4e74af63b246559c to your computer and use it in GitHub Desktop.
policies:
- name: ec2-tag-noncompliance-mark-shutdown
resource: ec2
comments: |
Schedule a resource that does not meet tag compliance policies
to be stopped in 5 days.
filters:
- State.Name: running
- "tag:aws:autoscaling:groupName": absent
- "tag:auto:custodian:maid-status": absent
- "tag:BusinessUnit": absent
- "tag:Environment": absent
- "tag:CostCenter": absent
- "tag:ProductLine": absent
- "tag:AppName": absent
- "tag:OwnerEmail": absent
actions:
- type: notify
template_format: html
email_ldap_username_manager: True
template: /custodian/email/jinja_template.j2
subject: "URGENT: Your AWS EC2 Resources will be shutdown in 5 days!"
to:
- resource-owner
- ldap_uid_tags
- [email protected]
transport:
type: sqs
queue: https://sqs.us-east-1.amazonaws.com/12345/cloudcustodian-mailer
- type: mark-for-op
tag: auto:custodian:maid-status
op: stop
days: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment