Skip to content

(cli ls): building of Lambda layers is not disabled during "cdk ls" #14747

Closed
@imincik

Description

Lambda functions bundling is disabled by default when running command such as cdk ls , but building of Lambda layers is not.

This results in long delays until command returns desired output and output is populated by Docker build messages which makes it very hard to read. Also, Docker image needs to be downloaded when not locally available, which can extend command execution time to very long time.

Reproduction Steps

Run cdk ls with following code in app.py:

from aws_cdk import aws_lambda, aws_lambda_python, core


class LambdaLayer(core.Stack):
    def __init__(self, app: core.App, stack_id: str) -> None:
        super().__init__(app, stack_id)

        layer = aws_lambda_python.PythonLayerVersion(
            self,
            f"lambda-layer",
            entry=".",
            compatible_runtimes=[aws_lambda.Runtime.PYTHON_3_8],
        )


app = core.App()
LambdaLayer(app, "lambda-layer")
app.synth()

What did you expect to happen?

I expect command to quickly return list of CDK stacks .

What actually happened?

CDK starts downloading Docker image it needs to build Lambda layer (executed only once) and builds the layer (executed always).

Command output is following:

$ cdk ls

Sending build context to Docker daemon  2.048kB
Step 1/4 : ARG IMAGE=amazon/aws-sam-cli-build-image-python3.7
Step 2/4 : FROM $IMAGE
 ---> 40e4293ff66e
Step 3/4 : RUN yum -q list installed rsync &>/dev/null || yum install -y rsync
 ---> Using cache
 ---> f0d7fe9bb69b
Step 4/4 : CMD [ "python" ]
 ---> Running in edeba5efd7dc
Removing intermediate container edeba5efd7dc
 ---> d5ca8ee099d3
Successfully built d5ca8ee099d3
Successfully tagged cdk-9215bb63fac76077ff7cf3db5f65c8184df47c073d23e625953a8fd0fd539612:latest
lambda-layer

Environment

  • CDK CLI Version : 1.103.0 (build bc13a66)
  • Framework Version:
  • Node.js Version: v14.15.4
  • OS : Ubuntu 18.04
  • Language (Version): Python 3.8.6

Other


This is 🐛 Bug Report

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.effort/mediumMedium work item – several days of effortp1package/toolsRelated to AWS CDK Tools or CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions