I'm new to Cloud Custodian, doing an exploratory install, and I've run into a few issues. I think the answer to all three is variables but they aren't really discussed in the documentation.
1) My cloud custodian reports are going to PagerDuty (e-mail integration) so the alerting mechanism is going to be mostly the same for each policy. I would like to define the alerting parameters like to-address (in one place instead of per policy, or tagging all my AWS resources with addresses, or setting up an ldap server for a handful of addresses.
2) I see that the logging can be done either to cloudwatch, s3, or a local directory. Is there someplace I can specify a default logging configuration so that I don't have to do it for every invocation?
3) I have a number of resource types which I'm expecting a couple tags to be present and set to one of a list of known values. I believe I will need to write a policy for each resource type, but I think I can use a variable to define the tag logic once.
Example welcome - or links to any blogs that explain the variables feature better.
vars:
notify-var: ¬ify-var
- type: notify
to: [email protected]
# more stuff....
policies:
- name: some-policy
resource: ec2
actions:
<<: *notify-var
More info here: https://blog.daemonl.com/2016/02/yaml.html
-l flag each timere 2. people typically have a front end script for the invocation or in their cron job, etc.
@thisisshi @kapilt Thank you both!
I was able to get a configuration working like this:
vars:
notify-var: ¬ify-var
- type: notify
template: default
to:
- test-cloud-custodian@xxx
transport:
type: sqs
queue: https://sqs.us-east-1.amazonaws.com/00000000/c7n-mailer
policies:
- name: c7n-mailer-test
resource: sqs
filters:
- "tag:DummyTag": absent
actions:
- <<: *notify-var
subject: Testing the c7n mailer
Most helpful comment
@thisisshi @kapilt Thank you both!
I was able to get a configuration working like this: