Skip to main content

CDK ECR Asset Scanner

The CDK ECR Asset Scanner is a custom L3 ScannedDockerImageAsset construct that builds and uploads your container image assets to ECR. After pushing, it will return the vulnerability report status in a Stack Output. In that way, it gives crucial and important security related information directly back to the engineer working with the stack. It aims to improve security insight while working with AWS CDK.

As stated before, ScannedDockerImageAsset is a custom L3 construct in the AWS Construct Library that combines the following L2 Constructs:

  • DockerImageAsset
  • A Custom Resource backed by a Lambda function
  • Stack outputs

Because it just combines existing Constructs, this means the ScannedDockerImageAsset is a very stable L3 construct, not deemed experimental.

Terminal

USAGE

Run npm i cdk-ecr-asset-scanner.

Just add the ScannedDockerImageAsset to your imports, and use it exactly like you would a normal DockerImageAsset. It will do all the heavy lifting under the hood by itself. Make sure cdk peer dependencies are correct as usual, but npm will point those out (> 1.118.0 cdk versions)

Example (ts):

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk_ecr_asset_scanner import ScannedDockerImageAsset
import path as path

env = {
    "region": process.env.CDK_DEFAULT_REGION,
    "account": process.env.CDK_DEFAULT_ACCOUNT
}

app = cdk.App()

class TestStack(cdk.Stack):
    def __init__(self, scope, id, props=None):
        super().__init__(scope, id, props)

        # Image without scan
        # const image3 = new DockerImageAsset(this, "zzz", {
        #   directory: path.join(__dirname, "../src/"),
        # });

        # Image with scan
        image = ScannedDockerImageAsset(self, "zzz",
            directory=path.join(__dirname, "../src/")
        )
        image3 = ecs.ContainerImage.from_docker_image_asset(image)

        task_definition = ecs.FargateTaskDefinition(self, "test-task-definition",
            memory_limit_mi_b=2048,
            cpu=1024
        )
        task_definition.add_container("container_example_three",
            image=image3,
            environment={
                "TEST_VAR": "THREE"
            },
            logging=ecs.AwsLogDriver(
                stream_prefix="three"
            )
        )
TestStack(app, "hh-stack", env=env)

Availability

  • Typescript / JS
  • Python

Metadata

Release files for cdk-ecr-asset-scanner 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdk-ecr-asset-scanner 0.0.8
File Size Uploaded
cdk-ecr-asset-scanner-0.0.8.tar.gz 74.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cdk-ecr-asset-scanner 0.0.8
File Interpreter ABI Platform
cdk_ecr_asset_scanner-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 147.2 kB

Release files / cdk-ecr-asset-scanner-0.0.8.tar.gz

Download URL cdk-ecr-asset-scanner-0.0.8.tar.gz
Size 74.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3574667d6412de1f678cd062a05bab1852677ee0fdb23dc577a9831e2af402ba
BLAKE2b-256 checksum
How to use checksums
b293dce00e2aacb73d49d6a7220cde2afe7c79fd27cbe2f446f954f4d5f175e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10

Release files / cdk_ecr_asset_scanner-0.0.8-py3-none-any.whl

Download URL cdk_ecr_asset_scanner-0.0.8-py3-none-any.whl
Size 73.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42a7ca8b70d58ca239a03ae1745bc9292fbf7932c6825e82cf59dfda288f3768
BLAKE2b-256 checksum
How to use checksums
b6918083514e81a5fb02335716c7b51930516560bb05933e1c9e30c0bbd2e31c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.7.10

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page