A step-by-step guide to moving Netlify background functions to AWS: how the 202 response and 15-minute limit map to Lambda and SQS, what changes about retries, and a TypeScript version where the background work is a Pub/Sub subscription.

A Netlify background function returns an empty 202 to the caller and keeps running for up to 15 minutes, which makes it the usual home for report generation, scraping, imports and slow API workflows. It is one file with background: true in its config, and nothing else to set up.
AWS can do the same with Lambda or SQS, and the details that change are retries, results and where the work is queued. This guide maps the pieces and then shows the same flow declared in code.
The Netlify behavior is from the background functions docs, checked on November 23, 2026. Lambda's asynchronous invocation and its 15-minute timeout are in the AWS docs.
Go through netlify/functions and find every file with config.background or a -background suffix. For each, write down who calls it (a form post, a webhook, a scheduled function), how long it takes in the function logs, and where the result ends up, since a background function has no response and anything it produces must already be written to a database, a bucket or a third-party API. Functions that finish in a few seconds are not background work at all, and can become ordinary endpoints on whatever service already exists.
Lambda is the faster port, since a Netlify function body is already a handler that receives a request and can be wrapped in a Lambda handler with few changes, and an API Gateway route or function URL gives the caller the same instant response. A queue fits better when the work arrives in bursts, when you want to control how many run at once, or when it needs more than 15 minutes, because a consumer on ECS has no time limit and the queue absorbs the spikes. Netlify retries twice and then drops the work, so decide on the AWS side how many attempts you want and where a message goes after the last one, and set up the dead-letter destination for it.
The handler itself needs one change that Netlify hid from you: because a failed attempt runs the whole function again, any step that sends an email or charges a card should check a record first, so a retry finds the work done and stops.
Encore brings infrastructure from code, and the background function becomes a subscription: the endpoint publishes a message and returns an ID, and a Subscription handler does the work. Per the AWS infrastructure docs, Pub/Sub on AWS runs on SNS and SQS with dead-letter queues configured for failed messages, and the platform sets up the topic, queue and permissions.

Run in your terminal to get started locally.
A report generator that was a Netlify background function, with a status endpoint so the client can find the result:
// reports/reports.ts
import { api, APIError } from "encore.dev/api";
import { getAuthData } from "~encore/auth";
import { Bucket } from "encore.dev/storage/objects";
import { Topic, Subscription } from "encore.dev/pubsub";
const results = new Bucket("report-results", { versioned: false });
interface ReportJob {
userId: string;
reportId: string;
month: string; // 2026-10
}
const jobs = new Topic<ReportJob>("report-jobs", { deliveryGuarantee: "at-least-once" });
// The instant response, the job a Netlify 202 did.
// Callers must be signed in; add a per-user limit on open jobs as well.
export const request = api(
{ expose: true, auth: true, method: "POST", path: "/reports" },
async ({ month }: { month: string }): Promise<{ reportId: string }> => {
if (!/^\d{4}-(0[1-9]|1[0-2])$/.test(month)) throw APIError.invalidArgument("month must be YYYY-MM");
const reportId = crypto.randomUUID();
await jobs.publish({ userId: getAuthData()!.userID, reportId, month });
return { reportId };
},
);
// The function body, up to the ack deadline, retried by the platform on failure.
new Subscription(jobs, "build-report", {
ackDeadline: "5m",
retryPolicy: { minBackoff: "30s", maxBackoff: "5m", maxRetries: 3 },
handler: async ({ userId, reportId, month }) => {
// The key starts with the owner's ID, so status can only find the caller's own reports.
const key = `${userId}/${reportId}.csv`;
// A retry after success finds the file and stops.
if (await results.exists(key)) return;
const rows = ["day,orders"];
for (let day = 1; day <= 28; day++) {
rows.push(`${month}-${String(day).padStart(2, "0")},${(day * 7) % 13}`);
}
await results.upload(key, Buffer.from(rows.join("\n")), { contentType: "text/csv" });
},
});
// What the Netlify version had no answer for: the client polls this.
export const status = api(
{ expose: true, auth: true, method: "GET", path: "/reports/:id" },
async ({ id }: { id: string }): Promise<{ ready: boolean; url?: string }> => {
const key = `${getAuthData()!.userID}/${id}.csv`;
if (!(await results.exists(key))) return { ready: false };
const signed = await results.signedDownloadUrl(key, { ttl: 300 });
return { ready: true, url: signed.url };
},
);
The handler checks for its own output before doing anything, which makes the retries in retryPolicy safe, and a message that fails its last attempt goes to the dead-letter queue instead of disappearing. The ack deadline sets how long one attempt may run, with the clamps described in the Pub/Sub docs. Locally, encore run starts Pub/Sub and a bucket for the same code, so you can post to /reports and poll the status endpoint without deploying.
To deploy, connect your AWS account as described in Connect your cloud account and push with git push encore. The object storage docs cover the signed URLs used for the download.
A coding agent that adds a new slow job writes the topic, the subscription and the status endpoint in one change and runs the whole flow locally, with no queue, redrive policy or Lambda permission to create by hand.
Best fit: Sites moving from Netlify to their own AWS account that have report, import or scraping jobs and want queueing, retries and a dead-letter queue declared next to the handler.
Point one caller at the AWS endpoint, compare its results with the Netlify version for a day, and move to the next. Delete a Netlify function only after a full cycle of its normal schedule has run, since a monthly job will not show a problem for weeks.
A Lambda function invoked asynchronously, or an SQS queue with a consumer, behind an API endpoint that returns 202 right away. Lambda has the same 15-minute ceiling as a Netlify background function, while a queue consumer on ECS can run longer.
Netlify retries once after one minute and a second time two minutes later, so a failing function runs up to three times. On AWS you choose the retry count and add a dead-letter queue, and a handler that is not safe to run twice needs an idempotency check on either platform.
It does not, because Netlify returns an empty 202 and the function has no response. Write the result to a database or bucket under an ID that the request returned, and add a status endpoint the client polls.
With Encore you declare a Topic and a Subscription in code, the endpoint publishes a message and returns an ID, and the subscription handler does the work with retries and a dead-letter queue. On AWS the deploy provisions the SNS topic, SQS queue and permissions in your account.
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.