Skip to content

feat: add native engine support for AWS Lambda bundle and deploy#126

Merged
outofcoffee merged 2 commits into
mainfrom
feat/native-lambda-bundle
May 25, 2026
Merged

feat: add native engine support for AWS Lambda bundle and deploy#126
outofcoffee merged 2 commits into
mainfrom
feat/native-lambda-bundle

Conversation

@outofcoffee
Copy link
Copy Markdown
Contributor

Closes #61.

Adds support for bundling and deploying the native imposter-go binary to AWS Lambda alongside the existing JVM flavour, with engine type derived from version when not specified explicitly.

Summary

  • Generalise version-major parsing in internal/engine/version.go and reuse it from both UsesEnvConfig and the new DeriveEngineTypeFromVersion. v5+ derives to the native engine; latest keeps the existing default until latest is rebased onto v5.
  • Add GetConfiguredTypeWithVersion so commands that already accept a --version flag (e.g. up, bundle) can derive the engine type without going through viper.
  • Gate the Lambda binary download in internal/engine/awslambda/binary.go on the engine type — JVM uses the existing imposter-jvm-engine zip, native pulls per-architecture imposter-awslambda_<arch>.zip from imposter-go and caches it by arch + version.
  • Introduce a lambdaFlavour abstraction (internal/remote/awslambda/flavour.go) so the deploy path picks the right runtime, handler, environment variables and SnapStart support per engine. Native deploys onto provided.al2023 with the bootstrap handler, no JVM-only env vars, and SnapStart disabled (with a warning if the user has it enabled).
  • Add an --architecture / -a flag to imposter bundle (default amd64) that flows through to the binary fetch and zip contents.
  • Plumb the configured Lambda architecture from internal/remote/awslambda/deploy.go into CreateDeploymentPackage via a new goArchFor translator so AWS Lambda arch (x86_64/arm64) maps to the Go arch (amd64/arm64) used by the native binary releases.

Implementation details

  • DeriveEngineTypeFromVersion returns EngineTypeNone for empty/latest/unparseable versions so callers fall back to their own default without spreading the v5 cut-off across the codebase.
  • The flavour split is kept inside the awslambda remote package and selected by version, which means existing JVM deployments behave unchanged and the gating logic lives next to the deploy code it affects.
  • LambdaProvider gained an Architecture field rather than another constructor parameter, so the engine.Provider interface and its other implementations stay untouched; cmd/bundle.go type-asserts to set it.
  • The native binary file name (imposter-awslambda_<arch>.zip) follows the convention used by the imposter-go release pipeline; if that naming changes before v5 ships it is a single edit in binary.go.

Gates the Lambda binary download, runtime, handler, env vars and SnapStart
on engine type so the native imposter-go binary can be bundled and deployed
alongside the existing JVM flavour. When the engine type is not specified
but a version is, the engine is derived from the version (v5+ → native).

Adds an --architecture flag to `imposter bundle` so per-architecture
native binaries can be selected, with the value threaded through to the
binary download and cache paths.
@outofcoffee outofcoffee added the enhancement New feature or request label May 24, 2026
@outofcoffee outofcoffee self-assigned this May 24, 2026
The imposter-go releases ship per-arch `imposter-go_linux_<arch>.tar.gz`
artefacts containing a plain `imposter-go` binary, not a pre-built Lambda
zip. Download that tarball, extract the binary, and write a Lambda-ready
zip containing a single executable `bootstrap` entry for the
provided.al2023 custom runtime.
@outofcoffee outofcoffee merged commit 11b1f2e into main May 25, 2026
8 checks passed
@outofcoffee outofcoffee deleted the feat/native-lambda-bundle branch May 25, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add golang bundle support

1 participant