Skip to main content

An AWS Tag-Based Operations Tool for safe and efficient resource management.

Project description

TagOps: AWS Tag-Based Resource Management

████████╗  █████╗   ██████╗  ██████╗ ██████╗ ███████╗
╚══██╔══╝ ██╔══██╗ ██╔════╝ ██╔═══██╗██╔══██╗██╔════╝
   ██║    ███████║ ██║  ███╗██║   ██║██████╔╝███████╗
   ██║    ██╔══██║ ██║   ██║██║   ██║██╔═══╝ ╚════██║
   ██║    ██║  ██║ ╚██████╔╝╚██████╔╝██║     ███████║
   ╚═╝    ╚═╝  ╚═╝  ╚═════╝  ╚═════╝ ╚═╝     ╚══════╝

AWS Tag-Based Operations Tool - Safe and Efficient Resource Management


Overview

TagOps is a powerful command-line interface (CLI) tool designed to simplify the management of AWS resources by leveraging tags. Instead of manually hunting for resources across different regions, you can specify a tag key and value, and TagOps will find all associated resources and allow you to perform bulk actions on them safely and efficiently.

This tool is perfect for developers, DevOps engineers, and cloud administrators who manage dynamic environments (like development, staging, or project-based infrastructure) where resources are frequently created and destroyed. It helps prevent orphaned resources and control costs by providing a unified entry point for managing the lifecycle of tagged infrastructure.

Features

  • Tag-Based Discovery: Scans all AWS regions to find resources matching a specified tag.
  • Bulk Actions: Perform Start, Stop, and Terminate operations on all discovered resources at once.
  • Associated Resource Management: Intelligently discovers and manages resources associated with a primary resource (e.g., EIPs, EBS Volumes, Security Groups attached to an EC2 instance).
  • Interactive & Safe: Displays a clear execution plan and requires user confirmation before making any changes to your infrastructure.
  • Smart Cleanup: On termination, TagOps attempts to clean up associated components like volumes and network interfaces to prevent leftover resources.
  • Protection Aware: Automatically detects and skips instances with Stop or Termination protection enabled, preventing accidental shutdowns of critical infrastructure.
  • Rich CLI Output: Uses modern, readable tables to display discovered resources and their status.

How It Works

TagOps operates in a three-phase process:

  1. Discovery: The tool iterates through all available AWS regions, scanning for primary resources (like EC2 instances and ASGs) that have the specific tag you provided.
  2. Enrichment: For each discovered resource, TagOps makes additional API calls to find and list all its associated resources. This includes volumes, security groups, EIPs, key pairs, and more, giving you a complete picture of the resource stack.
  3. Action & Execution: After you select an action (Start, Stop, Terminate), the tool generates a detailed plan. Once you approve the plan, TagOps executes the necessary Boto3 API calls to perform the action and any subsequent cleanup tasks.

Supported Resources

TagOps currently provides primary support for the following AWS services:

  • Amazon EC2 Instances
  • Amazon Auto Scaling Groups (ASGs)

It will also discover and manage the following associated resources:

  • Elastic IP Addresses (EIPs)
  • EBS Volumes
  • Security Groups (SGs)
  • EC2 Key Pairs
  • Elastic Network Interfaces (ENIs)
  • EBS Snapshots

Prerequisites

Before using TagOps, ensure you have the following:

  • Python 3.x installed.
  • AWS Credentials configured in your environment. The tool uses the standard Boto3 credential discovery process (e.g., via ~/.aws/credentials, environment variables, or IAM roles). You need permissions to describe and manage the supported resources.

Installation

  1. Clone the repository:

    git clone https://github.com/tharun-me/tagops
    cd TagOps
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    
  3. Install the tool in editable mode: This command registers tagops as a command-line tool, pointing to the code in your local directory.

    pip install -e .
    

Usage

To run the tool, use the tagops command with the aws subcommand.

tagops aws

The tool will then interactively prompt you for the Tag Key and Tag Value you wish to search for.

Example

$ tagops aws

████████╗  █████╗   ██████╗  ██████╗ ██████╗ ███████╗
╚══██╔══╝ ██╔══██╗ ██╔════╝ ██╔═══██╗██╔══██╗██╔════╝
   ██║    ███████║ ██║  ███╗██║   ██║██████╔╝███████╗
   ██║    ██╔══██║ ██║   ██║██║   ██║██╔═══╝ ╚════██║
   ██║    ██║  ██║ ╚██████╔╝╚██████╔╝██║     ███████║
   ╚═╝    ╚═╝  ╚═╝  ╚═════╝  ╚═════╝ ╚═╝     ╚══════╝
AWS Tag-Based Operations Tool - Safe and Efficient Resource Management

Account ID 4525-9613-7119
Account name MyTestAccount

Enter Tag Key: Project
Enter Tag Value: Automation
Found 18 regions to scan
🔍 Scanning regions for tagged resources...
...

You will then be presented with a list of discovered resources and prompted to select an action.

Safety Features

Cloud infrastructure is sensitive, and TagOps is built with safety as a top priority.

  • Execution Plan: No action is performed immediately. TagOps always shows you a summary of what it intends to do.
  • User Confirmation: You must explicitly approve the execution plan by typing y before any changes are made to your AWS account.
  • API Protection: The tool respects AWS's built-in disableApiTermination and disableApiStop flags on EC2 instances and will skip them automatically.

Development

This tool is built with Python and leverages the following key libraries:

  • boto3: The AWS SDK for Python.
  • rich: For beautiful and informative CLI output.
  • tabulate: Used for formatting resource tables.

To contribute, please follow the installation steps for a development environment. Feel free to submit pull requests for new features, bug fixes, or expanded resource support.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tagops-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tagops-0.1.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file tagops-0.1.0.tar.gz.

File metadata

  • Download URL: tagops-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for tagops-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb0fa5e7988a45e906903e5361a17feca4ea60194396248c198961fd7bcfa6b8
MD5 b7a8887f27105537f8f4391e2a59bda0
BLAKE2b-256 893deed7f4913ec98d9274b0d0de0d564c9231f319c2108b3fe1cd739d5098fa

See more details on using hashes here.

File details

Details for the file tagops-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tagops-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for tagops-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f48a8385d97cd80e77ae2b3a9dffdc2fd7b466e8c1829844e4a1721c94a1181a
MD5 417c7a83bb7a0321294d9c413c79cf2c
BLAKE2b-256 0ab5bc2d74bc66970aa2dc85fc8027dd527e405010e1720ead029a538658fe94

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page