---
title: "How to Migrate from AWS Lambda to Railway"
description: "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."
url: "https://swe.quest/articles/how-to-migrate-from-aws-lambda-to-railway-e94376caa43bd890"
canonical: "https://blog.railway.com/p/migrate-from-aws-lambda-to-railway"
source: "Railway"
published: "2024-12-13"
difficulty: "medium"
kind: "How-to"
reading_minutes: 5
tags: ["serverless","containers","cloud","deployment"]
---

# How to Migrate from AWS Lambda to Railway

A post on [Railway](https://swe.quest/sources/railway.md), published 2024-12-13, 5 min read, How-to. Original: [https://blog.railway.com/p/migrate-from-aws-lambda-to-railway](https://blog.railway.com/p/migrate-from-aws-lambda-to-railway)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)
- [Cloud platforms](https://swe.quest/tags/cloud.md) (Infrastructure)
- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)

## Prerequisites

- Docker basics ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))
- AWS Lambda functions ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))

## Keywords

AWS Lambda, Railway, Docker, Docker Hub, App Sleep, Node.js

## Related posts

- [Squeezing every millisecond: How we rebuilt the Datadog Lambda Extension in Rust](https://swe.quest/articles/squeezing-every-millisecond-how-we-rebuilt-the-datadog-lambda-extension-in-rust-c788e8ecc0f0b212.md): Datadog Engineering · 2025-04-09 · Medium · 9 min read · Serverless, Rust, Performance engineering, Observability, Refactoring & migrations
  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.
- [Using Github Actions with Railway](https://swe.quest/articles/using-github-actions-with-railway-5eb8da35bcdd7f7c.md): Railway · 2021-06-04 · Medium · 2 min read · CI/CD, Deployment
  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.
- [Using GitLab CI/CD with Railway](https://swe.quest/articles/using-gitlab-ci-cd-with-railway-8ac9ff086ab7cb53.md): Railway · 2022-08-20 · Medium · 2 min read · CI/CD, Deployment
  Deploying to Railway from GitLab CI/CD comes down to a project token plus a small job that runs the Railway CLI.
- [Manually Optimize Deployments on Railway](https://swe.quest/articles/manually-optimize-deployments-on-railway-a679dfa34223c7fb.md): Railway · 2024-12-13 · Medium · 9 min read · Deployment, CI/CD, Containers, Python
  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.
- [One-Second Deploys? We Didn’t Believe It Either](https://swe.quest/articles/one-second-deploys-we-didn-t-believe-it-either-540280e06702d626.md): Railway · 2025-03-05 · Easy · 3 min read · Serverless, Deployment, TypeScript, Developer productivity
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
