Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Railway 5 min read How-to mediumAdept

How to Migrate from AWS Lambda to Railway

An AWS Lambda function can be moved to Railway by packaging it as a container image built on the AWS Lambda Node.js base image and pushing it to Docker Hub. Railway then deploys it as a Docker Image service with a generated public domain. The function is invoked through the Lambda Runtime Interface Emulator path (/2015-03-31/functions/function/invocations), can be tested locally with docker run and curl, and can scale to zero with Railway's App Sleep. Railway has no built-in timeout or retry configuration, so the application must handle these itself, and environment variables and external dependencies have to be recreated in Railway Variables.

Related posts

  • Squeezing every millisecond: How we rebuilt the Datadog Lambda Extension in Rust

    Datadog Engineering mediumAdept

    Datadog rewrote its AWS Lambda Extension from a Go build of the full Datadog Agent into a purpose-built Rust sidecar (Project Bottlecap), cutting cold start overhead from about 450 ms to 70 ms, memory from 128 MiB to 77 MiB, and binary size from 55 MB to 7 MB. The team benchmarked every PR against cold start overhead and hand-wrote AWS API calls and signatures instead of using SDKs. To cover both API-style and batch workloads, the extension supports configurable flush strategies: flushing at the end of an invocation, racing it, flushing periodically, or combining these. Rollout used a roughly 4 ms startup check that fails over to the bundled legacy extension when it detects unsupported configurations, with telemetry on fallbacks guiding which features to support next.

  • Using Github Actions with Railway

    Railway mediumAdept

    Railway deployments can be driven from GitHub Actions instead of the built-in branch-push trigger by creating a project token, storing it as a repository secret (RAILWAY_TOKEN), and running `railway up --service=<id>` inside the official Railway CLI container. A sample workflow triggers on pushes to main, checks out the code and uploads it to Railway. The token must stay secret, but the service ID can be passed openly. The same token approach also works for tasks like running database migrations before deploy or managing pull requests.

  • Using GitLab CI/CD with Railway

    Railway mediumAdept

    Deploying to Railway from GitLab CI/CD comes down to a project token plus a small job that runs the Railway CLI. Create a project token in the Railway project settings and store it as a secret GitLab CI/CD variable (RAILWAY_TOKEN). A minimal .gitlab-ci.yml then uses the ghcr.io/railwayapp/cli image to run `railway up --service=$SVC_ID` on pushes to the default branch, while Railway's own infrastructure does the build. Teams can instead build artifacts in GitLab CI and deploy them with the CLI. The token must stay secret, but the service ID can be exposed safely.

  • Manually Optimize Deployments on Railway

    Railway mediumAdept

    Deploying a FastAPI app on Railway three ways shows large speed differences: the default Nixpacks builder took 1m27s, a slim-based custom Dockerfile took 15 seconds, and pulling a pre-built image from Docker Hub took 6 seconds. Dockerfile size tips include slim/alpine base images, multi-stage builds, fewer layers and .dockerignore. The setup is then automated with two GitHub Actions workflows: one builds and pushes the image to Docker Hub on push to main, and a second triggers a Railway CLI redeploy when the first completes.

  • One-Second Deploys? We Didn’t Believe It Either

    Railway easyNovice

    Railway Functions, now generally available, deploy single-file TypeScript code onto Railway's container compute in about a second, without a package.json, Git repo, IaC or container build. The pipeline parses source into an AST to infer dependencies and generates package.json on the fly, with versions pinnable directly in import specifiers. Dependencies are installed with `bun install`, which installs fastify in 500ms compared with over 6s for npm, pnpm and yarn without a lockfile. Bun then runs the TypeScript directly with no transpile or bundle step. Functions share Services' features such as volumes and variables.

The quest for software engineering knowledge.

Look:
Layout: