Skip to main content

AWS Tag Tools

The Unified Tag Manager for AWS Resources

PyPI - Version PyPI - Python Version PyPI - License Static Badge

awstt

English 简体中文


Overview

AWS Tag Tools (AWSTT) is a powerful and versatile tool designed to manage resource tags of AWS services through a unified operation.

With this tool, you can easily set or unset tags for multiple resources across multiple regions with a single command, or list resources in bulk matching specific tag keys/values and resource attributes (e.g., EC2 instance types).

Features

  • Supports both command-line interface (CLI) and AWS Lambda function.
  • Supports various AWS services, see the detailed list in Supported Services.
  • Supports AWS partitions: 'aws', 'aws-gov', and 'aws-cn'.
  • Use JMESPath expressions to filter or select resources, see Using Selectors.
  • Support using Python expressions for keys or values, see Using Expressions.
  • Option to ignore existing tags or automatically record original values when force overwriting.
  • Automatically record original key/values when unsetting tags.
  • Option to log information to a file.

Usage

Prerequisites

  • Python 3.11 or higher is required.
  • If not explicitly specifying credentials (e.g., AK/SK or profile name), the AWS CLI credential must be configured.
  • IAM role with permissions for the specified AWS services. For example, to add tags to Amazon EC2 instances, you must have the following permissions:
    • ec2:DescribeInstances
    • ec2:CreateTags
    • tag:TagResource

Installation

pip install -U aws-tag-tools

Commands

# Add the tag 'tagged_by=awstt' to any supported resources across all regions
awstt set --tag tagged_by=awstt
# Add two tags 'tagged_by=awstt' and 'owner=AnyIons' to EC2 instances in 'us-east-1' and 'us-west-1' regions
awstt set --tag tagged_by=awstt,owner=AnyIons --region us-east-1,us-west-1 --resource ec2:instance
# Using the AWS CLI credential profile named 'china', unset tags with keys 'tagged_by' and 'owner' from any VPCs in the 'aws-cn' partition
awstt unset --tag tagged_by,owner --resource arn:aws-cn:ec2:*:*:vpc/* --profile china
# Unset tags with key 'owner' from RDS instances with 'Engine' as 'mysql'
awstt unset --tag owner --resource rds:instance --filter spec[?Engine=='mysql']
# List resources created 5 days ago with tag key 'created_at', comparing the value with a dynamic expression
awstt list --filter tags[?key=='created_at' && value < '${(now() + timedelta(days=-5)).strftime('%Y-%m-%d_%H:%M:%S')}']
# Execute operations using a configuration file and AK/SK
awstt exec --config action.json --access_key YOUR_AWS_ACCESS_KEY_ID --access_key YOUR_AWS_SECRET_ACCESS_KEY

Advanced Usage

You can use a JSON configuration file for complex operations, such as adding the tag owner=AnyIons to all resources, but not allowing overwriting existing owner tags on EC2 instances, while also adding the tag env=dev only for RDS resources.

Please refer to action-set-example and action-unset-example.

License

MIT © 2020 AnyIons

Metadata

Release files for aws-tag-tools 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-tag-tools 1.1.1
File Size Uploaded Provenance
aws_tag_tools-1.1.1.tar.gz 27.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-tag-tools 1.1.1
File Interpreter ABI Platform
aws_tag_tools-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 85.7 kB

Release files / aws_tag_tools-1.1.1.tar.gz

Download URL aws_tag_tools-1.1.1.tar.gz
Size 27.9 kB
Tags Source
SHA-256 checksum
How to use checksums
062c7aab83e77280098c30c3542d0e33a29ed25c8e35ad5a8d9b641a4b0fa45f
BLAKE2b-256 checksum
How to use checksums
7bf047218a55542bd4a55e56d8fd470ef3104e3230ed39469239b13b525b9139
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0

Release files / aws_tag_tools-1.1.1-py3-none-any.whl

Download URL aws_tag_tools-1.1.1-py3-none-any.whl
Size 57.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fae9e01da43f30ac5d567620d2e142e07bc9958a39077c75c771923950667e75
BLAKE2b-256 checksum
How to use checksums
3ffac484dab80f17c809783e484237583e0b5bfba546e2f91c355254dddd0d2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0

Security for aws-tag-tools 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page