Benchmarking AWS Amplify, Lambda, and ECS for Next.js

Benchmarking AWS Amplify, Lambda, and ECS for Next.js

A 0.5 vCPU Fargate task might handle seventy page requests per second efficiently before requiring additional tasks and an Application Load Balancer to manage the queue. This specific performance threshold serves as a vital benchmark for cloud architects in 2026 who must balance scalability with operational overhead. The decision to deploy a Next.js application on AWS involves choosing between diverse runtimes, each offering distinct advantages in terms of management ease, latency, and cost-efficiency. By testing the same application across AWS Amplify Hosting, standard AWS Lambda, the newer Lambda Web Functions, and Amazon ECS on Fargate, it becomes possible to identify the exact breaking points and economic realities of each service. This analysis moves beyond theoretical feature lists to provide empirical data gathered from standardized load tests conducted within the same region and account. The results emphasize that while serverless options offer unmatched scaling flexibility, traditional container services provide a level of performance consistency that remains difficult to match under steady, predictable traffic. Selecting the right platform requires a deep understanding of how these services handle concurrent requests, cold starts, and resource-intensive operations like server-side rendering or heavy cryptographic computations.

1. Strategic Architectural Planning

The foundation of a reliable benchmark lies in the creation of a standardized Next.js application designed to interact with modern cloud primitives. In this study, the application serves as a bridge to a DynamoDB table, simulating a common real-world scenario where a web framework must fetch data before rendering a page for the end user. Each runtime environment is configured to execute the same core logic, ensuring that any variance in performance is directly attributable to the underlying infrastructure rather than differences in the code itself. AWS Amplify Hosting is set up to build the application directly from a GitHub repository, utilizing its managed compute resources to handle server-side logic. Simultaneously, a classic AWS Lambda function is deployed using a container image and the Lambda Web Adapter, which allows the function to behave like a standard web server by translating incoming events into HTTP requests. This dual-approach testing ensures that both fully managed and more granularly controlled serverless environments are represented in the final dataset.

To provide a comprehensive overview of performance, the application includes multiple endpoints, each targeting a specific type of workload. A server-rendered page tests the runtime’s ability to perform database I/O and HTML generation, while a specialized “ping” endpoint measures the pure overhead introduced by the runtime itself without external dependencies. Furthermore, a CPU-intensive route performs 50,000 chained SHA-256 hashes, allowing for a direct comparison of the raw processing power allocated by each service. Every response generated by the application is programmed to report essential metadata, such as whether the request triggered a cold start, the specific CPU architecture in use, and the total memory available to the process. This transparency is crucial for understanding why certain runtimes might outperform others during high-traffic periods. By centralizing all data in a single DynamoDB table, the architecture remains simple enough to isolate performance variables while remaining complex enough to reflect the demands of a production-grade application in 2026.

2. Core Technical Prerequisites

Before initiating the deployment process, several environmental requirements must be met to ensure the benchmark can be replicated and validated. A standard AWS account equipped with the AWS CLI v2 is necessary for managing services through automated scripts. In 2026, the technical landscape demands the use of Docker with buildx for cross-platform image construction, specifically targeting the ARM64 architecture to take advantage of AWS Graviton processors. Node.js 22 serves as the runtime for the local development environment, and the k6 utility is employed to execute high-precision load tests. Additionally, the new aws lambda-web commands must be available within the CLI to facilitate the deployment of Web Functions, which represent a significant shift in how Lambda handles HTTP traffic by allowing multiple concurrent requests within a single execution environment. These tools provide the necessary infrastructure to measure everything from millisecond-level latency to the financial impact of various scaling configurations.

Integration with external services like GitHub is a prerequisite for evaluating AWS Amplify Hosting, as it relies on a seamless connection to the source code repository to trigger automated build and deployment pipelines. While the setup for Lambda and ECS is more manual, involving the creation of Elastic Container Registry (ECR) repositories and IAM roles, it offers a higher degree of control over the deployment lifecycle. During the initialization phase, it is vital to verify that the chosen AWS region, such as eu-central-1, has sufficient capacity and supports all the features being tested, including Graviton-based Fargate tasks. Maintaining a clean environment where only the benchmark resources are active helps prevent noise in the financial data, as the fixed costs of certain services like Application Load Balancers can skew the results if not carefully monitored. Once these prerequisites are in place, the focus shifts to building a unified deployment strategy that can bridge the gap between container-based and zip-based deployment models.

