How to filter an instance based on empty tag value??

90 views
Skip to first unread message

nitin kumar Itare

unread,
Jul 30, 2018, 5:26:16 AM7/30/18
to cloud-custodian

Hi All, I am trying to find out the instance which have "Test_Tagcc" tag and having no values.
Below is the policy. Can you please help me out what is the issue with it.
when i do the dry run it lists all the instances.

policies:

  • name: ec2-tag-compliance
    mode:
    role: arn:aws:iam::{AccountID}:role/CloudCustodian
    type: periodic
    schedule: 'cron(0/5 * * * ? *)'
    resource: ec2
    comment: |
    Find all (non-ASG) instances that are not conformant
    to tagging policies, and stop them.
    filters:
  •   "tag:Test_Tagcc": empty

Kapil Thangavelu

unread,
Aug 25, 2018, 6:44:39 AM8/25/18
to cloud-custodian
if you switch empty to `absent` that will work for this use case. empty is for a tag/key thats present but has no value, like an empty string.  absent is for the lack of a tag/key on a resource.

Cheers,
Kapil
Reply all
Reply to author
Forward
0 new messages