DevOps & monitoring

Prevent orphaned cloud resources when staff change roles

Internal moves often leave infrastructure ownership tags stale. Use access logs and policy checks to reassign resources before access is revoked.

Server racks with warning lights indicating stale resources
Illustration created for this article

When employees change teams or get promoted, their digital footprint in cloud infrastructure often remains unchanged. This creates a gap where critical resources are still tagged with owners who no longer manage them, leading to security risks and operational bottlenecks. A recent guide highlights how to detect and fix these stale ownership tags using existing identity data.

What happened

The article describes a common scenario where an engineer, Marcus, moves from platform engineering to a data role. While HR and IT update his job title and badge access, the forty-one cloud environments he previously owned remain tagged with his email address. Eight months later, Marcus receives an approval request for one of these environments. Lacking context but facing pressure to clear his queue, he approves it without proper review.

This incident illustrates that "last day" rarely means leaving the company entirely. More often, it marks the end of responsibility for specific assets. Infrastructure ownership changes do not receive the same procedural attention as role changes, leaving resources orphaned or mismanaged until a security audit or failure occurs. The solution proposed involves using data queries to identify inactive owners and enforcing policies that prevent ownership gaps during transfers.

Key details

  • Stale ownership tags persist because internal moves do not trigger standard offboarding checklists.
  • AWS users can query aws_iam_user_last_accessed_details to find credentials unused for ninety days.
  • Azure Entra ID allows direct joining of VM owner tags to userPrincipalName in audit logs.
  • GCP lacks direct IAM login records, requiring joins with Google Workspace login data instead.
  • Ninety days of inactivity is a strong indicator that ownership needs review, though not definitive proof.
  • Policy engines like OPA can enforce rules that block resource changes if no active owner is assigned.

Background

Cloud providers allow users to tag resources with metadata, such as an "owner" field. These tags are often simple strings, like an email address, and are not inherently linked to identity management systems. When an employee leaves or changes roles, their access permissions might be updated, but these static tags remain untouched. This decoupling means that automated systems cannot easily determine if the person listed as the owner is still active or responsible for that asset.

Identity providers like AWS IAM, Microsoft Entra ID, and Google Workspace maintain logs of user activity. By cross-referencing these activity logs with resource tags, teams can identify discrepancies. If the person tagged as the owner has not authenticated or accessed any services for a significant period, such as ninety days, it suggests their responsibilities have shifted. This data-driven approach replaces manual guesswork with observable signals.

Why it matters

For teams running self-hosted software or managing cloud infrastructure, stale ownership leads to decision paralysis. When an approval request lands in the inbox of a former owner, they may approve it blindly to avoid the effort of investigating a project they no longer understand. This bypasses necessary security and cost reviews, potentially introducing vulnerabilities or unnecessary expenses into the environment.

Furthermore, orphaned resources become invisible to current team members. Without a clear, active owner, maintenance tasks like patching, scaling, or decommissioning are neglected. Over time, this accumulates technical debt and security risk. By treating ownership as a dynamic role rather than a static label, organizations ensure that every resource has an accountable party who is currently engaged with the system.

Implementing these checks requires minimal new tooling. Most organizations already collect identity logs and use infrastructure-as-code pipelines. Adding a query to flag inactive owners and a policy check to enforce valid assignments integrates into existing workflows. This prevents the accumulation of zombie resources that drain budget and complicate compliance efforts.

What you can do

  • Run SQL queries against AWS, Azure, or GCP logs to identify resource owners with no activity in the last ninety days.
  • Map resource tags to identity provider usernames to automate the detection of stale ownership.
  • Add a step to internal transfer checklists that requires reassigning all owned resources before revoking access.
  • Implement policy-as-code rules using Rego or similar languages to deny changes to resources without an active owner.
  • Route flagged resources to managers or team leads for immediate reassignment rather than leaving them unattended.
  • Treat internal role changes with the same rigor as employee departures by triggering ownership reviews automatically.

More news

All news