TIL you can output `aws ecr describe-images` as a table
Benji 🍙

Benji 🍙 @benji011

About: I'm a backend engineer with 9 years of experience in Japan. My skills include developing robust and scalable applications, working with databases, APIs, and servers, and applying software architecture

Joined:
Oct 21, 2020

TIL you can output `aws ecr describe-images` as a table

Publish Date: Jun 9
0 2

Whenever I want to describe an image of a container image I pushed on AWS ECR i would see a JSON similar to below:

aws ecr describe-images --repository-name <my-repo> --region <my-region> --query 'sort_by(imageDetails,&imagePushedAt)[-1]'

{
    "registryId": "*****",
    "repositoryName": "*******************",
    "imageDigest": "sha256:***************************************",
    "imageTags": [
        "****"
    ],
    "imageSizeInBytes": **********,
    "imagePushedAt": "***********************",
    "imageManifestMediaType": "***********************************************",
    "artifactMediaType": "***********************************************"
}
Enter fullscreen mode Exit fullscreen mode

but with the suffix --output table you can get a (IMO) much better layout

aws ecr describe-images --repository-name <my-repo> --region <my-region> --query 'sort_by(imageDetails,&imagePushedAt)[-1]' --output table
-------------------------------------------------------------------------------------------------------
|                                           DescribeImages                                            |
+-------------------------+---------------------------------------------------------------------------+
|  artifactMediaType      |  application/vnd.docker.container.image.v1+json                           |
|  imageDigest            |  sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  |
|  imageManifestMediaType |  application/vnd.docker.distribution.manifest.v2+json                     |
|  imagePushedAt          |  2025-01-01T00:00:00.000000+00:00                                         |
|  imageSizeInBytes       |  123456789                                                                |
|  registryId             |  000000000000                                                             |
|  repositoryName         |  my-repo                                                          |
+-------------------------+---------------------------------------------------------------------------+
||                                             imageTags                                             ||
|+---------------------------------------------------------------------------------------------------+|
||  my-tag                                                                                   ||
|+---------------------------------------------------------------------------------------------------+|
Enter fullscreen mode Exit fullscreen mode

Comments 2 total

Add comment