HostingArtisan Community for Web Artisans
CI/CD Pipelines & DevOps

GitLab CI taking 25min to deploy a single Lambda, how do I speed this up?

5 replies · 5 views
#1 — Original Post
26 Mar 2026, 09:35
P
pipeliner

Hey folks, I'm losing my mind here. We've got a fairly simple Node.js Lambda that gets packaged and deployed via GitLab CI, but the pipeline is taking 25 minutes end-to-end. Most of that time seems to be just... waiting.

Our setup:

  • Docker executor on a Hetzner box (16 CPU, plenty of RAM)
  • npm install, build, zip, then aws lambda update-function-code
  • Nothing fancy, no tests taking forever

I've already:

  • Switched to npm ci instead of install
  • Enabled Docker layer caching
  • Moved artifacts to fast storage

But it's STILL slow. Anyone else hitting this? Is it just the nature of Lambda deployments or am I missing something obvious? Would switching to GitHub Actions help or is it the same issue?

Edited at 26 Mar 2026, 11:47

#2
26 Mar 2026, 09:45
N
nullbyte

Check if your Docker executor is pulling the image every run—that alone can eat 5-10min. Add pull_policy: if-not-present to your .gitlab-ci.yml. Also, what's your artifact transfer doing? If you're uploading the zip to S3 or similar before the Lambda update, that could be slow. Consider using IAM role auth directly and skip the intermediate storage. Last thing: enable BuildKit for faster builds—https://docs.docker.com/build/buildkit/

#3
26 Mar 2026, 09:50
P
pipeliner

Ah good point! Yeah, I checked and we were pulling the image fresh every time. Added pull_policy: if-not-present and it shaved off like 6 minutes already. The artifact transfer was also slower than expected, but caching the Docker layers helped a lot there too. Thanks for the nudge in the right direction!

#4
26 Mar 2026, 10:00
S
serverless_fan

Glad you got some wins! One thing I'd check next—are you zipping the whole node_modules folder? For Lambda, you can often strip dev dependencies and non-essential files. I use npm ci --omit=dev + a simple script to remove heavy stuff (like @types/* if you're not bundling TypeScript). That alone saved us like 8min on a similar setup. Also, if your Lambda is under 50MB uncompressed, consider skipping the zip step entirely and using aws lambda update-function-code with a direct S3 upload—sometimes faster than local packaging.

#5
26 Mar 2026, 10:05
V
vim_exit

also try switching to esbuild instead of webpack if you're using it, cuts our lambda builds in half

#6
26 Mar 2026, 10:50
A
aws_guru

Pro tip: use Lambda layers for node_modules so you only zip/upload your actual code each deploy, cuts our times by like 70%.

You need to be logged in to reply.

Log in to Reply

Cookie Preferences

We use cookies to improve your experience and analyse traffic. You can accept all or use only essential cookies.

Essential Always on
Analytics Optional
Marketing Optional
Privacy · Terms ·