Nov 18, 20266 min read

How to Migrate Netlify Functions to AWS

A step-by-step guide to moving Netlify Functions, background functions, scheduled functions, Blobs and environment variables to your own AWS account, with each Netlify feature mapped to an AWS service and a TypeScript version that deploys with git push.

Illustration for How to Migrate Netlify Functions to AWS

Netlify Functions add server code to a site with fixed limits: 60 seconds for a synchronous call, 15 minutes for a background function and 30 seconds for a scheduled one. Teams move them to AWS when they hit those limits or when compute credits add up, and also when data must live in their own AWS account.

This guide maps each Netlify feature to an AWS service, walks through the move with plain Lambda, and then shows the same functions as an Encore backend that deploys to your AWS account. The site itself can stay on Netlify while the API moves.

How Netlify features map to AWS

NetlifyLimit or defaultAWS equivalentEncore primitive
Synchronous function60 seconds, 1024 MB, 6 MB payloadLambda behind API Gateway, or ECS Fargateapi() endpoint
Background function15 minutes, retried after 1 and 2 minutesSQS queue with a consumer and a DLQTopic and Subscription
Scheduled function30 seconds, published deploys onlyEventBridge Scheduler targeting LambdaCronJob
Netlify BlobsKey-value object storeS3Bucket
Environment variablesSet in the Netlify UI or CLISecrets Manager or SSM Parameter Storesecret()
RegionUS East (Ohio) by defaultAny AWS regionThe region of your environment

The limits come from Netlify's functions configuration docs, background functions docs and scheduled functions docs, checked on November 18, 2026. On credit-based plans, function compute costs 10 credits per GB-hour, with 300 credits a month on Free, 1,000 on Personal at $9 and 3,000 on Pro at $20, per Netlify pricing.

Step 1: Inventory the functions

List everything under netlify/functions and in netlify.toml, and sort each file into one of three groups: functions with a path config that answer requests, files ending in -background and functions with a schedule. Then list every Netlify.env or process.env read and every Blobs store, since each becomes an AWS resource. A typical synchronous function looks like this:

// netlify/functions/orders.mts import type { Config, Context } from "@netlify/functions"; export default async (req: Request, context: Context) => { const order = await req.json(); await fetch(`${process.env.URL}/.netlify/functions/send-receipt-background`, { method: "POST", body: JSON.stringify(order), }); return Response.json({ ok: true }); }; export const config: Config = { path: "/orders" };

Step 2: Move with plain Lambda and API Gateway

The direct route is one Lambda function per Netlify function, an API Gateway HTTP API in front, and an SQS queue in place of the background call. The handler signature changes from a web Request to an API Gateway event:

// lambda/orders.ts import { SQSClient, SendMessageCommand } from "@aws-sdk/client-sqs"; const sqs = new SQSClient({}); export const handler = async (event: { body?: string }) => { const order = JSON.parse(event.body ?? "{}"); await sqs.send(new SendMessageCommand({ QueueUrl: process.env.RECEIPTS_QUEUE_URL, MessageBody: JSON.stringify(order), })); return { statusCode: 200, body: JSON.stringify({ ok: true }) }; };

Around that handler you define the HTTP API and its routes, the SQS queue and dead-letter queue, the consumer function with an event source mapping, an EventBridge Scheduler schedule for each scheduled function, an S3 bucket for Blobs, the secrets, and an IAM role per function, in Terraform, SAM or CDK. The Lambda TypeScript guide and SQS with Lambda guide cover those pieces.

Step 3: Or move to Encore

Encore is a backend framework with built-in infrastructure for TypeScript and Go. Each Netlify function becomes an endpoint, a subscription or a cron job in code, and deploying to your AWS account provisions the load balancer, Fargate, SNS and SQS, S3 and Secrets Manager. Encore provisions an IAM role for the service.

Application code passes through Encore and infrastructure guardrails to resources provisioned in your own AWS or GCP account.
Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

import { api } from "encore.dev/api"; import { Topic, Subscription } from "encore.dev/pubsub"; import { CronJob } from "encore.dev/cron"; import { Bucket } from "encore.dev/storage/objects"; import { secret } from "encore.dev/config"; import log from "encore.dev/log"; // Was a Netlify environment variable. Stored in AWS Secrets Manager. const receiptApiKey = secret("ReceiptApiKey"); // Was Netlify Blobs. Provisioned as an S3 bucket. const receipts = new Bucket("receipts"); interface OrderPlaced { orderId: string; email: string; totalCents: number; } // SNS and SQS replace the background function's built-in retries. const orderPlaced = new Topic<OrderPlaced>("order-placed", { deliveryGuarantee: "at-least-once", }); // Was netlify/functions/orders.mts with config { path: "/orders" }. export const placeOrder = api( { expose: true, method: "POST", path: "/orders" }, async (o: OrderPlaced): Promise<{ ok: boolean }> => { await orderPlaced.publish(o); return { ok: true }; }, ); // Was netlify/functions/send-receipt-background.mts, limited to 15 minutes. new Subscription(orderPlaced, "send-receipt", { handler: async (o) => { const body = JSON.stringify({ orderId: o.orderId, total: o.totalCents }); await receipts.upload(`${o.orderId}.json`, Buffer.from(body), { contentType: "application/json", }); log.info("receipt stored", { orderId: o.orderId, keySet: receiptApiKey().length > 0 }); }, }); export const nightlyReport = api({}, async (): Promise<void> => { log.info("building nightly report"); }); // Was a scheduled function with schedule "@daily" and a 30-second limit. new CronJob("nightly-report", { title: "Build the nightly report", schedule: "0 0 * * *", endpoint: nightlyReport, });

In a local encore run test, a POST to /orders published the message, the subscription stored o-42.json in the local bucket, and a read endpoint returned it. The cron job does not fire locally; the Encore platform schedules it once deployed, per the cron jobs docs. The Pub/Sub, object storage and secrets docs cover each primitive, and connecting your own cloud covers the AWS account setup.

Set the secret with encore secret set --type prod ReceiptApiKey. Encore stores the value encrypted and provisions it into AWS Secrets Manager in your account. Production values are not stored in the repository, so a coding agent editing the functions cannot read or leak those production values. A local override in .secrets.local.cue is a file on disk and is readable if it is present. The same agent can add a new background job as a subscription, and the next deploy creates its queue and permissions.

Step 4: Point the site at the new API

Keep the frontend on Netlify and change its fetch calls to the new API domain, or add a Netlify redirect such as /api/* https://api.example.com/:splat 200 so the browser keeps calling the same paths. Set up a custom domain for the API, move Blobs data to S3 with a one-off script, then remove the old functions once traffic has moved.

Best fit: TypeScript sites on Netlify whose functions have outgrown the 60-second and 15-minute limits and need to run in their own AWS account.

Frequently asked questions

Do Netlify Functions run on AWS Lambda?

No, not as Lambda functions in an AWS account you manage. Netlify deploys and runs the functions for you, with a deprecated Lambda compatibility mode for older handlers, and the default region is US East (Ohio). Moving them to your own AWS account means they become Lambda functions behind API Gateway, containers on ECS, or endpoints in a backend framework that provisions those resources for you.

What are the Netlify Functions time limits?

Per Netlify's configuration docs in November 2026, synchronous functions have a 60-second execution limit, scheduled functions 30 seconds and background functions 15 minutes. None of these are configurable, and the buffered request or response payload is capped at 6 MB.

What replaces Netlify background functions on AWS?

An SQS queue with a consumer replaces them: the request handler sends a message and returns, and a Lambda function or container processes it, with a dead-letter queue for messages that keep failing. Netlify retries a failed background function after one minute and again after two minutes, while SQS retries until the message reaches its max receive count.

How do I move Netlify Functions to AWS with the least configuration?

Write them as Encore endpoints, subscriptions and cron jobs in TypeScript. Encore provisions the load balancer, SNS and SQS, S3 and Secrets Manager in your AWS account on git push, so the migration is mostly a code change instead of a Terraform project.

Deploy to your cloud on AWS and Google Cloud
without managing infrastructure

Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders