惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
量子位
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
雷峰网
雷峰网
I
InfoQ
罗磊的独立博客
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
博客园 - 三生石上(FineUI控件)
The GitHub Blog
The GitHub Blog
K
Kaspersky official blog
P
Privacy & Cybersecurity Law Blog
S
SegmentFault 最新的问题
T
Threat Research - Cisco Blogs
H
Help Net Security
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
CERT Recently Published Vulnerability Notes
WordPress大学
WordPress大学
T
Tenable Blog
T
The Blog of Author Tim Ferriss
C
Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
博客园 - Franky
A
Arctic Wolf
T
Threatpost
Scott Helme
Scott Helme
C
Cybersecurity and Infrastructure Security Agency CISA
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
The Exploit Database - CXSecurity.com
G
GRAHAM CLULEY
Security Latest
Security Latest
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
V
Vulnerabilities – Threatpost
P
Privacy International News Feed
S
Schneier on Security
Latest news
Latest news
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com

Railway Blog

Where Railway is, and where it's going (Summer 2026) PaaS vs IaaS vs SaaS: What Each Means and Who Should Pick What in 2026 The Best Continuous Deployment Tools in 2026 The Best PaaS for Multi-Region Deployments in 2026 The Best Platforms for Monorepo Deployments in 2026 Compliance Isn't a Feature, It's a Posture What is BYOC (Bring Your Own Cloud)? A Developer's Guide for 2026 The Best Managed Kubernetes Hosting in 2026 The Best Container Registries in 2026 The Vanilla Cloud Tax: What Rolling Your Own on AWS Actually Costs What is a PaaS? A Developer's Guide for 2026 The Best Cloud Observability and Logging Tools in 2026 The Best PostgreSQL Hosting for Developers in 2026 The Best Multi-Region Hosting Platforms in 2026 The Best Platforms to Deploy AI Apps in 2026 (Not the Models, the Apps Around Them) The Agent-Native Cloud: What It Means and Why It Matters Incident Report: May 19, 2026- GCP Account Suspension Counting to 3 with a new builder processing 50M+ monthly builds Railway iOS preview now available via TestFlight Kill your onboarding: selling to 10,000+ new users a day Your AI wants to nuke your database. Guardrails fix that. Better Rails for Agents: A New Remote MCP and Railway Agent in the CLI Moving Railway's Frontend Off Next.js One command deploys, there's a Stripe APP for that From registrar to deployed: buying a domain inside Railway A letter to open source builders who deserve more Networking is a black box, we used eBPF to open it Heroku Walked So Railway Can Run Security Features Your Security Team Will Love Railway Runs Open Source, Now We're Funding It Railway raises $100M Series B to unburden the builders Deploy autoscaling services, AI Workflow automation, and LLM APIs Without Kubernetes Hosting Postgres with GeoLite2: a practical guide to IP geolocation, data loading, and updates Serverless functions vs containers: CI/CD, database connections, cron jobs, and long-running tasks Hosting Postgres with pgvector: provider tradeoffs, migrations, indexes, and tuning Introducing the Railway integration on Delve.co Secure Cloud Hosting for Compliance: A Practical Guide for Startups and Regulated Industries How G2X Unlocked Rapid Experimentation at Scale with Railway MindFort Runs 100+ AI Pen Testing Agents Without Their Previous $10k AWS Bill How Bilt's Marketing Engineering Team Delivers at Scale with Railway Railway Technology Partners: Earn Revenue on Templates You Didn't Build ~$1 Million Paid to Developers Who Built Railway Templates CI/CD for Modern Deployment: From Manual Deploys to PR Environments Kernel Powers 1,000+ AI Agents on $444/Month of Railway Infrastructure Deploy Full-Stack TypeScript Apps: Architectures, Execution Models, and Deployment Choices Railway vs Cloudflare: How Their Architectures Differ and When to Use Each Run Scheduled and Recurring Tasks with Cron Monitoring & Observability: Using Logs, Metrics, Traces, and Alerts to Understand System Failures Logs, Metrics, and Traces: What Does Each Signal Tell You? Server rendering benchmarks: Railway vs Cloudflare vs Vercel Top five Heroku alternatives Comparing top PaaS and deployment providers Pricing to Encourage Use The F in SOC2 stands for functional Deploy Together, Earn Together: Introducing Railway Partnerships How We Oops-Proofed Infrastructure Deletion on Railway Bring Back the Free Plan Railway MCP - Stateful, Serverful, Pay-per-use Infrastructure Hackathon: Winners Announced! Mark Your Calendar: Railway User Hackathon with Prizes Launching Railway's Affiliate Program Zero-Touch Bare Metal at Scale Ssh, We’re Announcing One More Thing! $1M for Open Source Introducing Central Station Speed Isn’t Just About Code, It’s About Where That Code Runs One-Second Deploys? We Didn’t Believe It Either Why We’re Moving on From Nix Railway V3: Faster and Cheaper How to Migrate from Cloudflare Pages to Railway Supercharging Directus on Railway with a Static Frontend Deploy Triton Inference Server on Railway How to Handle Database Connection Pooling Building a NestJS App on Railway Manually Optimize Deployments on Railway Implement a GitHub Actions Testing Suite Scaling a SaaS application on Railway Building a SaaS application on Railway Deploy a Dart App on Railway, Part 2 Deploy a Dart App on Railway, Part 1 Implementing Feature Flags from Scratch Cron Jobs with Django and GitHub Actions Deploy Offen on Railway Queues on Railway Working with NX, Railway and CI/CD Automated PostgreSQL Backups Using GitLab CI/CD with Railway Migrating From Heroku To Railway Cron Jobs on Railway Deploy Beam on Railway Deploy Authorizer on Railway Deploying Monorepo Applications How to Backup and Restore Your Postgres Database How to Backup Your Redis Instance Deploy Cusdis on Railway Deploy Ghost on Railway Using Github Actions with Railway Deploy Calendso (cal.com) on Railway Self-hosted website analytics Use Notion as a CMS for your NextJS blog
How to Migrate from AWS Lambda to Railway
Sherifdeen Awofiranye · 2024-12-13 · via Railway Blog

If you are currently using AWS Lambda and are considering migrating to Railway, this article will walk you through a step-by-step process for migrating your AWS Lambda function to Railway.

Why Migrate from AWS Lambda to Railway?

While AWS Lambda is a powerful tool, there are a few reasons why developers might choose Railway for their projects:

  • Simplified Deployment: Railway abstracts away much of the complexity involved in deployment, providing a seamless experience that doesn’t require deep cloud infrastructure knowledge.
  • Built-in Database Support: Railway makes it easy to connect to and manage databases without needing separate services.
  • Cost-Effectiveness: For smaller projects or developers looking to optimize their spending, Railway offers simpler pricing models, especially for projects that require both hosting and databases.
  • Better Local Development: Railway’s integration with local development environments is straightforward, allowing you to deploy without worrying about complex AWS configurations.

Prerequisites for Migration

Before starting the migration, make sure the following requirements are met:

  • Railway Account: You must have an active Railway account.
  • AWS Admin Access: Ensure you have administrative access to your AWS Management Console.
  • Access to AWS Lambda Functions: Ensure you have access to your AWS Lambda function code, whether from the AWS Management Console or your local machine.
  • Identify Dependencies: List all external resources such as environment variables, and APIs your Lambda functions rely on and add them to Variables in your Railway dashboard.

Step-by-Step Migration Process

  1. Download and open the Function code
  2. Package the Function as a Container Image
  3. Deploy the Container Image to Railway
  4. Test the Deployment

Download and open the Function code

Download the function code and open it in your Code Editor

  • Go to the AWS Management Console, navigate to the Lambda dashboard, select your function, and download the code package.
Download menu from the Lambda dashboard
Download menu from the Lambda dashboard
  • Note the Runtime and Architecture your function is built on
  • Unzip and open the code in your preferred Code Editor

Package the Function as a Container Image

Railway supports several methods of deploying your code, [See]. In this guide, We will deploy our Lambda function to Railway via Docker images directly from Docker Hub.

You must have Docker (minimum version 20.10.10)

There are three ways to build a container image for your Lambda function:

  1. Using an AWS base image: Preloaded with runtime.
  2. Using an AWS OS-only base image: For Compiled language.
  3. Using a non-AWS base image: For another Container registry.

In this guide, we will use the AWS base image.

  • Create a Dockerfile in the same directory as your function. The Dockerfile defines how to build your container image.
Expected file structure including Dockerfile
Expected file structure including Dockerfile
  • Add the following configuration to your Dockerfile:

    # For NodeJs runtime, and Architecture x86_64
    FROM public.ecr.aws/lambda/nodejs:20-x86_64 
    
    # Copy the function code
    COPY index.mjs ${LAMBDA_TASK_ROOT}
    
    # Set the CMD to your handler (could also be done as a parameter
    # override outside of the Dockerfile)
    CMD [ "index.handler" ]
    # Use the AWS Lambda Node.js base image
    FROM public.ecr.aws/lambda/nodejs:20-x86_64
    
    # Copy files or directories and add to the filesystem of the container at the path.
    COPY ${FILES} ${CONTAINER_PATH}
    
    #RUN npm install to install dependencies
    RUN npm install
    
    # Set the Lambda function handler
    CMD ["index.handler"]
  • Build the Docker image: Open up your terminal and run the following command in the directory containing your Dockerfile

     docker build --platform linux/amd64 -t my-railway-function .

    Note: The command specifies the --platform linux/amd64 option to ensure that your container is compatible with the Lambda execution environment regardless of the architecture of your build machine.

  • Test the image locally

    Start the Docker image with the docker run command.

    docker run --platform linux/amd64 -p 9000:8080 --read-only my-railway-function

    From a new terminal window, post an event to the local endpoint.

    In Linux and macOS, run the following curl command:

    curl "<http://localhost:9000/2015-03-31/functions/function/invocations>" -d '{}'

    If your function code requires a payload, you might want to invoke the function with a JSON payload. Example:

    curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"hello world!"}'
  • Deploy your local Docker image to Docker Hub.

Deploy the Container Image to Railway

  • Create an Empty Project in Railway
Empty project option from Railway command palette
Empty project option from Railway command palette
  • Add a new service
Add a Service card in empty project
Add a Service card in empty project
  • Choose Docker Image
Docker Image option in Railway command palette
Docker Image option in Railway command palette
  • Enter name of your image from DockerHub
Prompt to enter the image name
Prompt to enter the image name
  • Deploy your service, and ensure deployment is successful
Successful deployment indicator
Successful deployment indicator
  • Go to Service settings, Under Networking generate a Domain
Generating a public domain in the Railway service
Generating a public domain in the Railway service
  • Enable App Sleep: App Sleep is Railway’s serverless feature that helps reduce service costs by ensuring the application runs only when necessary. It automatically "sleeps" the app during periods of inactivity, and wakes it up when requests are made, minimizing resource usage.
App sleeping configuration
App sleeping configuration

Test the Deployment

  • Invoke your function: Invoke your function using the generated URL and append /2015-03-31/functions/function/invocations to the endpoint.

    Example: <generated-url>/2015-03-31/functions/function/invocations

  • View Logs: Railway provides a built-in logging feature to help you diagnose any issues. Check logs for any errors or warnings that may arise during the initial execution.

  • Verify No invocations on AWS: You can view invocations on your function in AWS Management Console to verify no invocations in AWS.

    Checking for new invocations in AWS Lambda
    Checking for new invocations in AWS Lambda
  • Verify External Connections: If your function depends on external services (like databases or third-party APIs), ensure those connections are working properly in the Railway environment.

Post-Migration Considerations

Monitor and Scaling

Railway handles scaling automatically, and you do not need to go through the hassle of complex scaling configurations.

You can use the HTTP logs to monitor your application.

HTTP Logs tab in Railway
HTTP Logs tab in Railway

Cost Management

Railway has a clear and simple pricing model based on usage. You can set limits to ensure you don’t exceed your desired budget.

Troubleshooting Common Issues

  • External Resource Management: Ensure that all external resources such as environment variables, and APIs required by your Lambda function are properly noted and included in the container image during packaging.
  • Timeouts or Retries: Railway doesn’t have built-in configurations to manage timeouts or retries. You'll need to handle these manually within your application.

Conclusion

Migrating from AWS Lambda to Railway offers a more streamlined developer experience, allowing you to focus on building features rather than managing infrastructure. By following these steps—exporting your Lambda functions, package function as a container image, setting up your Railway environment, and deploying your code—you can smoothly transition from AWS Lambda to Railway. With its easy setup, cost-effective solutions, and powerful database integrations, Railway can be an ideal alternative for many serverless projects.