Skip to main content

AWS Clutter

Python package that reports on "AWS clutter" and how much they cost. Can report via CloudWatch custom metrics.

Features

  • Cost-Aware. Where relevant, awsclutter calculates how much the clutter is costing you.
  • Cross-Region. A common challenge for AWS users is the lack of cross-region visibility (for many types of resources). awsclutter scans across every region that's accessible to your AWS account so that it can uncover clutter in regions that are rarely visited.
  • Fast. awsclutter uses asynchronous programming to run queries concurrently. This makes it very fast/efficient in retrieving the underlying data from AWS.

Getting Started

To install:

pip install aws-clutter

This installs a command line tool, awsclutter. You can use this to generate a report on "AWS clutter".

Sample Commands:

# summary list of all the clutter resources:
awsclutter list --summary

# detailed list of debs (detached EBS):
awsclutter list debs 

# using jq to get a resource type description (here, for resource type 'debs'):
awsclutter list debs | jq '.debs.description`

# using jq to identify the properties (attributes) of 'debs' resource type:
awsclutter list debs | jq '.debs.resources."us-east-1"[0] | keys'

# to push cloudwatch metrics:
awsclutter watch

# to see what the cloudwatch metrics look like (without actually pushing them):
awsclutter watch --dry-run

# using jq to compactly print the custom metrics and their dimensions:
awsclutter watch --dry-run | jq -r '.[] | .MetricName + "[" + ( [.Dimensions[].Name] | join(",")) + "]"' | sort

Installing as Lambda

If you're familiar with Terraform, see the README under terraform directory. This is a Terraform module that installs this Python code as a Lambda function that will get triggered on a schedule (by default every 10 minutes.) The Lambda function calls the awsclutter watch method. Once deployed, look under the namespace CloudKeep in CloudWatch for the various custom metrics. More details on these metrics below.

Clutter Type "debs" - Detached (Orphaned) EBS Volumes

Detached EBS (Elastic Block Storage) volumes constitue one of the most common sources of AWS cost that creeps up over time. When an EC2 instance is instantiated and extra storage is desired, it is easy to add an EBS volume. At the time of instantiation, there is an option to "Delete on Termination" (of the EC2 instance). The default is "No".

Thus, it's common that these detached volumes exist in a given AWS environment. The problem is two-fold:

  • Not all organizations have a process in place where AWS users (who can create EC2 instances) will actually delete these volumes when they no longer need it.
  • These detached volumes do not stand out in the AWS console where an admin might do something about them.

awsclutter allows an AWS admin to keep track of these detached EBS volumes by creating the following CloudWatch custom metrics:

  • DetachedEBSCount - number of detached EBS volumes
  • DetachedEBSMonthlyCost - monthly cost of detached EBS volumes

These custom metrics are created under the name space of CloudKeep and can have the following dimensions:

  • Currency (only for DetachedEBSMonthlyCost) - required - currency for the EBS cost, as per the AWS pricing metric. Currently, this is 'CNY' for China regions and 'USD' for everywhere else.
  • RZCode - Region/Zone Code. E.g., us-east-1.
  • VolumeType - Volume Type. E.g., gp3.
  • VolumeId - Volume ID. Note the dimensions RZCode and VolumeType are always added to the metric with VolumeId in it.

A metric without a certain dimension represents a summation over the missing dimension. For example, DetachedEBSCount without any dimensions is the total number of all the Detached EBS Volumes (across all the regions and volume types). DetachedEBSCount[RZCode] represents the total number of detached EBS volumes in the specified RZCode.

By default, custom metrics with the dimension of RZCode is added. You can specify additional dimensions to be surfaced via an environment variable DEBS_DIMS, by setting it to a list of dimensions, separated by a comma. E.g., "RZCode,VolumeType".

Clutter Type "ulbs" - Unused Load Balancers

Unused load balancers can come about when the actual servers and/or Lambda functions that backend the load balancer are removed. Even if a load balancer is not being used at all, it incurs a charge, and so we collect their info here.

The custom metrics created are:

  • UnusedLBCount - number of unused Load Balancers
  • UnusedLBMonthlyCost - monthly cost of unused Load Balancers

And these metrics can have the following dimensions

  • Currency (only for UnusedLBMonthlyCost) - required - currency for the LB cost, as per the AWS pricing metric. For ELBs, these are all 'USD'.
  • RZCode - Region/Zone Code. E.g., us-east-1.
  • LBType - Load Balancer Type. ('application', 'network', 'gateway') - Note "Classic" is not supported.

Metadata

Release files for aws-clutter 0.9.5

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-clutter 0.9.5
File Size Uploaded
aws-clutter-0.9.5.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-clutter 0.9.5
File Interpreter ABI Platform
aws_clutter-0.9.5-py3-none-any.whl Python 3 none any Details

Total release size: 32.3 kB

Release files / aws-clutter-0.9.5.tar.gz

Download URL aws-clutter-0.9.5.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b79baf0bc9419a7fd0c735c156cbe367107adcdc3d84eddfb0d42a5ac527aa42
BLAKE2b-256 checksum
How to use checksums
06a2a092258a22b650b31ce9b3305640b96647727aa753a24c3f4b58f389e80d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.9.6 Darwin/21.2.0

Release files / aws_clutter-0.9.5-py3-none-any.whl

Download URL aws_clutter-0.9.5-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70b1a2fdc64ac18b937f266ba8d87e17222009a35d7c02fe271787e399b29248
BLAKE2b-256 checksum
How to use checksums
843b6fadc6461ae48f561dbcaa375babeefd63986d1eccc17b6378121e02c1b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.9.6 Darwin/21.2.0

Release history Release notifications | RSS feed

This release

0.9.5 This release

2 release files

0.9.3

2 release files

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