Giter Site home page Giter Site logo

mpostument / awstaghelper Goto Github PK

View Code? Open in Web Editor NEW
151.0 151.0 17.0 1.7 MB

AWS bulk tagging tool

License: Apache License 2.0

Go 99.72% Dockerfile 0.28%
aws cloud cloud-computing cloud-engineering costs devops devops-tools ec2 lambda rds s3 security tagging-tool taggingtools

awstaghelper's Introduction

Hi there ๐Ÿ‘‹

๐Ÿ‘ท Check out what I'm currently working on

๐Ÿ”ญ Latest releases I've contributed to

๐Ÿ“œ My recent blog posts

๐Ÿ“ซ How to reach me

awstaghelper's People

Contributors

cristim avatar dependabot[bot] avatar mpostument avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

awstaghelper's Issues

Feature Request : Tagging support for IAM users and Roles

Hey Team

First of all , good work on the tool. Its really nice to have such a user friendly and simple CSV based tag compliance checker and remediation tool.
I have a use case for tagging IAM Users and Roles for security compliance purposes and recording the type of user (Human / Service User) etc ... !!

It would be nice to have the support for IAM Users and Roles as well !!

Thanks

Feature Request: Support for getting all Tags for a resource (Accross all services)

I currently have a use case , where some resources (especially S3 and EC2 in my case) have various tags associated which may have typos and may be non-compliant.

Having a complete tag list for all resources will solve three main issues:-

  1. Visibility across all types of tagging keys across .
  2. Determining the possible tag filters one may use in her / his environment.

This would be really helpful. However csv structure cannot be predetermined. Possible ways could be to dump raw json response in cache and normalize it and then write it to csv.

Dont tag if value is empty string

Right now, if there is a column in the CSV without a value (i.e. empty string), awstaghelper will still go and create that tag.

It would be great if that's not done or its made optional on the CLI.

Feature Request : Support for renaming and deleting Tags from resources

Currently based on my experimentation , I could understand that modifying an existing value of a tag key and adding a new tag is possible.

However, deletion and renaming of tags cannot be done. It would be great to have such a support.

I have proposed a possible solution below:-

The column Names can be suffixed with a keyword like (:DELETE) or (:RENAME). Check the example below

Example :-

Before :-

Id Name Environment
i-123 Staging
i-345 IAmNames Prod

After :-

Id Name(: RENAME : "Names" : [ ALL_WITH_TAG, "CHAR:*" ] ) Environment(: DELETE : ["CHAR:$"] ) (: MARKER )
i-123 Staging $,*
i-345 IAmNames Prod *

In the above column , it follows the following fashion

i) For RENAME:

<Key>(:RENAME:"\<NewKey\>":[ALL_WITH_TAG, "CHAR:*" ]) - means rename existing key <Key> to <NewKey> for all resource listed below where the key exists and holds values and also the ones marked with * in the :MARKER column.

ii) For DELETE :
(:DELETE:<marker_value>) - means delete the tag Environment for all resources where the new (:MARKER) column is marked with <marker_value> , in above case $. Notice the difference in table in both cases.

So generically , it can be of following nature. Any new action on a key can be suffixed with a bracket (which would mostly not be used in tag keys in normal situation) followed by an action (like RENAME, DELETE). Followed by it's arguments and at last the markers.

RENAME needs an argument of new Key whereas DELETE does not.

Every ACTION requires a marker which tells it to which resource it applies to. Markers can be the last argument to all actions. All in between actions can be other arguments.

Markers could be array [] , where multiple marking criteria can be defined, like the one used for RENAME above.

Possible markers can be:-

i. ALL - Applies to all even if the resource does not have that tag present. In case of RENAME for value , a dummy value (such as an empty string) can be added. 
ii. ALL_WITH_TAG - Applies to all resources with that particular tag present
iii. "CHAR:<any_char_marker>" - Applies to all resource where that field has been marked by char marker in (:MARKER) column. This would require a separate (:MARKER) column. Having an option to give any char is necessary. If delete also needs to be done at the same time. So two different char markers for each can be plotted in (:MARKER) column.
iv. "REGEX:"<csv_column>":<any_valid_regex_marker>" - Apples to all resource whose concerned column's value matches the provided regex marker. Having column here helps to have it as a condition to match against any attribute of the resource in csv. 

The above solution is just an idea that I thought, which could be one of the ways to implement this through csv. Thought of putting it here in case it helps. Feel free to ignore if you don't see much value.

However, if this feature is implemented, it will be really helpful if used along with #15 to remediate compliance and other issues in one's account and understand one's tag structure across.

Error when specifying a different profile

I'm receiving the following error when I attempt to specify an assumed role profile instead of the default credentials

โžœ awstaghelper_0.15.0_Darwin_x86_64 ./awstaghelper cloudwatch get-cwlog-tags -f cloudwatch_logs_tags_dev.csv -r us-west-2 -t Name,Product,Purpose,Env,Region -p dev
2020/09/10 12:18:17 Not able to get log groupsNoCredentialProviders: no valid providers in chain. Deprecated.
	For verbose messaging see aws.Config.CredentialsChainVerboseErrors

Access/Permissions with MFA

awstaghelper ec2 get-ec2-tags --filename ec2Tag.csv --tags Name,Owner -p "dev-mfa"
2021/05/27 12:08:40 Not able to get EC2 instances UnauthorizedOperation: You are not authorized to perform this operation.
status code: 403, request id: 81d00a8b-1e11-4e3b-a23f-730b31d03fdd

Config File:
5 โ”‚ [dev-mfa]
6 โ”‚ region = us-east-1
7 โ”‚ output = txt
8 โ”‚
9 โ”‚ [profile dev-mfa]
10 โ”‚ region = us-east-1
11 โ”‚ output = txt
12 โ”‚ AWS_SECRET_ACCESS_KEY
13 โ”‚ AWS_ACCESS_KEY_ID =
14 โ”‚ AWS_SESSION_TOKEN =

Stop using deprecated methods

Replace deprecated methods with new one

  Error: SA1019: cloudwatchlogs.ListTagsLogGroupInput is deprecated: Please use the generic tagging API model ListTagsForResourceRequest and ListTagsForResourceResponse  (staticcheck)
  Error: SA1019: cloudwatchlogs.TagLogGroupInput is deprecated: Please use the generic tagging API model TagResourceRequest  (staticcheck)
  Error: SA1019: cloudwatchlogs.ListTagsLogGroupOutput is deprecated: Please use the generic tagging API model ListTagsForResourceRequest and ListTagsForResourceResponse  (staticcheck)
  Error: SA1019: cloudwatchlogs.ListTagsLogGroupInput is deprecated: Please use the generic tagging API model ListTagsForResourceRequest and ListTagsForResourceResponse  (staticcheck)
  Error: SA1019: cloudwatchlogs.ListTagsLogGroupOutput is deprecated: Please use the generic tagging API model ListTagsForResourceRequest and ListTagsForResourceResponse  (staticcheck)

Example of tag-s3

Can someone provide a working example (csv file) of tag-s3? I was getting SignatureDoesNotMatch error. access key and secret access key are both okay. Not sure if I got the csv format wrong that resulted in the error.

โฏ awstaghelper s3 tag-s3 --filename awstaghelper.csv
SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.
status code: 403

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.