{"id":16111797,"url":"https://github.com/cliffano/awstaga","last_synced_at":"2025-06-18T17:37:43.311Z","repository":{"id":177753530,"uuid":"643811340","full_name":"cliffano/awstaga","owner":"cliffano","description":"Python CLI for batch tagging AWS resources","archived":false,"fork":false,"pushed_at":"2025-06-08T01:21:45.000Z","size":1053,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-08T02:35:04.906Z","etag":null,"topics":["aws","cli","python","tagging"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cliffano.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-22T07:54:58.000Z","updated_at":"2025-06-08T01:09:10.000Z","dependencies_parsed_at":"2023-10-16T20:58:21.322Z","dependency_job_id":"d17b815b-0b78-47f8-86b5-cdeee70255d3","html_url":"https://github.com/cliffano/awstaga","commit_stats":null,"previous_names":["cliffano/awstaga"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/cliffano/awstaga","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fawstaga","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fawstaga/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fawstaga/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fawstaga/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cliffano","download_url":"https://codeload.github.com/cliffano/awstaga/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fawstaga/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260600245,"owners_count":23034670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cli","python","tagging"],"created_at":"2024-10-09T19:45:33.162Z","updated_at":"2025-06-18T17:37:38.295Z","avatar_url":"https://github.com/cliffano.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg align=\"right\" src=\"https://raw.github.com/cliffano/awstaga/main/avatar.jpg\" alt=\"Avatar\"/\u003e\n\n[![Build Status](https://github.com/cliffano/awstaga/workflows/CI/badge.svg)](https://github.com/cliffano/awstaga/actions?query=workflow%3ACI)\n[![Security Status](https://snyk.io/test/github/cliffano/awstaga/badge.svg)](https://snyk.io/test/github/cliffano/awstaga)\n[![Dependencies Status](https://img.shields.io/librariesio/release/pypi/awstaga)](https://libraries.io/github/cliffano/awstaga)\n[![Published Version](https://img.shields.io/pypi/v/awstaga.svg)](https://pypi.python.org/pypi/awstaga)\n\u003cbr/\u003e\n\nAwstaga\n-------\n\nAwstaga is a Python CLI for batch tagging AWS resources.\n\nThis package is intended as a companion for [AWS Tag Editor](https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging-resources.html). While AWS Tag Editor is useful for tagging multiple resources in one go, it has no easy way to re-run the tagging since you have to use the AWS console UI, and its resource filtering capability is quite limited, making it hard to select resources with-more-than basic logic.\n\nUsing Awstaga, you can easily re-run the resource tagging by running the CLI again. And with its YAML configuration support, it allows you to define multiple tagsets which you can mix and match with the AWS resources. You can construct your own mapping between the resources and the relevant tags and tagsets. You can generate the YAML configuration using your own script, allowing you to construct a more complex filtering logic.\n\nInstallation\n------------\n\n    pip3 install awstaga\n\nUsage\n-----\n\nCreate a configuration file, e.g. `awstaga.yaml`:\n\n    ---\n    tagsets:\n      - name: common\n        tags:\n          - key: CostCentre\n            value: FIN-123\n          - key: Organisation\n            value: World Enterprise\n          - key: Description\n            value: AWS Resource\n      - name: prod\n        tags:\n          - key: EnvType\n            value: prod\n          - key: Availability\n            value: 24x7\n      - name: nonprod\n        tags:\n          - key: EnvType\n            value: non-prod\n          - key: Availability\n            value: on-demand\n    resources:\n      - arn: 'arn:aws:ssm:ap-southeast-2:123456789012:document/high-avail'\n        tags:\n          - key: Description\n            value: High availability SSM document\n        tagsetnames:\n          - common\n          - prod\n      - arn: 'arn:aws:s3:::world-enterprise/development/logo.jpg'\n        tags:\n          - key: Description\n            value: World Enterprise logo\n        tagsetnames:\n          - common\n          - nonprod\n\nAnd then run `awstaga` CLI and pass the configuration file path:\n\n    awstaga --conf-file awstaga.yaml\n\nIt will write the log messages to stdout:\n\n    [awstaga] INFO Loading configuration file awstaga.yaml\n    [awstaga] INFO Loading 3 tagset(s)...\n    [awstaga] INFO Loading 2 resource(s)...\n    [awstaga] INFO Adding resource arn:aws:ssm:ap-southeast-2:123456789012:document/high-avail to a batch with tags {'CostCentre': 'FIN-123', 'Organisation': 'World Enterprise', 'Description': 'AWS Resource', 'EnvType': 'prod', 'Availability': '24x7', 'Description': 'High availability SSM document'}\n    [awstaga] INFO Adding resource arn:aws:s3:::world-enterprise/development/logo.jpg to a batch with tags {'CostCentre': 'FIN-123', 'Organisation': 'World Enterprise', 'Description': 'AWS Resource', 'EnvType': 'prod', 'Availability': '24x7', 'Description': 'World Enterprise logo'}\n\nAnd if the tagging failed (e.g. due to rate exceeded), it will log the following error messages:\n\n    [awstaga] ERROR Failed to apply tags to 1 resource(s):\n    [awstaga] ERROR arn:aws:ssm:ap-southeast-2:123456789012:document/high-avail: 400 - Throttling - Rate exceeded\n    [awstaga] ERROR arn:aws:s3:::world-enterprise/development/logo.jpg: 400 - Throttling - Rate exceeded\n\n### YAML includes\n\nAwstaga supports YAML includes using , so you can split your configuration into multiple files:\n\n    ---\n    tagsets:\n      - !include include.d/tagset.yaml\n    resources: !include include.d/resources.yaml\n\nInclude files should be put under `include.d/`` folder relative to the configuration file.\n\nThe included tagset file `include.d/tagset.yaml`:\n\n    ---\n    name: common\n    tags:\n      - key: CostCentre\n        value: FIN-123\n      - key: Organisation\n        value: World Enterprise\n      - key: Description\n        value: AWS Resource\n\nThe included resources file `include.d/resources.yaml`:\n\n    ---\n    - arn: 'arn:aws:ssm:ap-southeast-2:123456789012:document/high-avail'\n      tags:\n        - key: Description\n          value: High availability SSM document\n      tagsetnames:\n        - common\n        - prod\n    - arn: 'arn:aws:s3:::world-enterprise/development/logo.jpg'\n      tags:\n        - key: Description\n          value: World Enterprise logo\n      tagsetnames:\n        - common\n        - nonprod\n\n### Dry run\n\nYou can also run Awstaga in dry-run mode by adding `--dry-run` flag:\n\n    awstaga --conf-file awstaga.yaml --dry-run\n\nDuring dry-run mode, Awstaga log messages will be labeled with `[dry-run]`:\n\n    [dry-run] [awstaga] INFO Loading configuration file awstaga.yaml\n    [dry-run] [awstaga] INFO Loading 3 tagset(s)...\n    [dry-run] [awstaga] INFO Loading 2 resource(s)...\n    [dry-run] [awstaga] INFO Adding resource arn:aws:ssm:ap-southeast-2:123456789012:document/high-avail to a batch with tags {'CostCentre': 'FIN-123', 'Organisation': 'World Enterprise', 'Description': 'AWS Resource', 'EnvType': 'prod', 'Availability': '24x7', 'Description': 'High availability SSM document'}\n\n### Batch size\n\nIn order to optimise the number of API calls, resources with identical tags are put into batches. By default, the batch size is 5.\nYou can run Awstaga with a custom batch size `--batch-size \u003cnumber\u003e` flag:\n\n    awstaga --conf-file awstaga.yaml --batch-size 10\n\n### Delay\n\nIn order to avoid rate exceeded error, you can run Awstaga with a custom delay `--delay \u003cnumber\u003e` flag:\n\n    awstaga --conf-file awstaga.yaml --delay 5\n\nBy default, the delay is 2 seconds. The delay is applied between each batch of tagging API calls.\n\nPlease note that AWS limits the number of tagging API (`tag_resources`) calls to [maximum of 5 calls per second](https://docs.aws.amazon.com/general/latest/gr/arg.html).\n\nConfiguration\n-------------\n\nThese are the configuration properties that you can use with `awstaga` CLI.\nSome example configuration files are available on [examples](examples) folder.\n\n| Property | Type | Description | Example |\n|----------|------|-------------|---------|\n| `tagsets[]` | Array | A list of one or more tagsets. Any tagset can be associated with any resource, and the resource will include the tags specified in the tagset. | |\n| `tagsets[].name` | String | The name of the tagset. | `common` |\n| `tagsets[].tags[]` | Array | A list of one or more key-value pair tags within the tagset. | |\n| `tagsets[].tags[].key` | String | The tag key. | `CostCentre` |\n| `tagsets[].tags[].value` | String | The tag value. | `FIN-123` |\n| `resources[]` | Array | A list of one or more AWS resources. Each of the resource has a corresponding list of tags, along with the tags from tagsets. | |\n| `resources[].arn` | String | AWS resource [ARN](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html). | `arn:aws:s3:::world-enterprise/development/logo.jpg` |\n| `resources[].tags[]` | Array | A list of one or more key-value pair tags of the resource. | |\n| `resources[].tags[].key` | String | The tag key. | `Description` |\n| `resources[].tags[].value` | String | The tag value. | `Some description` |\n| `resources[].tagsetnames[]` | Array | A list of one or more tagset names. All tags within the tagsets specified are included in the resource. | |\n\nPermissions\n-----------\n\nThe AWS credentials used to run `awstaga` CLI must have [the following permissions](https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-prereqs.html):\n\n* Permission to use AWS Resource Groups API\n* Permission to tag resources for individual AWS services that you want to tag\n\nColophon\n--------\n\n[Developer's Guide](https://cliffano.github.io/developers_guide.html#python)\n\nBuild reports:\n\n* [Lint report](https://cliffano.github.io/awstaga/lint/pylint/index.html)\n* [Code complexity report](https://cliffano.github.io/awstaga/complexity/wily/index.html)\n* [Unit tests report](https://cliffano.github.io/awstaga/test/pytest/index.html)\n* [Test coverage report](https://cliffano.github.io/awstaga/coverage/coverage/index.html)\n* [Integration tests report](https://cliffano.github.io/awstaga/test-integration/pytest/index.html)\n* [API Documentation](https://cliffano.github.io/awstaga/doc/sphinx/index.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcliffano%2Fawstaga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcliffano%2Fawstaga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcliffano%2Fawstaga/lists"}