Skip to content

feat(rds): MySQL/MariaDB Lambda bridge + prebuilt images#810

Merged
vieiralucas merged 1 commit intomainfrom
worktree-rds-mysql-mariadb-lambda
Apr 28, 2026
Merged

feat(rds): MySQL/MariaDB Lambda bridge + prebuilt images#810
vieiralucas merged 1 commit intomainfrom
worktree-rds-mysql-mariadb-lambda

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Apr 28, 2026

Summary

Aurora MySQL parity for mysql.lambda_async / mysql.lambda_sync. SQL inside an RDS-managed MySQL or MariaDB instance can now invoke fakecloud Lambda functions, mirroring what we shipped for postgres in #806.

  • New fakecloud-mysql + fakecloud-mariadb images bake a libcurl-backed UDF (fakecloud_post, fakecloud_post_async) and a bootstrap that creates the Aurora-compatible stored procedures on first start.
  • Runtime: ensure_mysql_image / ensure_mariadb_image reuse the postgres pull-first / build-fallback flow via a new shared ensure_bridge_image helper.
  • MySQL/MariaDB containers now receive the same FAKECLOUD_* env vars postgres already gets so the bootstrap can render the bridge URL.
  • docker-rds-images.yml matrix extended over engine × version × arch (3 engines, 9 version+engine combinations, 2 arches).
  • E2E test (rds_mysql_lambda.rs) drives both engines end-to-end.

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • cargo test -p fakecloud-rds (120 tests)
  • cargo test -p fakecloud-e2e --test rds_mysql_lambda (Docker-bound, in CI)
  • docker-rds-images.yml PR run exercises mysql + mariadb image builds for both arches

Notes

  • The first call to CreateDBInstance with engine=mysql or engine=mariadb will compile the libcurl UDF inside the container the first time the image is built locally; subsequent invocations reuse the cached image. After v0.13.2 publishes, end users will pull the prebuilt image and skip the build entirely.
  • Existing MySQL/MariaDB tests that didn't exercise the bridge keep working — only env vars and the image source change.

Summary by cubic

Adds an Aurora-compatible Lambda bridge for MySQL and MariaDB so SQL can invoke fakecloud Lambda via mysql.lambda_async and mysql.lambda_sync. Ships prebuilt fakecloud-mysql and fakecloud-mariadb images and updates the runtime to pull-first with a local build fallback.

  • New Features

    • Prebuilt fakecloud-mysql and fakecloud-mariadb images with a libcurl-backed UDF (fakecloud_post, fakecloud_post_async) and a bootstrap that creates mysql.lambda_async/mysql.lambda_sync.
    • Runtime support: RdsRuntime::ensure_mysql_image and RdsRuntime::ensure_mariadb_image mirror the postgres flow to pull images or build locally.
    • CI: docker-rds-images.yml now builds/publishes postgres/mysql/mariadb across version × arch with tags like <version>-<release> and a rolling <version>.
    • E2E: rds_mysql_lambda.rs covers sync and async invocations on both engines.
    • Docs: README and RDS docs describe the MySQL/MariaDB bridge and image usage.
  • Refactors

    • Added shared helpers ensure_bridge_image and bridge_image_tag to centralize pull-first/build-fallback and tagging across engines.
    • MySQL/MariaDB containers now receive FAKECLOUD_* env vars, and bridge-aware engines add the host.docker.internal alias for in-container callbacks.

Written for commit 893fa2f. Summary will update on new commits. Review in cubic

Aurora MySQL exposes Lambda invocation as built-in stored procedures
(`mysql.lambda_async`, `mysql.lambda_sync`). fakecloud now ships the
same surface for both MySQL and MariaDB:

- New `fakecloud-mysql` and `fakecloud-mariadb` images that bake a
  small libcurl-backed UDF (`fakecloud_post`, `fakecloud_post_async`)
  plus an Aurora-compatible bootstrap script that creates the stored
  procedures on first container start. Procedures POST to
  `/_fakecloud/rds/lambda-invoke` against `host.docker.internal`,
  reusing the same bridge endpoint as the postgres `aws_lambda`
  extension.
- `RdsRuntime::ensure_mysql_image` / `ensure_mariadb_image` mirror the
  existing postgres pull-first/build-fallback path; a shared
  `ensure_bridge_image` helper centralizes the per-tag mutex + force-
  rebuild env knob across all three engines.
- MySQL/MariaDB containers now receive the same `FAKECLOUD_*` env vars
  postgres already gets so the bootstrap can render the host endpoint
  and account ID into the procedure bodies.
- `docker-rds-images.yml` extended with an engine-axis matrix
  (postgres/mysql/mariadb), publishing nine version+engine
  combinations on each release tag.
- E2E test (`rds_mysql_lambda.rs`) drives both engines: create echo
  Lambda, spin up the container, exercise `mysql.lambda_sync` and
  `mysql.lambda_async` end-to-end.
@vieiralucas vieiralucas merged commit 26be068 into main Apr 28, 2026
27 of 40 checks passed
@vieiralucas vieiralucas deleted the worktree-rds-mysql-mariadb-lambda branch April 28, 2026 01:54
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 7.74648% with 131 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/fakecloud-rds/src/runtime.rs 7.74% 131 Missing ⚠️

📢 Thoughts on this report? Let us know!

vieiralucas added a commit that referenced this pull request Apr 28, 2026
`aws_lambda_bridge_mysql_round_trip` and the matching mariadb test in
PR #810 use `engine_version("8.0")` / `("10.11")` — short major-only
strings AWS RDS accepts. The CreateDBInstance validator only knew about
full `<major>.<minor>.<patch>` strings (`8.0.35`, `10.11.6`), so both
tests have been failing on every main run since #810 merged with
`EngineVersion 'X' is not supported yet.`

Add the short majors for postgres, mysql, and mariadb to
`supported_versions`. The runtime already resolves them — it parses
the prefix to pick an image tag — so this is a validator-only gap.
vieiralucas added a commit that referenced this pull request Apr 28, 2026
`aws_lambda_bridge_mysql_round_trip` and the matching mariadb test in
PR #810 use `engine_version("8.0")` / `("10.11")` — short major-only
strings AWS RDS accepts. The CreateDBInstance validator only knew about
full `<major>.<minor>.<patch>` strings (`8.0.35`, `10.11.6`), so both
tests have been failing on every main run since #810 merged with
`EngineVersion 'X' is not supported yet.`

Add the short majors for postgres, mysql, and mariadb to
`supported_versions`. The runtime already resolves them — it parses
the prefix to pick an image tag — so this is a validator-only gap.
vieiralucas added a commit that referenced this pull request Apr 28, 2026
`aws_lambda_bridge_mysql_round_trip` and the matching mariadb test in
PR #810 use `engine_version("8.0")` / `("10.11")` — short major-only
strings AWS RDS accepts. The CreateDBInstance validator only knew about
full `<major>.<minor>.<patch>` strings (`8.0.35`, `10.11.6`), so both
tests have been failing on every main run since #810 merged with
`EngineVersion 'X' is not supported yet.`

Add the short majors for postgres, mysql, and mariadb to
`supported_versions`. The runtime already resolves them — it parses
the prefix to pick an image tag — so this is a validator-only gap.
vieiralucas added a commit that referenced this pull request Apr 28, 2026
`aws_lambda_bridge_mysql_round_trip` and the matching mariadb test in
PR #810 use `engine_version("8.0")` / `("10.11")` — short major-only
strings AWS RDS accepts. The CreateDBInstance validator only knew about
full `<major>.<minor>.<patch>` strings (`8.0.35`, `10.11.6`), so both
tests have been failing on every main run since #810 merged with
`EngineVersion 'X' is not supported yet.`

Add the short majors for postgres, mysql, and mariadb to
`supported_versions`. The runtime already resolves them — it parses
the prefix to pick an image tag — so this is a validator-only gap.
vieiralucas added a commit that referenced this pull request Apr 28, 2026
`aws_lambda_bridge_mysql_round_trip` and the matching mariadb test in
PR #810 use `engine_version("8.0")` / `("10.11")` — short major-only
strings AWS RDS accepts. The CreateDBInstance validator only knew about
full `<major>.<minor>.<patch>` strings (`8.0.35`, `10.11.6`), so both
tests have been failing on every main run since #810 merged with
`EngineVersion 'X' is not supported yet.`

Add the short majors for postgres, mysql, and mariadb to
`supported_versions`. The runtime already resolves them — it parses
the prefix to pick an image tag — so this is a validator-only gap.
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