Add this AWS ECR Lifecycle Policy for cost reduction

--

In AWS ECR all pushed images are stored in the ECR. It does not matter it is currently used or not. But AWS charge you for storing these images. In order to prevent this you can use a lifecycle policy to delete the images which are outdated.

To set this policy first go to AWS => ECR => Repositories

path to the repositories

Then select a repository, go to => Actions => Lifecycle policies

Click “Create Rule”

Here you can set a policy to delete the images according to the match criteria that you have given. In the example above I have set a policy to delete any image in the ecr which is 10 days or older.

When you hit save within 5 minutes you will see the old images are gone and the policy is working pretty well.

--

--

Meriç Özkayagan
Meriç Özkayagan

Written by Meriç Özkayagan

I am Meriç. I am seriously interested in AWS, Terraform and .Net. I am sharing here by explaining in detail how I solved the tasks that I had difficulty with.

No responses yet