Run your Vapor api server on AWS Lambda using the official Swift Server runtime.

What's New



Make LambdaServer.Configuration public so you can change it


Swift 5.2 Vapor 4 github-actions codecov

Run your Vapor app on AWS Lambda. This package bridges the communication between swift-aws-lambda-runtime and the Vapor framework. APIGateway requests are transformed into Vapor.Requests and Vapor.Responses are written back to the APIGateway. It intents to bring the funcionality of aws-lambda-go-api-proxy to Vapor.


Note: Currently this is nothing more than a proof of concept. Use at your own risk. I would like to hear feedback, if you played with this. Please open a GitHub issues for all open ends, you experience.

What I have tested:

  • Routing
  • JSON Coding
  • Cors Middleware
  • Fluent

There are probably tons of other things that we should test. I haven't done much with Vapor so far. Therefore you will need to help me list the things to test.


If you test anything, please open a PR so that we can document the state of affairs better. A super small example would be even better. I plan to create some integration tests with the examples.


Add vapor-aws-lambda-runtime and vapor as dependencies to your project. For this open your Package.swift:

  dependencies: [
    .package(url: "", .upToNextMajor(from: "4.0.0")),
    .package(url: "", .upToNextMajor(from: "0.4.0")),

Add VaporLambdaRuntime as depency to your target:

  targets: [
    .target(name: "Hello", dependencies: [
      .product(name: "Vapor", package: "vapor"),
      .product(name: "VaporAWSLambdaRuntime", package: "vapor-aws-lambda-runtime")

Create a simple Vapor app.

import Vapor
import VaporAWSLambdaRuntime

let app = Application()

struct Name: Codable {
  let name: String

struct Hello: Content {
  let hello: String

app.get("hello") { (_) -> Hello in
  Hello(hello: "world")
}"hello") { req -> Hello in
  let name = try req.content.decode(Name.self)
  return Hello(hello:

Next we just need to run the vapor app. To enable running in Lambda, we need to change the "serve" command. Then we can start the app by calling




Please feel welcome and encouraged to contribute to vapor-aws-lambda-runtime. The current version has a long way to go before being ready for production use and help is always welcome.

If you've found a bug, have a suggestion or need help getting started, please open an Issue or a PR. If you use this package, I'd be grateful for sharing your experience.

If you like this project, I'm excited about GitHub stars. 🤓


  • Swift Tools 5.2.0
View More Packages from this Author


Last updated: Fri May 26 2023 22:45:11 GMT-0500 (GMT-05:00)