amazon-web-servicesdockeraws-cdkinfrastructure

CDK: aws_cdk.aws_ecs.EcrImage vs aws_cdk.aws_ecs.ContainerImage


What is the difference between using aws_cdk.aws_ecs.EcrImage and aws_cdk.aws_ecs.ContainerImage to create instances using CDK?


Solution

  • Not much. ecs.EcrImage specifically represents an Amazon ECR Registry image. It extends ecs.ContainerImage construct, adding only an imageName property.

    ContainerImage has static methods to return non-ECR (e.g. DockerHub) images. Perhaps confusingly, EcrImage inherits these factory methods as well.