DEV Community

YukiOnodera
YukiOnodera

Posted on

ECR Costs Had Increased Over 10 Times Without Me Noticing

Introduction

The other day, while I was looking through Cost Explorer, I discovered that the cost of ECR had ballooned to more than 10 times what it was a few months ago.

Investigation Begins

Realizing this was a serious issue, I immediately began investigating the cause.

Confirming ECR Pricing

I started by reviewing the pricing structure for ECR.

https://aws.amazon.com/ecr/pricing/

The cost of ECR is determined by storage charges based on the amount of image storage and data transfer out.

Reviewing the Invoice

Next, I checked last month’s invoice.

The goal was to identify whether the increased costs were due to storage or data transfer.

At this point, I noticed that in the ECR section of the invoice, only the storage costs were visible. Data transfer costs are listed under a separate data transfer section, so make sure to check that. I initially overlooked this, which left me puzzled about the discrepancy.

In my case, data transfer costs had skyrocketed.

Checking AWS Accounts

Since I was using AWS Organizations, I checked which member account was seeing the increased ECR costs.

Fortunately, only one account had significantly higher costs, so I was able to quickly pinpoint the source.

Reviewing ECR Repositories

However, just identifying the AWS account wasn’t enough to solve the problem.

I decided to open the list of ECR repositories and take a look.

I noticed that several repositories had been created around the time costs started increasing.

The Cause of the Cost Increase

After discussing it with team members and digging deeper, we discovered that this was due to a repository that had been migrated from Docker Hub for use in CI.

CI is executed on GitHub Actions with each commit, and since multiple images of considerable size were being pulled, data transfer costs had surged.

Conclusion

I'm glad I found the cause. In fact, I consider myself lucky to have noticed it through Cost Explorer.

Cloud costs can sometimes spike unexpectedly, so it’s important to stay vigilant.

References

https://docs.docker.com/docker-hub/download-rate-limit/

Top comments (0)