In our last blog post, we have explained how to tag the EC2, RDS, and S3 in bulk numbers by aws-tagger.
Since this tool won’t support bulk volume/snapshots tagging so we have configured another tool for completing the tagging.
In this blog post, we are going to explain about Volume and Snapshots tagging by this amazing tool called Graffiti Monkey.
The Graffiti Monkey goes around tagging things. By looking at the tags an EC2 instance has, it copies those tags to the EBS Volumes that are attached to it, and then copies those tags to the EBS Snapshots.
- Install graffiti monkey on the EC2 machine.
- Create an IAM user with the access key and secret key to provide permission to graffiti monkey.
- Create the config file(YAML) with all tags details needs to copy to the EC2.
Let’s start the hands-on:
Login to your EC2 Linux machine:
i)First, install pip on the machine.
yum install python-pip
ii)Second, install the graffiti-monkey
pip install graffiti_monkey
- Create the config file (YAML) in the AWS-EC2 machine. (Below is the sample)
- We are going to use the same YAML file here for all the accounts as the tags are common for all of them.
- If you add the new tags in EC2, then you need to add the new tags to this YAML file also as per the requirement.
------region: eu-west-1instance_tags_to_propagate:- ‘Business Unit’- ‘Project’- ‘Customer’- ‘Environment’- ‘Product’- ‘Version’- ‘Requestor’- ‘Revenue_Type’- ‘Business_Model’- ‘Service’volume_tags_to_propagate:- ‘Business Unit’- ‘Project’- ‘Customer’- ‘Environment’- ‘Product’- ‘Version’- ‘Requestor’- ‘Revenue_Type’- ‘Business_Model’- ‘Service’- ‘Name’- ‘instance_id’- ‘device’
- We will create access and secret key for this IAM to provide permission to our EC2 to tag the resources into the account.
- We need to attach the below permission to the IAM user from respective accounts.
- We can attach IAM role also, to the EC2 machine directly for permission.
- Now run the below command from the EC2 machine CLI:
graffiti-monkey --region us-east-1 --config tagging.yaml
Volumes and Snapshot:
I hope this is helpful, please comment below in case of any implementation issues.