Skip to content

Backfill Lambda layer versions for multi-region consistency#73

Open
RaphaelManke wants to merge 7 commits into
masterfrom
claude/lambda-layer-backfill-rths3i
Open

Backfill Lambda layer versions for multi-region consistency#73
RaphaelManke wants to merge 7 commits into
masterfrom
claude/lambda-layer-backfill-rths3i

Conversation

@RaphaelManke

Copy link
Copy Markdown
Contributor

Summary

Add helper script and CI integration to align Lambda layer version counters across regions for new region launches (e.g., Israel, il-central-1).

Changes

1. Helper Script: tools/backfill-layer-versions.sh

  • Aligns Lambda layer version counters between regions
  • Publishes minimal dummy zips, deletes immediately to advance counter
  • Preserves existing real versions in target region
  • Supports --dry-run for safe previewing
  • Usage: ./tools/backfill-layer-versions.sh [--dry-run] <source-region> <target-region> [layer-names...]

2. Workflow Integration: publish.yml

  • New backfill job runs before deploy steps
  • Only runs in prod environment (prod-integration)
  • Skips eu-west-1 (canonical source region)
  • Backfill failure blocks deployment (strict mode)
  • Reuses existing AWS credentials per region
  • Deploy jobs (python, node, java, manual) depend on backfill completion

3. Cleanup: deploy.yml

  • Removed separate sequential backfill-prod job
  • deploy-prod now depends directly on build

Testing

  • Dry-run tested on eu-central-1 → il-central-1 (fresh region)
  • Dry-run tested on eu-central-1 → us-west-1 (partially-filled region)
  • Live backfill completed on eu-central-1 → us-west-1:
    • python: 6 → 43 (37 dummies)
    • node: 6 → 41 (35 dummies)
    • java: 4 → 41 (37 dummies)
    • manual: 4 → 41 (37 dummies)

Rollout

  1. Merge this PR
  2. For a new region (e.g., il-central-1):
    • Add region to deploy.yml region matrices
    • Trigger `workflow_dispatch` → backfill runs automatically before deploy
  3. Manual one-off backfill available anytime: `./tools/backfill-layer-versions.sh --dry-run eu-west-1 `

Resolves CLO-944.

claude and others added 4 commits July 15, 2026 06:26
Lambda layer versions auto-increment per region and cannot be chosen, so
a newly launched region (e.g. il-central-1) would start at version 1
while all existing regions are at some aligned version N. The sls-plugin
ARN builder assumes the same layer name + version resolves in every
region.

The script reads the highest version per layer from a source region and
publishes dummy versions (deleted immediately after publishing) in the
target region until its version counter matches. The next real deploy
then produces the same version number in the new region as everywhere
else. Supports --dry-run, defaults to the four prod layers, and aborts
with a clear error if the target counter is already ahead.

After running it for il-central-1, the region can be added to the
deploy.yml region matrices (separate change).

Resolves CLO-944.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HQm5yBAanBxSAuohiWuiKn
The query LayerVersions[0].Version sometimes returns extra None lines
alongside the actual version number. Filter to first non-empty line.
The prod deploy pipeline now includes a pre-deploy step that checks all
regions against eu-west-1 (source) and backfills any misaligned version
counters. This ensures new regions and any region that diverged from the
source will have aligned version numbers before publishing new layer
versions.

The backfill runs for each of the 16 non-source regions, using || true
to log but not block deploy if a region fails (rare edge case).
@RaphaelManke
RaphaelManke marked this pull request as ready for review July 15, 2026 09:10
…l is skipped

Resolves the Aikido finding on the backfill step: inputs.region was
interpolated directly into the run command, a template-injection sink;
it is now passed through an environment variable.

Also fixes the deploy jobs being skipped whenever the backfill job is
skipped (dev environment, eu-west-1): a skipped dependency counts as
not-success for the default job condition, so deploy-python/node/java/
manual now run when backfill succeeded or was skipped, but still not
when it failed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HQm5yBAanBxSAuohiWuiKn
The span/log query window (now +/- 5min, recomputed per retry attempt)
slid past the invocation timestamp after ~5 minutes of retrying, making
late-arriving telemetry permanently unfindable and burning the whole
retry budget. Extend the lookback to 20 minutes for span, log, and
metric queries so the invocation stays inside the window for the full
50 x 10s retry budget.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HQm5yBAanBxSAuohiWuiKn
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