1

I am bundling lambda functions and lambda layers code using Docker. Like this:

code = Code.from_asset(
    path='/path/to/code',
    asset_hash_type=AssetHashType.BUNDLE,
    bundling=BundlingOptions(
        image=BundlingDockerImage.from_registry('python:3.9'),
        command=['bundling-command']
    )
)

However, to speed-up DEV deployments, I would like to skip bundling, because in certain scenarios I know that I did not change the lambda function or lambda layer code.

Is there some kind of explicit flag? E.g.

cdk deploy * --skip-bundle

Thank you!

maafk
  • 6,176
  • 5
  • 35
  • 58
Laimonas Sutkus
  • 3,247
  • 2
  • 26
  • 47
  • Do you want to not deploy a specific stack basically? – Ermiya Eskandary Oct 30 '21 at 12:19
  • No. I want to skip bundling and reuse a previously bundled image. I want to deploy all stacks. – Laimonas Sutkus Oct 31 '21 at 08:05
  • There isn't a way to do this, I think - because CDK is just sitting on top of CloudFormation, and generating a ChangeSet when you deploy. Because Docker Images are Assets bundled from your local area during the synth process, before being uploaded to an s3 bucket by CDK for use, it has no way to know what has or hasn't changed so it considers them all as new versions - and will always changeset them. You could write some custom code for your constructs that checks a git record or something and skips that lambda ... but that would be pretty deep in the bowels of CDK library. – lynkfox Oct 31 '21 at 13:19
  • "way to know what has or hasn't changed" - since I know what has not changed I should be able to control the deployment process with explicit --no-bundle flags. Makes sense? – Laimonas Sutkus Nov 02 '21 at 10:48

1 Answers1

0

You can use the -a (app) parameter to a specific folder that has the synthesized files. e.g. cdk -a cdk.out deploy --all

Patrick W.
  • 149
  • 1
  • 6