Aws-cdk: CDK list is slow

Created on 6 Sep 2019  路  4Comments  路  Source: aws/aws-cdk

:question: General Issue

The Question

I'm used to using cdk ls to quickly list my stacks. As I add constructs with docker and other assets, it's getting less and less usable. This is because many files are being copied to cdk.out. How have you folks dealt with this slow cdk ls issue?

Environment

  • CDK CLI Version: 1.7.0 (build 8870695)
  • OS: all
  • Language: all

Other information

I understand this is because cdk is doing full synth and then listing the available stacks.
I'm thinking there should have been a faster way, e.g a lightweight way to calculate the dependency graph among the available stacks. This would skip copying many files to cdk.out which is the bottleneck in my use case.

needs-triage

Most helpful comment

I've just found that we can skip synth by reusing what's already in cdk.out. This is achieved with:
cdk --app cdk.out ls

This is sufficient for my needs.

All 4 comments

I have 13 stacks in our CDK app, that have a bunch of statemachines and ~20 lambdas.
I've just started our monthly upgrade ticket to get up to 1.7.0 and ran cdk list. It's been running 11 minutes and not yet done.

edit: Silent exit after 30 minutes :/

Michael, this sucks big time. Check the directory sizes under cdk.out. It can give you a hint on how to better organise your source code.
The performance is even worse if you're not using JS/Typescript.

It seems my issue is regarding some sort of credentials change, running cdk list -v shows it hangs on Resolving default credentials. I would expect the cdk to use the same permission model as the aws-cli, which is working without issues in the same environment, but it seems to do it differently.
Our upgrade path is from 1.3.0 to 1.7.0.

I think it is this issue https://github.com/aws/aws-cdk/issues/3340
edit: seems is something else still, investigating

I've just found that we can skip synth by reusing what's already in cdk.out. This is achieved with:
cdk --app cdk.out ls

This is sufficient for my needs.

Was this page helpful?
0 / 5 - 0 ratings