# 为EC2自动打标签

假设编写的策略名称为ec2-tag-compliance-mark.yml，用于给缺少指定标签的EC2打上标签。此处检查EC2实例缺少标签Owner，CostCenter，Project的其中一个，则自动给打上Owner: Lily Chen, Project:SOAR的标签。

```yaml
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
```
