AWS ECR Storage Cost: Keep, Archive, or Delete
Understand AWS ECR storage cost and choose lifecycle rules that archive or remove old images without putting deployable releases at risk.
· 10 min read

Every time a continuous integration pipeline completes a successful build, a new container image lands in your registry. Retaining all historical artifacts guarantees that every past environment remains reproducible, but that retention drives up the monthly bill as the repository grows. Aggressively purging older digests keeps expenses low, though it risks severe deployment delays if a production rollback requires a deleted image. You have to decide which builds warrant active retention, which belong in a colder archive tier, and which can safely expire.
Managing these artifacts requires mapping your image lifecycles to your operational needs. FinOps AI shows ECR's line in your AWS spend next to the rest of your accounts, but it raises no ECR findings and does not manage lifecycle policies: ECR's own policies do the cleanup. Where FinOps AI does act, on a short list of AWS finding types, it turns the finding into an approval-gated, audited change rather than a blind script.
What Drives Amazon ECR Storage Cost?
The billing model for a private elastic container registry depends primarily on the volume of retained data and the network paths used to move it. Storage charges accrue to the AWS account that owns the repository, measured in gigabyte-months. For illustration, a current Amazon ECR Pricing example for the us-east-1 Region sets private storage at $0.10 per GB-month. Under that specific rate, maintaining a steady 100 GB footprint costs roughly $10 per month for the retained data alone. You should always consult the pricing calculator for your exact deployment Region to confirm current rates.
Data transfer introduces a secondary expense variable. Same-Region transfers between the registry and other Amazon web services, such as pulling an image to an Elastic Kubernetes Service cluster in the same Region, carry no ECR data transfer charge, though nodes in private subnets that pull through a NAT gateway still pay its per-GB data processing fee. Replicating repositories across different Regions changes that formula. Cross-Region data transfers trigger standard egress fees based on the origin point, meaning an aggressive replication strategy multiplies both your static storage footprint and your network billing.
Container architecture further complicates how you measure retained volume, because images rely on shared base layers. Pushing a minor application update generates a distinct digest, but the underlying operating system and runtime packages remain shared across the versions stored in that repository; ECR stores such layers again in each other repository unless blob mounting is turned on for the registry. Because of this structural deduplication, deleting an artifact listed at 500 MB may reduce your billed footprint by much less than 500 MB. The registry only reclaims the physical space consumed by a specific layer once no remaining images reference it.
Assigning latest, v1.2, and production tags to the exact same digest creates three text pointers to a single payload. The AWS ECR storage cost strictly reflects the physical bytes retained on disk, not the number of labels attached to those bytes. Automated retention policies operate entirely at the image digest level, not the individual layer level, so you cannot configure a rule to age out heavy runtime components while keeping lightweight application updates.
The Google Cloud guide to Cloud Logging cost management recommends analyzing log volume and costs before optimizing logging spend, so apply that measurement discipline to registry billing: check the actual bill after an expiration policy runs rather than estimating savings from the displayed sizes of removed artifacts.
Choose What to Keep, Archive, or Expire
Evaluating a registry requires establishing firm criteria based on access speed and recovery value. Pushing everything into a deletion queue based solely on age ignores the operational realities of software deployment.
Keep production and fast-rollback releases in Standard
Active production artifacts must remain available for immediate pulling. When a new deployment introduces a regression or causes a memory leak, the site reliability team needs the previous known-good release instantly. The Standard storage tier guarantees that uninterrupted access, and retaining the newest required release set in this class prevents minor incidents from escalating into prolonged outages.
Configure the retained count to match your documented rollback window rather than a random estimate. If the disaster recovery plan requires reverting to any version deployed over the previous fourteen days, all software packages from that period belong in Standard storage. Prioritizing immediate availability for these specific digests ensures the infrastructure can heal quickly during an emergency.
Archive retained images that are rarely pulled
Certain artifacts fall outside the immediate rollback window but still demand retention for compliance audits, debugging historical customer issues, or fulfilling regulatory mandates. To handle these specific use cases, AWS offers the Archive storage class for rarely accessed items that still require preservation, though it costs less than Standard only at very large volumes.
ECR Archive costs the same $0.10 per GB-month as Standard for the first 150 TB a month in every Region and $0.07 above that, bills a 90-day minimum and charges $0.03 per GB to restore (AWS price list, October 2026), so it saves money only for very large archives; archived images must also be restored to ECR Standard before they can be used again. AWS says restoring an archived image completes within 20 minutes, so the Archive class suits long-term retention rather than instant rollback during a live site incident. Check ECR pricing before changing storage classes.
Expire artifacts after their retention value ends
Ephemeral builds generated by continuous integration, abandoned pull-request checks, and software versions that have entirely aged out of the support window eventually lose all utility. Expiring these packages permanently purges their data from the registry account.
Unlike transitioning an item to a cold tier, expiration provides no native recovery mechanism. Deleting a digest drops the associated labels and removes any underlying layers not shared with other active configurations. Restrict this permanent expiration specifically to cohorts that have completed their lifecycle, ensuring that no production workload relies on the targeted components.

Match Lifecycle Criteria to Each Image Cohort
Translating access requirements into reliable automation requires selecting appropriate evaluation signals, because no single metric proves a container package is safe to remove. You must analyze push age, retained counts, and recorded pull histories to accurately target specific repositories.
Use push age and image count for ephemeral builds
To manage ephemeral workloads, Amazon ECR's lifecycle policy properties let you set numeric expiration thresholds based on image age or image count.
The sinceImagePushed parameter targets items older than a designated number of days. A policy utilizing this signal can automatically expire continuous integration outputs after a short window, keeping development environments clear of obsolete tests. Alternatively, the imageCountMoreThan parameter preserves a definitive number of artifacts regardless of their age. With this parameter, the system orders all matching items by push time, counts backward from the newest arrival, and marks any digest beyond the threshold for the specified action. This strategy prevents a low-activity repository from emptying completely during a development freeze while continuing to cap the maximum retained storage volume.
Treat pull history as an archive signal, not deletion proof
Recording how long a digest sits untouched appears to be a perfect expiration metric, but the sinceImagePulled parameter behaves differently than standard age calculations. AWS requires using this pull-based history specifically to transition older items to the Archive class, not to immediately expire them.
The underlying mechanics demand careful interpretation. If a digest has never been pulled, the registry substitutes its original push time for the pull-based criterion. When an archived item undergoes a successful restore operation but never receives a subsequent pull request, the system uses the last activation time for the calculation instead. Because an unpulled package might be a brand-new production release waiting for its scheduled deployment window, a lack of recent pull activity signals a candidate for the slower archive tier rather than immediate destruction. Once an item successfully transitions to cold storage, a separate sinceImageTransitioned rule can eventually expire it, provided it meets the AWS requirement to remain archived for at least 90 days before deletion.
Set release retention from the rollback window
Production labels follow a different cadence than ephemeral testing builds. Implementing a strict 30-day expiration rule across an entire repository might unintentionally delete a stable release that happens to run smoothly for two months without requiring a redeployment.
Instead of relying solely on the time since the initial push, coordinate your release retention directly with organizational recovery capabilities. If a service architecture requires rolling back up to five previous versions to maintain data compatibility, configure the lifecycle rule to retain exactly that many releases in the Standard tier. Keep these critical assets available for rapid deployment and relegate older historical versions to the archive system.
Protect Deployable Releases From Broad Cleanup Rules
A lifecycle policy acts on the underlying digest. When an automated rule matches a specific tag, the registry removes the entire image and every other label pointing to it. This structural reality means a broad cleanup command can unintentionally destroy a critical production release if it shares a digest with a temporary build marker.
Separate release, build, and untagged image cohorts
Preventing collateral damage requires rigorous string conventions, so assign distinct, predictable prefixes to different artifact types. Using patterns such as release-* for production deployments, ci-* for continuous integration outputs, and pr-* for active pull requests allows the lifecycle engine to evaluate each cohort independently.
Teams often treat untagged images as automatically abandoned, as these orphaned digests accumulate when new pushes overwrite mutable aliases. While they appear to be obvious targets for aggressive push-age expiration, you must first verify how the deployment pipeline functions. If your Kubernetes manifests reference specific digests directly rather than relying on labels, an untagged item might still be actively running in a cluster.
AWS supports immutable image tags to protect specific versions from accidental overwrites. If a developer attempts to push an update that reuses an existing immutable tag, the registry rejects the action. Implementing immutability for your production cohorts prevents local testing builds from accidentally assuming the identity of a stable release.
Check tag matching, rule priority, and manifest dependencies
When a policy includes a list of multiple tag patterns, the candidate item must match every listed pattern to trigger the rule. This specific logical requirement prevents accidental overlap if you construct the patterns carefully. The lifecycle policy evaluator checks every rule at once and then applies them in rulePriority order, where lower numbers take precedence. A safe configuration evaluates narrow, highly specific rules for build artifacts and releases first, leaving broad catch-all statements like tagStatus: any for the final step.
Multi-architecture deployments introduce another layer of dependency management. Manifest lists act as routing pointers, directing different container runtimes to the correct platform-specific payload. The registry actively protects these dependencies, so an individual platform package cannot undergo expiration or archiving while a valid manifest list still references it. The cleanup rule must handle the parent manifest list before the underlying artifacts can successfully transition.
Managing interlocking infrastructure changes manually often leads to unverified automation and unexpected downtime. For the AWS findings it can act on, FinOps AI replaces that uncertainty with an approval-gated workflow: it surfaces the finding, waits for a workspace owner or admin to approve (unless the workspace has turned on automatic execution for that reversible action type; a deletion always waits for a person), checks the account-level guardrails before the change runs, and runs a post-action check, rolling a reversible change back if the check fails. It also shows Bedrock and Vertex AI spend and Kubernetes costs across AWS and Google Cloud; Google Cloud is visibility only. FinOps AI does not create or run ECR lifecycle policies, so use ECR's lifecycle policy preview for registry cleanup and FinOps AI for governed changes such as deleting unattached EBS volumes.

Preview and Verify an ECR Cleanup Safely
Designing an efficient retention matrix provides no value if the implementation deletes the wrong digests, so safe remediation requires verifying the exact impact before committing the policy to the active repository.
Identify the registry-owning account, the specific operating Region, and the target repository, then draft narrow rules based on your tagging prefixes and rollback requirements. Use the built-in preview mechanism for creating a lifecycle policy to test these rules without altering the data. Running this preview generates a detailed list of the exact image digests the policy will affect. Review this output carefully, checking for unexpected production markers or unresolved manifest-list dependencies before applying the policy.
Once verified, apply the policy to the repository. Lifecycle actions operate asynchronously, so the system does not immediately purge the selected artifacts upon saving the configuration. The expiration or transition processes typically complete within 24 hours after an item meets the defined criteria, and every action generates a corresponding CloudTrail event to provide a reliable audit log of the operation.
For replicated environments, a policy applies only in the Region where it was created. Managing global retention safely requires creating and maintaining identical configurations across all relevant replica Regions and accounts.
After the initial 24-hour window has passed, check the repository to confirm the targeted artifacts transitioned to Archive or expired successfully. Calculate the financial impact by observing the overall storage volume reduction, rather than tallying the standalone size of each removed label. Because of the shared-layer architecture, the savings will frequently be lower than the sum of the individual sizes displayed in the console.
Approach expiration with deliberate caution. Once the registry deletes a digest, the action is not automatically reversible. Transitioning items to Archive offers a reliable safety net for rarely accessed items that still hold retention value, but that recovery path requires enduring the restoration delay. Maintain Standard storage for active workloads and fast-rollback releases, use the Archive tier for necessary compliance retention, and restrict permanent expiration to the ephemeral artifacts whose lifecycle has ended.
Ready to move beyond read-only dashboards and start turning cloud cost findings into approved, guarded changes? Connect your environments to FinOps AI and build a secure, verifiable remediation loop for your AWS infrastructure.
Sources
- Amazon ECR Pricing · aws.amazon.com
- Google Cloud guide to Cloud Logging cost management · cloud.google.com
- restoring an archived image · docs.aws.amazon.com
- lifecycle policy properties · docs.aws.amazon.com
- creating a lifecycle policy · docs.aws.amazon.com
Free calculators
Related posts
- Find and Safely Delete Unattached EBS Volumes in AWS
Find unattached EBS volumes in AWS, verify ownership and retention needs, preserve required recovery points, and delete only approved storage.
- S3 Lifecycle Cost Optimization: Choose Tiers Wisely
Choose S3 storage classes by access pattern while weighing storage savings against retrieval, restore, transition, and minimum-duration costs.
- EBS gp2-to-gp3 Savings: Calculate the Real Cost
Estimate EBS gp2-to-gp3 savings with regional pricing, provisioned performance costs, workload checks, and a staged change you can verify.