How LeftSize Works: Scans, Issues and Savings

LeftSize runs as a GitHub Action in your own workflow, scans your cloud with read-only access, and turns what it finds into GitHub Issues in your repository.

Architecture overview

Your Repository          LeftSize Action           LeftSize API
┌──────────────┐        ┌──────────────┐        ┌──────────────┐
│ .github/     │        │ Cloud        │        │ Template     │
│ workflows/   │───────>│ Custodian    │───────>│ Engine       │
│ leftsize.yml │  runs  │ Policies     │ submit │              │
└──────────────┘        └──────────────┘ findings└──────┬───────┘
                                                       │
                                                       │ creates
                                                       v
                                                ┌──────────────┐
                                                │ GitHub       │
                                                │ Issues       │
                                                └──────────────┘

The scan cycle

1. Scheduled trigger

The workflow runs once a day at a fixed time that is different for each repository. You can also start a scan from the Actions tab.

2. Cloud authentication

The workflow signs in to your cloud, with OIDC in the recommended setup: GitHub Actions requests a short-lived token that is valid only for that run, so no cloud credentials are stored. Other sign-in methods, such as a service principal secret or AWS access keys stored as GitHub secrets, also work (see AWS Setup and Azure Setup). Either way, the credentials stay on your runner.

Cloudflare has no OIDC for API tokens. There the action signs in with a read-only API token that you store as a GitHub secret and pass as cloudflare-api-token. The token also stays on your runner. See Cloudflare Setup.

3. Policy execution

The LeftSize Action runs Cloud Custodian policies against your account. They check for:

  • Cost optimization: idle, unused and over-provisioned resources
  • Deprecations & retirements: retired or out-of-support versions, SKUs and services
  • Security: public exposure, unused credentials, missing MFA or logging, weak TLS settings
  • Governance: missing tags, encryption, backups and audit settings

The policies only read. They query resource configuration and CloudWatch or Azure Monitor metrics (on Cloudflare, Worker request counts from Cloudflare’s GraphQL Analytics API) and never change anything. Cloud Custodian has no Cloudflare support of its own, so the action ships a read-only Cloudflare provider for it. See the rules catalog for every rule.

Each LeftSize rule is one Cloud Custodian policy, so the two words mean the same thing here. The action’s inputs and logs say “policies” (include-policies, exclude-policies, “policy file”); the docs and issues say “rules”. The rules are grouped in 13 policy files, one per cloud and category (Azure has a separate file for AKS).

4. Findings submission

The action groups findings by rule and scope and sends them to the LeftSize API with the repository token. The scope is an Azure resource group, an AWS account and region, or a Cloudflare account: for example, all idle VMs in one resource group, all unused Elastic IPs in one account and region, or all zones without DNSSEC in one Cloudflare account form one group.

Each scan only adds and updates findings for the cloud it scanned. A Cloudflare scan never resolves AWS or Azure findings, and the other way around, so one workflow can scan several clouds in separate jobs.

5. Issue creation

LeftSize opens one issue per group. Each issue has:

  • A title with a category prefix: [COST], [SECURITY], [GOVERNANCE] (sometimes [GOV]), [DEPRECATION] or [PRICE CHANGE], and for a few rules [RIGHT-SIZE], [STORAGE] or [WARNING]. A rule without its own template gets a title like [LeftSize] <rule>: 3 resources affected.
  • The affected resources with the relevant details
  • Estimated monthly savings, for cost findings that LeftSize could price. Most cost issue titles end with the amount, such as (≈ $42/mo); some rules show it only in the body, and rules without a price formula show none.
  • The @leftsize commands you can use for more guidance
  • Labels: leftsize, the category, cloud:, severity: (critical, high, medium or low), rule:<rule id> (without the leftsize- prefix when the label would exceed GitHub’s 50 characters), resource-type:, and for some rules extra labels such as action: or risk:. Labels are set when the issue is created and not changed afterwards.

On the Free plan, issues are created for cost optimization rules only. The other rules still run and the scan summary shows their findings, but they don’t get issues.

6. Issue lifecycle

  • New finding: LeftSize opens an issue.
  • Same finding on a later scan: LeftSize updates the issue’s title, resource list and counts while the issue is open. Editing the issue doesn’t notify anyone. Labels you add are kept.
  • Some resources fixed: the next scan updates the resource list to the ones still found.
  • All resources fixed: LeftSize doesn’t close issues itself and doesn’t auto-resolve findings that disappear. The issue keeps the last resource list; close it when you’ve fixed the resources.
  • Closed issue: LeftSize doesn’t reopen it or open a new one for the same rule and scope, even if the problem comes back. A deleted issue counts as closed.
  • Snoozed issue: after the snooze period, the next scan that still finds the problem reopens the issue. If a person closed it themselves after the snooze, it stays closed. See snooze.
  • Reopened issue: when a person reopens a closed issue, LeftSize tracks it again from the next scan that still finds the problem, and a snooze or ignore on it no longer applies.
  • Retired rule: when LeftSize removes a rule, it stops updating that rule’s issues and may close them with a comment that explains why.

If GitHub Issues are turned off in the repository, findings are still stored but no issues are created. Turn Issues back on to get them.

On a public repository, anyone can comment @leftsize commands on these issues. Use a private repository; see Commands.

