I'm trying to esimate monthly cost of using AWS ECR. It will consist of: outgoing traffic cost (downloading images) and storage cost (storing images in ECR).
Let's assume, that:
- We are building some web service using Mono (base docker image size is 500Mb);
- Our CI&CD server builds and pushes images to ECR 300 times per month. Old images not removed for simplicity;
- Our compiled code adds additional layer of 40Mb to base image;
- We download images 60 times per month from AWS;
The 1st question is: how to estimage monthly storage volume? What equation is correct?
Monthly_Vol_1 = 500+40*300; - base image stored only once
Monthly_Vol_2 = (500+40)*300; - every image includes base image
The 2nd questions is: how to estimate monthly traffic from AWS? Let's assume, that host downloading images does not remove existing data.
Monthly_Traf_1 = (500+40)*60; - every time it downloads base image and additional layer
Monthly_Traf_2 = 500+40*60; - base image is downloaded only for the 1st image. Only application updates are downloaded
Monthly_Traf_3 = 40*60; - base image is downloaded not from AWS ECR, but from docker hub
UPDATE:
I uploaded 2 images to AWS ECR in September and checked billing info after 2 months. What I discovered:
It cost me $0.04 monthly just to store 2 images (without transfers). According to AWS ECR pricing ($0.10 per 1Gb storage) looks like Amazon stores 400Mb of data. The same 400Mb I see in AWS ECS dashboard.
I tried to understand and calculate what data is stored (using docker image and docker history commands), but failed.
I have 2 docker images uploaded to AWS ECR:
- SVC (482Mb) based on Mono (409Mb)
- WEB (679Mb) based on Node (634Mb)
If AWS stores full images, then it shall store 482+679=1161Mb
If AWS stores just added layers, then it shall store 45+73=118Mb
How AWS calculates 400Mb? O_o
UPDATE2:
Looks like AWS stores full images, but compressed (400Mb instead of 1161Mb). According to http://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_DescribeImages.html
Beginning with Docker version 1.9, the Docker client compresses image layers before pushing them to a V2 Docker registry. The output of the docker images command shows the uncompressed image size, so it may return a larger image size than the image sizes returned by DescribeImages.