question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

filter to find ec2 instance with an empty tag value.

See original GitHub issue

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:aws:autoscaling:groupName": absent
    - or:
        - "tag:Test_Tagcc": empty
  actions:
     - stop

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kapiltcommented, Jul 31, 2018

"tag:Test_Tagcc": not-null

0reactions
kapiltcommented, Jan 13, 2019

empty for finding null values, not-null for finding resources with any value (but not empty strings)

Read more comments on GitHub >

github_iconTop Results From Across the Web

List and filter your resources - Amazon Elastic Compute Cloud
When searching by tag, you can use the following values: (empty) – Find all resources with the specified tag key, but there must...
Read more >
python - Trying to Filter on 'Not tagged' AND 'Empty value' EC2 ...
Just use describe_instances() to list all the tags, running state and build control from there.
Read more >
How to filter an instance based on empty tag value?? - Google Groups
Hi All, I am trying to find out the instance which have "Test_Tagcc" tag and having no values. Below is the policy. Can...
Read more >
How to use the AWS CLI to find untagged instances -
Use the AWS CLI to find instances without a Name tag · The –Query Parameter, JMESPath, and filtering · Why search for untagged...
Read more >
How to Use AWS CLI to Find Untagged Instances - Onica
Using Amazon Web Services Command Line Interface (AWS CLI) to Find Instances without a 'Name' Tag · The --Query Parameter, JMESPath and filtering....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found