What runs where

Component Runs in Has access to
GitHub Actions workflow Your repository’s runner Your cloud (AWS and Azure via OIDC, recommended, or other credentials; Cloudflare via a read-only API token in a GitHub secret)
LeftSize Action Your repository’s runner Cloud APIs (read-only), LeftSize API
LeftSize API LeftSize infrastructure GitHub API (to create and update issues)

Your cloud credentials never leave your runner. For each finding, the LeftSize API receives:

  • The resource ID: the Azure resource ID or AWS ARN, which includes the subscription or account ID, resource group, region and resource name. On Cloudflare it is cloudflare:account/<account id>/<kind>/<name>, for example a zone name, Worker name, bucket name, or the user ID of a Zero Trust user
  • The rule that matched, and the scope
  • The names of the resource’s tags, not their values (action version 1.0.29 and later; earlier versions sent the values too)
  • The configuration fields the rule uses, such as size, SKU or engine version
  • The environment LeftSize detected for the resource, and what it was based on
  • The estimated monthly savings

On Cloudflare, the Zero Trust seat rule also sends the email addresses of users with an unused seat. The two-factor rule sends only how many members lack two-factor authentication, not who. It never receives credentials (including the Cloudflare API token), tag values or the data inside your resources. The privacy policy explains how this data is stored and how long it is kept.

Detection methods

Metrics-based detection

For resources like VMs, databases and load balancers, LeftSize reads CloudWatch or Azure Monitor metrics over a recent window of 5 to 30 days, depending on the rule (on Azure 7, 14 or 30 days). A resource is flagged when its usage stays below the rule’s threshold for that whole window. The rules catalog gives the window and threshold of each rule.

Configuration-based detection

For things like unattached disks, unused IP addresses, missing tags or retiring versions, LeftSize checks the resource’s configuration directly. These checks don’t need metrics.

Age filters

Most cost rules skip resources that were created recently, so a resource you just deployed isn’t flagged before it had a chance to be used.

Cost estimation

Where possible, LeftSize estimates monthly savings from the resource type, size and public list prices in USD (pay-as-you-go / on-demand): Azure prices from the Azure Retail Prices API, AWS prices from the Infracost Cloud Pricing API. A rule that removes a resource saves its full price; a nightly and weekend shutdown (12 hours on weekdays) saves about 64%; turning off Multi-AZ saves half. VM prices include the Windows licence; AWS instance prices also include Red Hat, SUSE and licence-included SQL Server editions, while bring-your-own-licence instances get no amount. When several rules flag the same resource, totals count it once, at its highest amount. Negotiated discounts, reservations, savings plans and usage-based charges (data transfer, requests, extra IOPS) aren’t taken into account. When a price can’t be found reliably, the issue shows no amount rather than a guess.

On Cloudflare, leftsize-cloudflare-paid-zone-not-serving estimates the savings as the zone’s plan price.

Amounts are always in US dollars, also for Azure subscriptions billed in euros or another currency: LeftSize uses public USD list prices and doesn’t convert them. The action detects your Azure billing currency (from the subscription’s price sheet or Cost Management) and records it with the findings, but the amounts in issues stay in USD.

Production vs non-production

Some rules only apply to non-production resources, such as shutting down dev VMs at night, stopping test AKS clusters, or dropping Multi-AZ and Business Critical on test databases. LeftSize decides the environment of each resource, using the first of these that applies:

  1. The action’s environment-name input, if it names an environment: one value for the whole scan (PROD, DEV), or name=environment pairs for a subscription that holds several environments (Shop-NG-A=acceptance, Shop-NG-P=production). Other values, such as the MAIN matrix label from onboarding, are ignored.
  2. An Environment, Env or Stage tag on the resource, then on its Azure resource group.
  3. Words in the resource name or resource group name: prod, prd, live (production); acc, uat, preprod (acceptance); stg, staging; test, tst, qa; dev; sandbox; nonprod. Only whole words count, so latest isn’t test.
  4. A one-letter last word in the resource group name: -P, -A, -T or -D (for example Shop-NG-A).
  5. The account the resource is in, for setups with one account per environment: the AWS account name or alias, or the Azure subscription name or its Environment tag (for example shop-acc).

Any production signal wins, and a resource without clear non-production evidence is treated as unknown, so non-production advice never reaches it. Issues show the environment of each resource and what it was based on. If one is wrong, add an Environment tag or set environment-name.

Data retention

Data Kept for
Raw scan results as the action sent them 30 days
Findings While a scan still reports them. A finding no scan has reported for 365 days is deleted. If a closed or ignored issue, or a snooze, still refers to it, LeftSize keeps only the rule, the scope and a SHA-256 hash of the resource ID, so that issue stays closed instead of being opened again.
Issue links, snoozes and ignores While the GitHub App is installed
Command history (who ran which @leftsize command) 365 days
Everything of an installation Deleted 30 days after the GitHub App is uninstalled or suspended

The privacy policy is the authoritative description.

Reports and statistics

The action also has a stats mode that reports findings, open issues and estimated savings for the repository. It doesn’t scan your cloud; it reads from the LeftSize API. See Reports.

Was this article helpful?

© 2026 LeftSize. Cloud cost optimization for GitHub teams.