In CDK, if I have something like this:

const repository = new ecr.Repository(this, 'SomeRepository', {
  repositoryName: 'SomeRepository',

const lambda = new lambda.DockerImageFunction(this, 'SomeLambda, {
  code: lambda.DockerImageCode.fromEcr(repository, { tag: 'latest' },
  functionName: 'SomeLambda',
  vpc: this.vpc,
  vpcSubnets: this.vpcSubnets,

CDK will fail to deploy, because there is no image present in the ECR that was just barely created. The idea is to set everything up, and then setup github actions to upload the image, and tell the lambda where to get the code.

How can I get everything set up so that it is ready for CD like this?

1 Answer 1


You can use DockerImageAsset to initialize ECR with a base image like scratch or alpine, or even the most basic lambda container that would get your lambda function to execute.



Later, when you get the github actions going you just replace the image

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.