Skip to content

The Invisible Room: Finding Untracked Cloud Resources Without Treating Inventory as Deletion Approval

This article uses the metaphor of an invisible room to examine dark data and untracked state in cloud infrastructure. Resources that are easy to create can be easy to lose track of after a project ends.

Consider a temporary development environment, a few AWS RDS instances for a short experiment, or a Kafka cluster on Kubernetes. The sprint ends and the ticket closes, but resources may remain. Unattached block storage, unused Elastic IP addresses, untracked S3 buckets and old container images can keep incurring charges. Their owners, dependencies and retention needs can also become unclear, creating operational and security risks that deserve review.

This article examines how untracked cloud resources accumulate, how they can affect costs and operations, and how a read-only inventory script can identify candidates for review. Inventory is not deletion approval: any cleanup must separately check ownership, dependencies, retention and recovery.

Why Cloud Infrastructure Accrues "Invisible Rooms"

Cloud services make resource provisioning fast, while teardown still requires decisions about ownership, dependencies and data retention. This mismatch can leave infrastructure that no longer serves its original purpose. Common categories include:

  • Orphaned block storage: An available EBS volume is a review candidate, not proof of abandonment. EC2 root volumes created at launch are normally deleted on termination; other defaults depend on attachment method and DeleteOnTermination. StatefulSet PVCs are retained by default, with configurable retention and PV reclamation behavior.
  • Abandoned images and build artifacts: Images can accumulate unless retention policies match the repository's release and rollback requirements. Measure stored data rather than assuming terabytes are wasted.
  • Public IPv4 addresses and load balancers: AWS lists the same $0.005 hourly rate for standard in-use and idle public IPv4 addresses. Rates and exceptions should be checked in current pricing. A running ALB also incurs hourly charges even without application traffic.
  • Dangling DNS: Records pointing to resources no longer controlled by the organization can create takeover risk when someone else can acquire or claim the destination. The exact risk depends on record type and service behavior.

The Architectural Cost of the Unseen

It is easy to treat untracked infrastructure as an ordinary operating cost. Yet the impact can extend beyond the monthly cloud bill: unclear ownership and dependencies can complicate security reviews, upgrades and incident response.

Depending on chart ownership, deletion policies and manual changes, a Kubernetes cluster can retain resources no longer needed by current workloads. Inventory ConfigMaps, Secrets and PVCs alongside their owners and consumers. Exposure of credentials depends on access controls and workload compromise; resource age alone is not a vulnerability. Review API compatibility during upgrades and do not remove objects simply because they are old.

Building a "Ghost Buster": Tracking Down Orphaned Resources with Python and Boto3

A small Python tool using boto3, the AWS SDK, can list available EBS volumes and unassociated Elastic IP addresses. The example below is deliberately read-only and limited to one named profile and Region. Its results are review candidates, not proof that a resource is unnecessary.

For an isolated Python environment, the example requires Boto3. The installation line below is a preparation example, not a command that was run for this article:

pip install boto3

The following read-only demonstration lists review candidates in one explicitly chosen AWS account and Region. It is not a production inventory or a cleanup tool. Confirm the account and Region, use an authorized role with only ec2:DescribeVolumes and ec2:DescribeAddresses, paginate volumes, handle errors, and validate ownership, retention and dependencies before considering any deletion. No resource is proved unnecessary merely because it is unattached. Cost depends on Region, volume type, provisioned performance, elapsed time and applicable pricing; the original fixed estimates must not be treated as a bill.

import argparse
import json
import sys
import boto3
from botocore.exceptions import BotoCoreError, ClientError

def inventory(ec2):
    volumes = []
    pages = ec2.get_paginator("describe_volumes").paginate(
        Filters=[{"Name": "status", "Values": ["available"]}]
    )
    for page in pages:
        for volume in page.get("Volumes", []):
            volumes.append({
                "VolumeId": volume["VolumeId"],
                "SizeGiB": volume["Size"],
                "Type": volume["VolumeType"],
                "Created": volume["CreateTime"].isoformat(),
                "Tags": volume.get("Tags", []),
            })
    addresses = [
        {"PublicIp": address.get("PublicIp"),
         "AllocationId": address.get("AllocationId"),
         "Tags": address.get("Tags", [])}
        for address in ec2.describe_addresses().get("Addresses", [])
        if not address.get("AssociationId")
    ]
    return {"available_volumes_for_review": volumes,
            "unassociated_addresses_for_review": addresses}

def main():
    parser = argparse.ArgumentParser(description="Read-only, single-Region inventory")
    parser.add_argument("--region", required=True)
    parser.add_argument("--profile", required=True)
    args = parser.parse_args()
    try:
        session = boto3.Session(profile_name=args.profile, region_name=args.region)
        result = inventory(session.client("ec2"))
    except (BotoCoreError, ClientError) as exc:
        print(f"Inventory failed; results are not complete: {exc}", file=sys.stderr)
        return 1
    print(json.dumps({"region": args.region, "profile": args.profile,
                      "note": "Candidates only. Not a cost estimate or deletion approval.",
                      **result}, indent=2))
    return 0

if __name__ == "__main__":
    raise SystemExit(main())

How to Prevent the Build-up of "Invisible Rooms"

Running manual clean-up scripts is a reactive approach. To truly solve the "invisible room" problem, we must build systems that prevent accumulation in the first place. Here are three architectural patterns to enforce cleanliness:

1. Infrastructure as Code with reviewed deletion policies

Terraform, OpenTofu and Pulumi can help track the resources they manage; they do not automatically inventory everything in an account. terraform destroy targets objects managed by the current Terraform configuration and state and can destroy production data. Review a speculative destruction plan, dependencies, retention rules and tested backups before any authorized change.

Do not change DeleteOnTermination simply to reduce a bill. Set the policy according to each volume’s data-retention requirements: true can delete the volume when its instance terminates. EC2 defaults vary by volume and attachment method. Instead of an unverified AMI deployment recipe, use this review checklist before planning a scoped change:

  • Confirm the account, Region, resource and owner.
  • Inspect the existing deletion setting without changing it.
  • Check dependencies and applicable retention requirements.
  • Verify backups and a tested recovery path.
  • Obtain authorization before planning or applying deletion changes.

2. Object Storage Lifecycle Rules

Define retention policies appropriate to the service and your release, rollback and compliance needs. In ECR, lifecycle rules select images using tags and age or count criteria; expiring an image is not equivalent to deleting only one tag. Preview the exact policy against the repository before applying it, including images with both release and temporary tags. Do not assume a prod-latest tag by itself protects an image.

3. Scheduling development-environment capacity

For authorized, disposable non-production compute, scheduled scaling can reduce instance-hours. A daily 19:00–08:00 shutdown removes 13 of 24 hours, about 54.2% of scheduled instance-hours before billing and operational details; it is not a promise about the total bill. Set the desired capacity and compatible minimum/maximum limits, specify the time zone, and account for startup and availability. EC2 Auto Scaling scale-in terminates instances rather than simply pausing them. Persistent volumes, snapshots, IPs and other services can remain and keep incurring charges; scaling to zero does not guarantee cleanup of transient state.

Conclusion: Turn on the Lights

The "invisible rooms" of our cloud architectures are a direct byproduct of the modern developer's superpower: the ability to build, scale, and destroy infrastructure with code. But with that power comes the operational debt of keeping our virtual workspaces clean.

Automated inventory, reviewed Infrastructure-as-Code lifecycles and carefully tested retention policies can help identify avoidable costs and clarify security responsibilities. Measure the results in your own environment; no particular saving or security improvement is guaranteed by this example.

Over to you: What is the biggest "invisible room" resource you've ever uncovered in your cloud environment? Did you discover a rogue 8XL virtual machine that had been idling since 2021, or a testing database that was costing thousands a month? Let me know in the comments below, or share this post on Twitter/X or LinkedIn!

Until next time, keep your code clean and your cloud cleaner. — Alex

Sources for further checking

Post a Comment

Previous Post Next Post