为S3存储桶自动打标签

S3存储桶

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

policies:

- name: s3-tag-compliance-mark
  resource: s3
  comment: |
    Find all s3 buckets 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

最后更新于