3. Containerization and Image Strategy

The bridge between different AWS runtimes is often built through containerization, which provides a consistent environment for code execution across ECS and Lambda. To optimize the Next.js application for these platforms, the output is configured for “standalone” mode, creating a minimal server that includes only the necessary dependencies for production. This approach significantly reduces the size of the final Docker image, which is a critical factor in minimizing cold-start times in serverless environments. The Dockerfile incorporates the Lambda Web Adapter as an extension, enabling the container to run on Lambda without requiring modifications to the standard web server code. On ECS, this adapter remains dormant, allowing the same image to function as a traditional long-running process behind a load balancer. This versatility is a hallmark of modern cloud-native development in 2026, where a single artifact can be deployed across multiple compute categories depending on the immediate needs of the business.

Security and performance optimization are integrated directly into the image construction process. To address vulnerabilities in base images, the build script includes an apk upgrade command, ensuring that the final production image is free from known critical CVEs before it is pushed to the Elastic Container Registry. The image is built specifically for the Linux/arm64 platform to leverage the superior price-performance ratio of Graviton processors. Furthermore, the Next.js cache is redirected to the /tmp directory to accommodate the read-only file system of AWS Lambda, ensuring that the application can still perform essential caching operations during its lifecycle. By tagging each image with a unique Git commit hash, the deployment process remains immutable and traceable, allowing for easy rollbacks or comparisons between different versions of the code. This rigorous image strategy ensures that performance measurements are not hampered by inefficient packaging or outdated dependencies, providing a clean baseline for load tests.

4. Optimizing Lambda Function URLs

Deploying a Lambda function in 2026 often involves using Function URLs, which provide a direct HTTPS endpoint for your code without the added complexity or cost of an API Gateway. This configuration is particularly effective for high-throughput applications where gateway overhead might introduce unnecessary latency. During setup, the function is assigned a specific memory allocation, such as 1024 MB, which indirectly determines the amount of CPU power available to the application. It is important to note that a public Function URL requires specific IAM permissions, including both lambda:InvokeFunctionUrl and lambda:InvokeFunction, to operate correctly. Without the latter, the service may return a forbidden error—a common pitfall for developers moving away from traditional gateway architectures. This direct-access model simplifies the infrastructure stack while maintaining the security and scalability features inherent to the Lambda platform.

One often-overlooked aspect of Lambda deployment is the default concurrency limit, which can vary significantly between AWS accounts. In some environments, this limit may be as low as ten concurrent executions, which is insufficient for a benchmark designed to test hundreds of requests per second. Monitoring and requesting an increase in these quotas via the AWS Service Quotas console is a mandatory step for any production-bound workload. For the benchmarks, an increase to 1,000 concurrent executions allows the system to scale naturally as load increases, preventing artificial bottlenecks that would result in “429 Too Many Requests” errors. Lambda’s ability to handle sudden bursts of traffic by spinning up new execution environments in seconds remains its strongest selling point, provided that the account limits are properly configured to support such growth. This setup ensures that the latency measurements reflect the true capabilities of the runtime rather than the constraints of a restricted AWS environment.

5. Deploying Native Web Functions

The introduction of Lambda Web Functions represents a major evolution in the serverless landscape, offering a native way to run web servers without needing adapters or event translations. Unlike traditional Lambda functions that handle one request at a time per environment, Web Functions allow a single instance to process multiple concurrent requests, mirroring the behavior of a containerized service. These functions are deployed as .zip files rather than container images and are currently restricted to the Node.js 24 runtime on the arm64 architecture. An entry file maps internal AWS environment variables to the ports expected by the Next.js standalone server, ensuring a smooth handoff between the Lambda infrastructure and the application code. This model is particularly attractive to developers who want the scaling benefits of serverless combined with the efficiency of a long-running web process.

Managing Web Functions involves using revisions, which are immutable snapshots of the code and its associated configuration. This enables sophisticated deployment strategies, such as canary releases, where traffic is gradually shifted from an old revision to a new one to verify stability. The deployment command creates a public endpoint and waits for the resource to become active—a process that typically takes less than a minute. A key distinction of this runtime is its pricing model, which charges for the environment’s total active time in addition to request fees and CPU usage. This means that an environment kept active by consistent traffic will incur memory costs even when it is not actively processing a request. However, the ability to stream large responses and bypass the traditional 6 MB payload limit of standard Lambda makes Web Functions a powerful tool for applications handling large data exports or media content in 2026.

6. Orchestrating ECS Fargate Services

Amazon ECS on Fargate provides a robust environment for running containers without the need to manage underlying EC2 instances. In this benchmarking scenario, the ECS service is placed behind an Application Load Balancer (ALB), which handles incoming traffic and distributes it to available tasks. To minimize costs associated with NAT gateways, the Fargate tasks are deployed in public subnets with public IP addresses, while security groups are configured to restrict incoming traffic exclusively to the load balancer. The task definition specifies resource allocation, such as 0.5 vCPU and 1 GB of memory, utilizing the Graviton architecture for optimal efficiency. This setup offers extensive control over the networking and execution environment, allowing for features like WebSockets and long-running connections that are often problematic in serverless configurations.

Performance tuning on ECS often centers on health check and deregistration settings. By reducing the health check interval and the deregistration delay, the service can more quickly identify and replace unhealthy tasks or scale down after a traffic spike. During the benchmarking process, it became evident that a single Fargate task has a finite capacity; once the CPU limit is reached, the task can no longer process requests efficiently, leading to increased latency and eventual failure. This necessitates a well-planned autoscaling strategy that monitors CPU utilization and spins up additional tasks before existing ones become overwhelmed. Unlike serverless options, ECS does not automatically scale to zero, meaning there is a constant baseline cost for the running tasks and the associated load balancer. However, for applications with steady, high-volume traffic, the predictability and low latency of a warm container process often justify the fixed expenditure.

7. Seamless Amplify Hosting Integration

AWS Amplify Hosting offers a streamlined deployment experience for Next.js applications, abstracting away much of the underlying infrastructure management. By linking a GitHub repository to the Amplify console, developers can enable a continuous deployment pipeline that automatically builds and deploys every commit to a designated branch. A unique characteristic of Amplify is that it handles the build process within its own managed environment, which can sometimes lead to discrepancies in how environment variables are handled. Unlike Lambda or ECS, where variables are passed directly to the runtime, Amplify requires these variables to be injected into a .env.production file during the build phase. This ensures that server-side code has access to the necessary secrets and configuration values when it executes on the underlying compute resources, which typically run on x64 architecture within the Amplify ecosystem.

To allow the server-side code to interact with other AWS services like DynamoDB, a specific compute role must be assigned to the Amplify application. This IAM role defines the permissions for the server-side logic, such as the ability to perform GetItem operations on a database table. Once configured, Amplify manages the scaling and hosting of the application, providing a high-level interface that is ideal for front-end-heavy teams. However, the benchmark reveals that this simplicity comes with trade-offs; Amplify currently lacks support for the arm64 architecture, and it imposes fixed limits on request timeouts and response sizes that cannot be adjusted by the user. Despite these constraints, the ease of setting up preview branches and the integrated CDN make it a highly competitive option for many web projects in 2026. The performance data shows that while it may be slightly slower than a finely tuned ECS task, it offers a robust and reliable platform for the vast majority of web workloads.

8. Systematic Load Testing Methodology

To ensure the accuracy and relevance of the benchmark results, a systematic load testing methodology was implemented using the k6 utility. The tests were designed to measure the response of each runtime under three distinct traffic levels: 10, 50, and 200 requests per second. By using a constant arrival rate, the tests simulated a steady stream of users without the variability introduced by standard virtual user loops. Each endpoint was tested for two minutes, providing enough time for the runtimes to stabilize and for any auto-scaling mechanisms to engage. The captured metrics included p50, p95, and p99 latencies, which help identify not only average performance but also the “long tail” of slow requests that can negatively impact the user experience. This rigorous approach allows for a direct comparison of how each service handles increasing pressure and identifies where their respective breaking points lie.

In addition to steady-state load testing, the methodology included specific tests for cold starts and architectural limits. For Lambda-based runtimes, cold starts were forced by programmatically changing environment variables, which retired existing warm environments and forced the creation of new ones. This provided a clear picture of the “init duration” and the total time a user might wait for the first request after a period of inactivity. To find the real-world limits of each service, the test script gradually increased the duration of the /api/sleep endpoint and the size of the /api/size response. These tests revealed the hard ceilings imposed by the infrastructure, such as the 6 MB payload limit on standard Lambda and the 28-second timeout on Amplify. By pushing each service to its failure point, the benchmark provides invaluable data for architects who must design high-reliability systems for 2026, where exceeding these limits can result in catastrophic service interruptions.

9. Performance Results

The load tests yielded several surprising insights into the behavior of different AWS runtimes. At low traffic levels, Amazon ECS on Fargate emerged as the performance leader, offering the lowest median latency because a warm Node.js process serves requests directly with minimal intermediate layers. However, this advantage quickly vanished under heavy load; a single 0.5 vCPU task could not sustain more than 70 requests per second for the server-rendered page. At 200 requests per second, the ECS task reached 100% CPU utilization, causing health checks to fail and resulting in a 29% error rate. In stark contrast, both standard Lambda and Web Functions maintained remarkably consistent latency across all traffic levels. Even at the highest load, these services simply scaled the number of execution environments, resulting in zero errors and only a minor increase in p99 latency. This demonstrates the inherent resilience of serverless architectures when facing unpredictable or rapidly growing traffic.

The CPU-intensive benchmarks further highlighted the differences between the runtimes. The new Lambda Web Functions proved to be the fastest in terms of raw processing power, likely due to the allocation of 2 full vCPUs per environment, which allowed cryptographic hashes to complete significantly faster than on standard Lambda or Amplify. Amplify, running on x64 architecture, was the slowest in the CPU tests, taking nearly twice as long as the Web Functions to complete the same task. Meanwhile, cold start measurements confirmed that while Lambda and Web Functions have a penalty of about one second for the first request, Amplify can take up to two seconds to spin up a new process after an idle period. These performance metrics suggest that for applications requiring high burst capacity and consistent performance under load, the Lambda-based options are superior, whereas ECS remains the champion for low-latency, steady-state workloads, provided it is backed by a robust autoscaling configuration.

10. Comprehensive Financial Projections

Analyzing the monthly expenditure for each service reveals a complex relationship between traffic volume and cost efficiency. At very low traffic levels, standard Lambda is the undisputed winner, with costs often amounting to just pennies per month due to its scale-to-zero nature. In contrast, ECS Fargate has a significant cost floor, starting at approximately $57 per month in 2026. This base cost includes the Fargate task, the Application Load Balancer, and the required public IPv4 addresses, which are now billed hourly by AWS. For a low-traffic site, this makes ECS a much more expensive option than serverless alternatives. Lambda Web Functions also introduce a cost floor of about $24 per month if traffic is frequent enough to keep at least one environment active, as the memory for the environment is billed regardless of whether it is actively processing a request.

As traffic increases toward 100 million requests per month, the economic balance shifts. For this specific lightweight application, standard Lambda remains the most cost-effective option even at high volumes, provided the request duration stays low. However, if an application performs heavy processing, the cost of Lambda can skyrocket because it charges for every millisecond of execution time. In such cases, ECS becomes more competitive because a single task can handle multiple concurrent requests for a fixed hourly rate. Amplify Hosting sits in the middle of the spectrum; while its request fees are comparable to Web Functions, its compute costs are significantly higher than standard Lambda on a per-second basis. Furthermore, Amplify adds costs for data transfer and build minutes, which can add up for teams that deploy frequently. These financial projections emphasize that the cheapest option depends entirely on traffic patterns and the resource intensity of the application code.

11. Navigating Common Technical Inquiries

Which service is best for low-traffic websites?

Standard Lambda is usually the best choice for websites with low or intermittent traffic because it scales to zero. This means you only pay for the milliseconds your code is actually running, which can result in a monthly bill of nearly zero dollars for a small project.

When should I choose ECS Fargate over Lambda?

ECS is ideal for applications with steady, high-volume traffic, those that require WebSockets, or requests that take longer than the 15-minute Lambda limit. It is also a better fit if your application needs to maintain a large in-memory cache or requires complex private networking.

Does Amplify Hosting support ARM64 architecture?

Currently, server-side compute for Amplify Hosting runs on x64 architecture. This can lead to slightly slower performance for certain tasks compared to the ARM64 Graviton instances available in Lambda and ECS, and it often results in higher compute costs.

Why did the single ECS task fail during the test?

The task reached its 0.5 vCPU limit, which caused it to fall behind on processing incoming requests. This led to a backlog that eventually caused the task’s own health check to fail, leading the load balancer to mark it as unhealthy and stop sending traffic, demonstrating the need for autoscaling.

12. Final Infrastructure Decommissioning

Once the benchmarking process is complete, it is essential to perform a thorough cleanup of all AWS resources to avoid unnecessary charges. A specialized cleanup script is used to systematically delete various components, including the Amplify application, the ECS cluster, and the associated Application Load Balancer. Because services like the ALB and Fargate tasks incur costs as long as they are provisioned, failing to remove them can lead to significant unexpected expenses. The script also targets Lambda functions and their public URLs, as well as the ECR repositories that store container images. By tagging all resources with a specific project identifier, the removal process can be targeted and comprehensive, ensuring no orphaned resources remain in the account.

The teardown also includes the removal of supporting infrastructure, such as IAM roles, security groups, and DynamoDB tables. While these resources often incur minimal or no costs when idle, deleting them maintains a clean environment and adheres to the principle of least privilege. CloudWatch log groups should also be cleared, as they can accumulate data over time and contribute to storage costs. In 2026, maintaining operational hygiene by cleaning up temporary test environments is a standard best practice that prevents “cloud sprawl” and simplifies account management. Using automated scripts for both deployment and cleanup ensures that the entire benchmarking lifecycle is repeatable, allowing for future tests as AWS continues to update its service offerings and pricing models.

13. Forward-Looking Deployment Recommendations

The benchmark provides a clear roadmap for selecting a Next.js runtime based on specific operational priorities. The results show that standard AWS Lambda remains the most versatile and cost-effective solution for most web applications, particularly those with fluctuating traffic. It successfully handles massive bursts of traffic with zero configuration and maintains a near-zero cost floor during idle periods. Meanwhile, Lambda Web Functions demonstrate superior CPU performance and solve the long-standing payload limit issues of the serverless platform, although their memory-based billing model introduces a higher cost baseline that teams must monitor closely. AWS Amplify stands out as the most user-friendly option, though its technical constraints on response size and architecture make it better suited for front-end-focused teams rather than those with complex back-end requirements.

For organizations moving forward with large-scale deployments, the findings suggest a hybrid or migratory approach. Starting with a serverless model like Lambda allows for rapid iteration and low initial costs, while using container-based deployment artifacts makes it possible to migrate to ECS Fargate if traffic becomes steady enough to justify fixed monthly expenses. The benchmark specifically illustrates that the performance gap between these runtimes is shrinking, yet the economic models remain vastly different. Developers and architects should prioritize visibility by implementing robust monitoring of CPU and memory usage, regardless of the chosen platform. By grounding architectural decisions in empirical data rather than brand preference, teams can ensure their Next.js applications are both high-performing and fiscally responsible in the evolving cloud landscape of 2026.

Subscribe to our weekly news digest.

Join now and become a part of our fast-growing community.

Invalid Email Address
Thanks for Subscribing!
We'll be sending you our best soon!
Something went wrong, please try again later