This is a simple python script to create and remove aws-tag for any resource in a particular AWS region. Configuration file and Information file are the two file where user have to define the aws details. In configuration file we need to mention region,access-key,secret-key,operation (add or remove the give tags) and information file. In information file, we have to define the resource and tagging details.
Dependecy : boto, python2.7
It contains information for aws and file name. Operation is a keyword where we have to mention, whether you need to remove or add the tags to resource
Each line should have one value,
- Region should be specified with variable 'region', single colon ':', region value.
- Access key should be specified with variable 'ak', single colon ":" , accesskey value.
- Secret key should be specified with variable 'sk', single colon ":" , secretkey value.
- Filename should be specified with variable 'filename', single colon ":" , filename value.
- Operation should be specified with variable 'operation', single colon ":", add or remove, here we have to mention whether we need to add or remove the tags in aws.
#Please refer the sample config file given in repository
Values should be stored in a manner that scripts should understand. Line starting with '#' symbol are treated as comment.
Values should be given in below format:
- res-id,tag-key:tag-value,tag1-key:tag1-value,tag2-key:tag2-value,... ,tag10-key:tag10-value
- Resource-id should be given first then tag values related to the resource id, all are seperated by comma.
- Every tagkey and tag value should be seperated by colon
- Each tag-key-value pair are seperated by comma.
Main Script file is awstag.py, which depends on a config file where you specify the aws and file details
- Create a text file where you have to store res-id and tagging values.
- Create a config file, here we have to mention the aws details, what operation you need to do and file path where tagging and resource id is mentioned
- Run the python script
$ python awstag.py
##############################################################
#Config file should be in same folder where the python script is there
#Config should contain aws region, aws credential details and tagging information filename
#########################################################
Enter the config file-name :
- It will prompt for config file like above
All resource id will be tagged
#eNjoy tagging