Skip to content

Conversation

@ividito
Copy link
Collaborator

@ividito ividito commented Oct 22, 2025

Why?

cdk synth and cdk diff take a long time (5-15 minutes, depending on local resources and cache hits) because in order to interact with the CDK stack, the app.synth() call must build all of the docker assets we use. By changing how we bundle Docker assets, we can dramatically improve synth (and possibly deploy) times.

What?

  • @hrodmn made this work for titiler-cmr, and it carries over to our lambdas really well
  • Dockerfiles are refactored, and produce small, optimized images that automatically go into ECR
  • Ingest API excluded, because we use the same image with different entrypoints, and I haven't worked out how to integrate that yet
  • DB bootstrapper is excluded because it's structured and executed differently.

Eventually we could go even further, by managing the ECR images ourselves. This would allow us to update a specific service without deploying the full stack (which would definitely accelerate deployments)

Testing?

time cdk synth before (on develop)
Pasted image 20251016214746

time cdk synth after
Pasted image 20251016214132

Deployment to mcp-test and uah-sit (not done yet)

  • uah (to test runtimes)
  • mcp (to test ECR deployment and permissions)

# TODO config
stack_name = Stack.of(self).stack_name

veda_raster_function = aws_lambda.Function(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI there might be a performance hit on Lambda init time by switching from the zip package to a DockerImageFunction. We were forced into this change in titiler-cmr because we were bumping into the 250 MB limit for the function's code (many heavy dependencies). You should be able to use some of the same patterns from the Dockerfile to improve the build time for a typical Function, though.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants