{"id":13461800,"url":"https://github.com/swift-server/swift-aws-lambda-runtime","last_synced_at":"2025-04-11T03:30:33.000Z","repository":{"id":38420151,"uuid":"244728768","full_name":"swift-server/swift-aws-lambda-runtime","owner":"swift-server","description":"Swift implementation of AWS Lambda Runtime","archived":false,"fork":false,"pushed_at":"2024-10-26T11:57:33.000Z","size":8054,"stargazers_count":1142,"open_issues_count":38,"forks_count":105,"subscribers_count":32,"default_branch":"main","last_synced_at":"2024-10-29T15:39:20.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swift-server.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-03T19:55:32.000Z","updated_at":"2024-10-27T08:13:40.000Z","dependencies_parsed_at":"2024-11-07T10:29:46.597Z","dependency_job_id":null,"html_url":"https://github.com/swift-server/swift-aws-lambda-runtime","commit_stats":{"total_commits":265,"total_committers":50,"mean_commits":5.3,"dds":0.649056603773585,"last_synced_commit":"4992ba5bd8e31d44fd82d49eb6f704fcf4d2ceb1"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-server%2Fswift-aws-lambda-runtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-server%2Fswift-aws-lambda-runtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-server%2Fswift-aws-lambda-runtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swift-server%2Fswift-aws-lambda-runtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swift-server","download_url":"https://codeload.github.com/swift-server/swift-aws-lambda-runtime/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247070883,"owners_count":20878584,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T11:00:57.984Z","updated_at":"2025-04-03T20:05:42.786Z","avatar_url":"https://github.com/swift-server.png","language":"Swift","funding_links":[],"categories":["Swift","Projects using SwiftNIO","HarmonyOS"],"sub_categories":["Packages \u0026 executables","Windows Manager"],"readme":"\u003e [!IMPORTANT]\n\u003e The documentation included here refers to the Swift AWS Lambda Runtime v2 (code from the main branch). If you're developing for the runtime v1.x, check this [readme](https://github.com/swift-server/swift-aws-lambda-runtime/blob/v1/readme.md) instead.\n\nThis guide contains the following sections:\n\n- [The Swift AWS Lambda Runtime](#the-swift-aws-lambda-runtime)\n- [Pre-requisites](#pre-requisites)\n- [Getting started](#getting-started)\n- [Developing your Swift Lambda functions](#developing-your-swift-lambda-functions)\n- [Testing Locally](#testing-locally)\n- [Deploying your Swift Lambda functions](#deploying-your-swift-lambda-functions)\n- [Swift AWS Lambda Runtime - Design Principles](#swift-aws-lambda-runtime---design-principles)% \n\n## The Swift AWS Lambda Runtime\n\nMany modern systems have client components like iOS, macOS or watchOS applications as well as server components that those clients interact with. Serverless functions are often the easiest and most efficient way for client application developers to extend their applications into the cloud.\n\nServerless functions are increasingly becoming a popular choice for running event-driven or otherwise ad-hoc compute tasks in the cloud. They power mission critical microservices and data intensive workloads. In many cases, serverless functions allow developers to more easily scale and control compute costs given their on-demand nature.\n\nWhen using serverless functions, attention must be given to resource utilization as it directly impacts the costs of the system. This is where Swift shines! With its low memory footprint, deterministic performance, and quick start time, Swift is a fantastic match for the serverless functions architecture.\n\nCombine this with Swift's developer friendliness, expressiveness, and emphasis on safety, and we have a solution that is great for developers at all skill levels, scalable, and cost effective.\n\nSwift AWS Lambda Runtime was designed to make building Lambda functions in Swift simple and safe. The library is an implementation of the [AWS Lambda Runtime API](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html) and uses an embedded asynchronous HTTP Client based on [SwiftNIO](http://github.com/apple/swift-nio) that is fine-tuned for performance in the AWS Runtime context. The library provides a multi-tier API that allows building a range of Lambda functions: From quick and simple closures to complex, performance-sensitive event handlers.\n\n## Pre-requisites\n\n- Ensure you have the Swift 6.x toolchain installed.  You can [install Swift toolchains](https://www.swift.org/install/macos/) from Swift.org\n\n- When developing on macOS, be sure you use macOS 15 (Sequoia) or a more recent macOS version.\n\n- To build and archive your Lambda function, you need to [install docker](https://docs.docker.com/desktop/install/mac-install/).\n\n- To deploy the Lambda function and invoke it, you must have [an AWS account](https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-creating.html) and [install and configure the `aws` command line](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).\n\n- Some examples are using [AWS SAM](https://aws.amazon.com/serverless/sam/). Install the [SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html) before deploying these examples.\n\n## Getting started\n\nTo get started, read [the Swift AWS Lambda runtime tutorial](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/main/tutorials/table-of-content). It provides developers with detailed step-by-step instructions to develop, build, and deploy a Lambda function.\n\nWe also wrote a comprehensive [deployment guide](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/main/documentation/awslambdaruntime/deployment).\n\nOr, if you're impatient to start with runtime v2, try these six steps:\n\nThe `Examples/_MyFirstFunction` contains a script that goes through the steps described in this section.\n\nIf you are really impatient, just type:\n\n```bash\ncd Examples/_MyFirstFunction\n./create_and_deploy_function.sh\n```\n\nOtherwise, continue reading.\n\n1. Create a new Swift executable project\n\n```bash\nmkdir MyLambda \u0026\u0026 cd MyLambda\nswift package init --type executable\n```\n\n2. Prepare your `Package.swift` file\n\n    2.1 Add the Swift AWS Lambda Runtime as a dependency\n\n    ```bash\n    swift package add-dependency https://github.com/swift-server/swift-aws-lambda-runtime.git --branch main\n    swift package add-target-dependency AWSLambdaRuntime MyLambda --package swift-aws-lambda-runtime\n    ```\n\n    2.2 (Optional - only on macOS) Add `platforms` after `name`\n\n    ```\n        platforms: [.macOS(.v15)],\n    ```\n\n    2.3 Your `Package.swift` file must look like this\n\n    ```swift\n    // swift-tools-version: 6.0\n\n    import PackageDescription\n\n    let package = Package(\n        name: \"MyLambda\",\n        platforms: [.macOS(.v15)],\n        dependencies: [\n            .package(url: \"https://github.com/swift-server/swift-aws-lambda-runtime.git\", branch: \"main\"),\n        ],\n        targets: [\n            .executableTarget(\n                name: \"MyLambda\",\n                dependencies: [\n                    .product(name: \"AWSLambdaRuntime\", package: \"swift-aws-lambda-runtime\"),\n                ]\n                ),\n        ]\n    )\n    ```\n\n3. Scaffold a minimal Lambda function\n\nThe runtime comes with a plugin to generate the code of a simple AWS Lambda function:\n\n```bash\nswift package lambda-init --allow-writing-to-package-directory\n```\n\nYour `Sources/main.swift` file must look like this.\n\n```swift\nimport AWSLambdaRuntime\n\n// in this example we are receiving and responding with strings\n\nlet runtime = LambdaRuntime {\n    (event: String, context: LambdaContext) in\n        return String(event.reversed())\n}\n\ntry await runtime.run()\n```\n\n4. Build \u0026 archive the package\n\nThe runtime comes with a plugin to compile on Amazon Linux and create a ZIP archive:\n\n```bash\nswift package archive --allow-network-connections docker\n```\n\nIf there is no error, the ZIP archive is ready to deploy.\nThe ZIP file is located at `.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/MyLambda/MyLambda.zip`\n\n5. Deploy to AWS\n\nThere are multiple ways to deploy to AWS ([SAM](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html), [Terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started), [AWS Cloud Development Kit (CDK)](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html), [AWS Console](https://docs.aws.amazon.com/lambda/latest/dg/getting-started.html)) that are covered later in this doc.\n\nHere is how to deploy using the `aws` command line.\n\n```bash\naws lambda create-function \\\n--function-name MyLambda \\\n--zip-file fileb://.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/MyLambda/MyLambda.zip \\\n--runtime provided.al2 \\\n--handler provided  \\\n--architectures arm64 \\\n--role arn:aws:iam::\u003cYOUR_ACCOUNT_ID\u003e:role/lambda_basic_execution\n```\n\nThe `--architectures` flag is only required when you build the binary on an Apple Silicon machine (Apple M1 or more recent). It defaults to `x64`.\n\nBe sure to replace \u003cYOUR_ACCOUNT_ID\u003e with your actual AWS account ID (for example: 012345678901).\n\n\u003e [!IMPORTANT] \n\u003e Before creating a function, you need to have a `lambda_basic_execution` IAM role in your AWS account.\n\u003e\n\u003e You can create this role in two ways:\n\u003e 1. Using AWS Console\n\u003e 2. Running the commands in the `create_lambda_execution_role()` function in [`Examples/_MyFirstFunction/create_iam_role.sh`](https://github.com/swift-server/swift-aws-lambda-runtime/blob/8dff649920ab0c66bb039d15ae48d9d5764db71a/Examples/_MyFirstFunction/create_and_deploy_function.sh#L40C1-L40C31)\n\n6. Invoke your Lambda function\n\n```bash\naws lambda invoke \\\n--function-name MyLambda \\\n--payload $(echo \\\"Hello World\\\" | base64)  \\\nout.txt \u0026\u0026 cat out.txt \u0026\u0026 rm out.txt\n```\n\nThis should print\n\n```\n{\n    \"StatusCode\": 200,\n    \"ExecutedVersion\": \"$LATEST\"\n}\n\"dlroW olleH\"\n```\n\n## Developing your Swift Lambda functions\n\n### Receive and respond with JSON objects\n\nTypically, your Lambda functions will receive an input parameter expressed as JSON and will respond with some other JSON. The Swift AWS Lambda runtime automatically takes care of encoding and decoding JSON objects when your Lambda function handler accepts `Decodable` and returns `Encodable` conforming types.\n\nHere is an example of a minimal function that accepts a JSON object as input and responds with another JSON object.\n\n```swift\nimport AWSLambdaRuntime\n\n// the data structure to represent the input parameter\nstruct HelloRequest: Decodable {\n    let name: String\n    let age: Int\n}\n\n// the data structure to represent the output response\nstruct HelloResponse: Encodable {\n    let greetings: String\n}\n\n// the Lambda runtime\nlet runtime = LambdaRuntime {\n    (event: HelloRequest, context: LambdaContext) in\n\n    HelloResponse(\n        greetings: \"Hello \\(event.name). You look \\(event.age \u003e 30 ? \"younger\" : \"older\") than your age.\"\n    )\n}\n\n// start the loop\ntry await runtime.run()\n```\n\nYou can learn how to deploy and invoke this function in [the Hello JSON example README file](Examples/HelloJSON/README.md).\n\n### Lambda Streaming Response\n\nYou can configure your Lambda function to stream response payloads back to clients. Response streaming can benefit latency sensitive applications by improving time to first byte (TTFB) performance. This is because you can send partial responses back to the client as they become available. Additionally, you can use response streaming to build functions that return larger payloads. Response stream payloads have a soft limit of 20 MB as compared to the 6 MB limit for buffered responses. Streaming a response also means that your function doesn’t need to fit the entire response in memory. For very large responses, this can reduce the amount of memory you need to configure for your function.\n\nStreaming responses incurs a cost. For more information, see [AWS Lambda Pricing](https://aws.amazon.com/lambda/pricing/).\n\nYou can stream responses through [Lambda function URLs](https://docs.aws.amazon.com/lambda/latest/dg/urls-configuration.html), the AWS SDK, or using the Lambda [InvokeWithResponseStream](https://docs.aws.amazon.com/lambda/latest/dg/API_InvokeWithResponseStream.html) API. In this example, we create an authenticated Lambda function URL.\n\nHere is an example of a minimal function that streams 10 numbers with an interval of one second for each number.\n\n```swift\nimport AWSLambdaRuntime\nimport NIOCore\n\nstruct SendNumbersWithPause: StreamingLambdaHandler {\n    func handle(\n        _ event: ByteBuffer,\n        responseWriter: some LambdaResponseStreamWriter,\n        context: LambdaContext\n    ) async throws {\n        for i in 1...10 {\n            // Send partial data\n            try await responseWriter.write(ByteBuffer(string: \"\\(i)\\n\"))\n            // Perform some long asynchronous work\n            try await Task.sleep(for: .milliseconds(1000))\n        }\n        // All data has been sent. Close off the response stream.\n        try await responseWriter.finish()\n    }\n}\n\nlet runtime = LambdaRuntime.init(handler: SendNumbersWithPause())\ntry await runtime.run()\n```\n\nYou can learn how to deploy and invoke this function in [the streaming example README file](Examples/Streaming/README.md).\n\n### Integration with AWS Services\n\n Most Lambda functions are triggered by events originating in other AWS services such as `Amazon SNS`, `Amazon SQS` or `AWS APIGateway`.\n\n The [Swift AWS Lambda Events](http://github.com/swift-server/swift-aws-lambda-events) package includes an `AWSLambdaEvents` module that provides implementations for most common AWS event types further simplifying writing Lambda functions.\n\n Here is an example Lambda function invoked when the AWS APIGateway receives an HTTP request.\n\n ```swift\nimport AWSLambdaEvents\nimport AWSLambdaRuntime\n\nlet runtime = LambdaRuntime {\n    (event: APIGatewayV2Request, context: LambdaContext) -\u003e APIGatewayV2Response in\n\n    APIGatewayV2Response(statusCode: .ok, body: \"Hello World!\")\n}\n\ntry await runtime.run()\n```\n\n You can learn how to deploy and invoke this function in [the API Gateway example README file](Examples/APIGateway/README.md).\n\n### Integration with Swift Service LifeCycle\n\nSupport for [Swift Service Lifecycle](https://github.com/swift-server/swift-service-lifecycle) is currently being implemented. You can follow https://github.com/swift-server/swift-aws-lambda-runtime/issues/374 for more details and teh current status. Your contributions are welcome.\n\n### Use Lambda Background Tasks\n\nBackground tasks allow code to execute asynchronously after the main response has been returned, enabling additional processing without affecting response latency. This approach is ideal for scenarios like logging, data updates, or notifications that can be deferred. The code leverages Lambda's \"Response Streaming\" feature, which is effective for balancing real-time user responsiveness with the ability to perform extended tasks post-response. For more information about Lambda background tasks, see [this AWS blog post](https://aws.amazon.com/blogs/compute/running-code-after-returning-a-response-from-an-aws-lambda-function/).\n\n\nHere is an example of a minimal function that waits 10 seconds after it returned a response but before the handler returns.\n```swift\nimport AWSLambdaRuntime\n#if canImport(FoundationEssentials)\nimport FoundationEssentials\n#else\nimport Foundation\n#endif\n\nstruct BackgroundProcessingHandler: LambdaWithBackgroundProcessingHandler {\n    struct Input: Decodable {\n        let message: String\n    }\n\n    struct Greeting: Encodable {\n        let echoedMessage: String\n    }\n\n    typealias Event = Input\n    typealias Output = Greeting\n\n    func handle(\n        _ event: Event,\n        outputWriter: some LambdaResponseWriter\u003cOutput\u003e,\n        context: LambdaContext\n    ) async throws {\n        // Return result to the Lambda control plane\n        context.logger.debug(\"BackgroundProcessingHandler - message received\")\n        try await outputWriter.write(Greeting(echoedMessage: event.message))\n\n        // Perform some background work, e.g:\n        context.logger.debug(\"BackgroundProcessingHandler - response sent. Performing background tasks.\")\n        try await Task.sleep(for: .seconds(10))\n\n        // Exit the function. All asynchronous work has been executed before exiting the scope of this function.\n        // Follows structured concurrency principles.\n        context.logger.debug(\"BackgroundProcessingHandler - Background tasks completed. Returning\")\n        return\n    }\n}\n\nlet adapter = LambdaCodableAdapter(handler: BackgroundProcessingHandler())\nlet runtime = LambdaRuntime.init(handler: adapter)\ntry await runtime.run()\n```\n\nYou can learn how to deploy and invoke this function in [the background tasks example README file](Examples/BackgroundTasks/README.md).\n\n## Testing Locally\n\nBefore deploying your code to AWS Lambda, you can test it locally by running the executable target on your local machine. It will look like this on CLI:\n\n```sh\nswift run\n```\n\nWhen not running inside a Lambda execution environment, it starts a local HTTP server listening on port 7000. You can invoke your local Lambda function by sending an HTTP POST request to `http://127.0.0.1:7000/invoke`.\n\nThe request must include the JSON payload expected as an `event` by your function. You can create a text file with the JSON payload documented by AWS or captured from a trace.  In this example, we used [the APIGatewayv2 JSON payload from the documentation](https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html#apigateway-example-event), saved as `events/create-session.json` text file.\n\nThen we use curl to invoke the local endpoint with the test JSON payload.\n\n```sh\ncurl -v --header \"Content-Type:\\ application/json\" --data @events/create-session.json http://127.0.0.1:7000/invoke\n*   Trying 127.0.0.1:7000...\n* Connected to 127.0.0.1 (127.0.0.1) port 7000\n\u003e POST /invoke HTTP/1.1\n\u003e Host: 127.0.0.1:7000\n\u003e User-Agent: curl/8.4.0\n\u003e Accept: */*\n\u003e Content-Type:\\ application/json\n\u003e Content-Length: 1160\n\u003e\n\u003c HTTP/1.1 200 OK\n\u003c content-length: 247\n\u003c\n* Connection #0 to host 127.0.0.1 left intact\n{\"statusCode\":200,\"isBase64Encoded\":false,\"body\":\"...\",\"headers\":{\"Access-Control-Allow-Origin\":\"*\",\"Content-Type\":\"application\\/json; charset=utf-8\",\"Access-Control-Allow-Headers\":\"*\"}}\n```\n### Modifying the local endpoint\n\nBy default, when using the local Lambda server, it listens on the `/invoke` endpoint.\n\nSome testing tools, such as the [AWS Lambda runtime interface emulator](https://docs.aws.amazon.com/lambda/latest/dg/images-test.html), require a different endpoint. In that case, you can use the `LOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT` environment variable to force the runtime to listen on a different endpoint.\n\nExample:\n\n```sh\nLOCAL_LAMBDA_SERVER_INVOCATION_ENDPOINT=/2015-03-31/functions/function/invocations swift run\n```\n\n## Deploying your Swift Lambda functions\n\nThere is a full deployment guide available in [the documentation](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/main/documentation/awslambdaruntime/deployment).\n\nThere are multiple ways to deploy your Swift code to AWS Lambda. The very first time, you'll probably use the AWS Console to create a new Lambda function and upload your code as a zip file. However, as you iterate on your code, you'll want to automate the deployment process.\n\nTo take full advantage of the cloud, we recommend using Infrastructure as Code (IaC) tools like the [AWS Serverless Application Model (SAM)](https://aws.amazon.com/serverless/sam/) or [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/cdk/). These tools allow you to define your infrastructure and deployment process as code, which can be version-controlled and automated.\n\nAlternatively, you might also consider using popular third-party tools like [Serverless Framework](https://www.serverless.com/), [Terraform](https://www.terraform.io/), or [Pulumi](https://www.pulumi.com/) to deploy Lambda functions and create and manage AWS infrastructure.\n\nHere is a short example that shows how to deploy using SAM.\n\n**Prerequisites** : Install the [SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html)\n\nWhen using SAM, you describe your deployment in a YAML text file.\nThe [API Gateway example directory](Examples/APIGateway/template.yaml) contains a file named `template.yaml` that you can use as a starting point.\n\nTo deploy your Lambda function and create the infrastructure, type the following `sam` command.\n\n```bash\nsam deploy \\\n--resolve-s3 \\\n--template-file template.yaml \\\n--stack-name APIGatewayLambda \\\n--capabilities CAPABILITY_IAM \n```\n\nAt the end of the deployment, the script lists the API Gateway endpoint.\nThe output is similar to this one.\n\n```\n-----------------------------------------------------------------------------------------------------------------------------\nOutputs                                                                                                                     \n-----------------------------------------------------------------------------------------------------------------------------\nKey                 APIGatewayEndpoint                                                                                      \nDescription         API Gateway endpoint URL\"                                                                                \nValue               https://a5q74es3k2.execute-api.us-east-1.amazonaws.com                                                  \n-----------------------------------------------------------------------------------------------------------------------------\n```\n\nPlease refer to the full deployment guide available in [the documentation](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/main/documentation/awslambdaruntime) for more details.\n\n## Swift AWS Lambda Runtime - Design Principles\n\nThe [design document](Sources/AWSLambdaRuntime/Documentation.docc/Proposals/0001-v2-api.md) details the v2 API proposal for the swift-aws-lambda-runtime library, which aims to enhance the developer experience for building serverless functions in Swift.\n\nThe proposal has been reviewed and [incorporated feedback from the community](https://forums.swift.org/t/aws-lambda-v2-api-proposal/73819). The full v2 API design document is available [in this repository](Sources/AWSLambdaRuntime/Documentation.docc/Proposals/0001-v2-api.md).\n\n### Key Design Principles\n\nThe v2 API prioritizes the following principles:\n\n- Readability and Maintainability: Extensive use of `async`/`await` improves code clarity and simplifies maintenance.\n\n- Developer Control: Developers own the `main()` function and have the flexibility to inject dependencies into the `LambdaRuntime`. This allows you to manage service lifecycles efficiently using [Swift Service Lifecycle](https://github.com/swift-server/swift-service-lifecycle) for structured concurrency.\n\n- Simplified Codable Support: The `LambdaCodableAdapter` struct eliminates the need for verbose boilerplate code when encoding and decoding events and responses.\n\n### New Capabilities\n\nThe v2 API introduces two new features:\n\n[Response Streaming](https://aws.amazon.com/blogs/compute/introducing-aws-lambda-response-streaming/]): This functionality is ideal for handling large responses that need to be sent incrementally.  \n\n[Background Work](https://aws.amazon.com/blogs/compute/running-code-after-returning-a-response-from-an-aws-lambda-function/): Schedule tasks to run after returning a response to the AWS Lambda control plane.\n\nThese new capabilities provide greater flexibility and control when building serverless functions in Swift with the swift-aws-lambda-runtime library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswift-server%2Fswift-aws-lambda-runtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswift-server%2Fswift-aws-lambda-runtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswift-server%2Fswift-aws-lambda-runtime/lists"}