When you push an image to ECR, it is stored as a series of layers that represent the image contents. Each layer contains filesystem changes, metadata, etc.
When you push a second image to ECR, even if it has different metadata, like the tag name, ECR checks the layer contents and reuses any identical layers.
For example, say image A has layers X, Y, and Z. If you push image B, which has the exact same layers X, Y, and Z plus a new layer W, ECR will store the layers only once.
Image A layers:
X Y Z
Image B layers:
X Y Z W
ECR recognizes X, Y, and Z are identical and do not need to be duplicated. Only the new W layer unique to image B is stored.
This means the total storage is only incremented by the size of the new layer W, not doubled.
The important factors are:
- Layer reuse – identical image layers are stored only once
- Layer immutability – existing layers can’t be changed, only new layers added
- Metadata differences in tags don’t affect layer reuse
So in summary, because ECR leverages layer reuse and immutability, storage size does not double when pushing duplicate images with different tags. Only new delta layers take up additional space.