利用custodian实现自动修复
Cloud Custodian
安装Cloud Custodian
编写策略
部署策略
最后更新于
最后更新于
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.ymlcustodian run -s out --region all policy.yml