Two Tales of Sexual Abuse

Two relatives and I were unjustly accused of molesting three girls when we were in our late teens. We were accused and confronted in front of some other relatives. I was sexually molested by a woman…


Efficiently Tagging AWS Resources Using CLI to Better Manage Resources and Billing Costs

When organizations have large workloads based on on a multitude of AWS services, they may lose track of how resources are being used. In a nutshell, identifying resources can take rigorous effort. On AWS, utilization and cost go hand in hand and tagging helps ensure that the resources are managed efficiently. In fact, one could also build insightful reports/dashboards with the tags in place.

Tagging Strategy:

For tags to be effective at scale they need to be strategically managed. Many organizations group tags into different categories like technical, business, security and automation, etc. A typical set of tags could be:

As of this writing, there is no CLI command to list all untagged resources. One could follow the below steps to get the list.

Step1: List all the resources in AWS and write them to a text file

&>> appends the output of the command to resourcesList.txt file in the current working directory.

The output of the above command is a JSON object that looks like this:

Now, one could either use multiple selection (ctrl+d) in Sublime or a python script to extract the list of resource ARN/names.

Step2: Iterate this list of resource names, and fetch tagging details for all of them & append the output of these commands to a file.

The output of the above command is also a JSON object:

As you can see there is no name attribute here so, we add the resource name before command output using echo:

Let us say, the resource names we have got in resourcesList.txt are as follows:

Creating commands for the above resources in sublime:

Step3: Extract resources with no tags from the tagsList.txt file.

Untagged = all — tagged

From the resourcesList.txt we get all the resource names, and from the tagsList.txt we get all tagged resources. You could use both these lists to get the untagged resources.

Step4: Preparing and updating the tags

Create multiple commands for each resource name with the above template.

Once you create all the commands just copy and paste them in the terminal. That would update all the resources with new tags.

This is pretty much the steps involved in tagging resources, maybe a few tweaks have to be made depending on the AWS service.

Note: Output of all the above commands are executed with the default region-name specified in the AWS CLI profile unless specified in the command.

I hope it was helpful. For any queries or if you know a better way of tagging let us know in the comment section. Happy to discuss it further.


This story is authored by Koushik. Koushik is a software engineer and a keen data science and machine learning enthusiast.

Add a comment

Related posts:

The SpankChain Auction is Now Complete

The SpankChain global token sale event is now complete! We were overwhelmed by the show of support and interest from the community and are happy to announce that we have now distributed 300,043,386… Read more

South Korea Plans Imposing Capital Gain Tax of Cryptocurrencies

South Korea has declared that from next year it will be introducing new measures to impose taxes on cryptocurrency holdings. Read here the entire cryptocurrency news story. Read more

Your House Wears a Newfound Look by a Good Painting Company

We are a happy family of Browns living Lithonia GA. Our family settled in this town when my granddad migrated from Ireland in early 70’s and chose Washington then finally this place because of some… Read more