policies:
- name: ec2-tag-compliance-mark
resource: ec2
comment: |
Find all (non-ASG) instances that are not conformant
to tagging policies, and tag them.
filters:
- or:
- "tag:Owner": absent
- "tag:CostCenter": absent
- "tag:Project": absent
actions:
- type: tag
key: Owner
value: Lily Chen
- type: tag
key: Project
value: SOAR
部署策略
# 验证策略是否正确 (note this happens by default on run)
custodian validate ec2-tag-compliance-mark.yml
# 试运行策略 (no actions executed) 查看会影响哪些资源
# match each policy.
custodian run --dryrun -s out ec2-tag-compliance-mark.yml
# 运行策略
custodian run -s out ec2-tag-compliance-mark.yml