Skip to content

feat(aws-node-customer-managed-runtime): add an example that publishes a customer-managed runtime and runs a function on it - #831

Merged
czubocha merged 5 commits into
v4from
aws-node-customer-managed-runtime
Nov 24, 2026
Merged

czubocha merged 5 commits into
v4from
aws-node-customer-managed-runtime

Conversation

@czubocha

Copy link
Copy Markdown
Contributor

Summary

  • Add aws-node-customer-managed-runtime, a Compose example with two services:
    • runtime publishes a customer-managed Lambda runtime: AWS::Lambda::Runtime, a version v1 from a container image, and the alias stable, with the alias ARN as a stack output.
    • app runs a Node.js function on it. Compose passes the output in, and the function sets provider.runtime: ${param:runtimeAliasArn}.
  • The runtime image is the Lambda Node.js 24 base image plus /etc/runtime-info.json. The function returns that file's contents, which only this runtime has. The image is built for arm64 with a COPY-only Dockerfile, so it builds on any machine.
  • The README shows the steps before the deploy: create the ECR repository, set a repository policy that lets Lambda read runtime images, then build and push. It also explains that Lambda keeps a deleted runtime's name reserved for up to 30 days.
  • test/prepare.mjs runs the README's image steps for the live test, and test/cleanup.mjs deletes the repository. test/smoke.mjs invokes the function and asserts Hello from platform-node24 v1. The tier is slow, because of the container image.
  • The root README.md and examples.json are regenerated.

Lesson: publish a runtime from a container image, and run a function on it through its alias.

Left out:

  • sharing the runtime with other accounts;
  • publishing v2 and moving the alias, and runtimeManagement pins;
  • a runtime that adds a real SDK or agent;
  • multi-architecture images.

The README's Next steps link the docs for these.

Depends on:

Test plan

  • npm run docs, check-examples.mjs (0 errors) and npm test (323 pass).
  • check-examples.mjs --package: app cannot be packaged before runtime is deployed, because it reads that service's output. compose-multiframework stops the same way, and CI does not run --package; the live test covers the deploy.
  • Live test in a development account, us-east-1, with the CLI from the source of main: PASS aws-node-customer-managed-runtime 4.46.0 153s. The result line shows the last release's number.
  • The same live test using only the updated live-test role's credentials: PASS aws-node-customer-managed-runtime 4.46.0 150s.
  • Negative control: a copy expecting v2 fails at the check step (expected the output to contain "Hello from platform-node24 v2"; got … "Hello from platform-node24 v1"), and then removes and cleans up.
  • A first run without the repository policy stopped at deploy with Lambda does not have permission to access the ECR image. The policy is now in the README and in test/prepare.mjs, and the run removed its stacks and repository.
  • The README run by hand, and by a fresh agent given only the README: the same deploy and invoke output, with no step guessed.
  • After every run, read-only listings show no stack, ECR repository or log group left. Each run's runtime remains in Lambda's pending-deletion window, as the README says.

Generated by Claude Code

@czubocha
czubocha changed the base branch from test-prepare-cleanup-hooks to v4 November 24, 2026 17:51
@czubocha
czubocha merged commit 299bfac into v4 Nov 24, 2026
5 of 6 checks passed
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.

1 participant