Skip to content

Instantly share code, notes, and snippets.

@JohnTheodore
Created December 20, 2017 00:09
Show Gist options
  • Save JohnTheodore/d16e96eb0e8da0e1b7e08a1e06ca96f2 to your computer and use it in GitHub Desktop.
Save JohnTheodore/d16e96eb0e8da0e1b7e08a1e06ca96f2 to your computer and use it in GitHub Desktop.
policies:
- name: ec2-unmark-event
resource: ec2
mode:
type: periodic
role: arn:aws:iam::{account_id}:role/custodian-auto-tag-lambda
schedule: rate(1 day)
filters:
- type: marked-for-op
tag: auto:event
op: unmark
actions:
- type: unmark
tags: ['auto:event']
- name: ec2-email-about-scheduled-maintenance
resource: ec2
mode:
type: periodic
role: arn:aws:iam::{account_id}:role/custodian-auto-tag-lambda
schedule: rate(1 day)
filters:
- and:
- tag:auto:event: absent
- type: health-event
statuses:
- upcoming
- open
types:
- AWS_EC2_API_ISSUE
- AWS_EC2_BILLING_NOTIFICATION
- AWS_EC2_CLASSIC_NETWORK_HEALTH_INTERNET_ISSUE
- AWS_EC2_CLASSIC_NETWORK_HEALTH_INTER_AZ_ISSUE
- AWS_EC2_CLASSIC_NETWORK_HEALTH_INTRA_AZ_ISSUE
- AWS_EC2_DEDICATED_HOST_NETWORK_MAINTENANCE_SCHEDULED
- AWS_EC2_DEDICATED_HOST_POWER_MAINTENANCE_SCHEDULED
- AWS_EC2_DEDICATED_HOST_RETIREMENT_SCHEDULED
- AWS_EC2_DEDICATED_HOST_UNDER_RESERVATION_REPLACE
- AWS_EC2_DNS_RESOLUTION_ISSUE
- AWS_EC2_INSTANCE_AUTO_RECOVERY_FAILURE
- AWS_EC2_INSTANCE_AUTO_RECOVERY_NO_ACTION
- AWS_EC2_INSTANCE_AUTO_RECOVERY_SUCCESS
- AWS_EC2_INSTANCE_NETWORK_MAINTENANCE_SCHEDULED
- AWS_EC2_INSTANCE_POWER_MAINTENANCE_SCHEDULED
- AWS_EC2_INSTANCE_RETIREMENT_EXPEDITED
- AWS_EC2_INSTANCE_RETIREMENT_SCHEDULED
- AWS_EC2_INSTANCE_STORE_DRIVE_PERFORMANCE_DEGRADED
- AWS_EC2_NETWORK_CONNECTIVITY_ISSUE
- AWS_EC2_OPERATIONAL_ISSUE
- AWS_EC2_OPERATIONAL_NOTIFICATION
- AWS_EC2_PERSISTENT_INSTANCE_RETIREMENT_EXPEDITED
- AWS_EC2_PERSISTENT_INSTANCE_RETIREMENT_SCHEDULED
- AWS_EC2_POWER_CONNECTIVITY_ISSUE
- AWS_EC2_RI_MARKETPLACE_BANK_ACCOUNT_UPDATE_REQUIRED
- AWS_EC2_SYSTEM_REBOOT_MAINTENANCE_SCHEDULED
- AWS_EC2_VPC_NETWORK_HEALTH_INTERNET_ISSUE
- AWS_EC2_VPC_NETWORK_HEALTH_INTER_AZ_ISSUE
- AWS_EC2_VPC_NETWORK_HEALTH_INTRA_AZ_ISSUE
actions:
- type: notify
priority_header: '1'
template_format: html
email_ldap_username_manager: True
template: /custodian/email/jinja_template.j2
subject: "{{account}} - {{region}} - AWS EC2 resource(s) has an event!"
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:event
op: unmark
days: 45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment