Package Exports
- serverless-swift
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-swift) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
serverless swift 
A ⚡ Serverless framework ⚡ plugin for Swift applications
📦 Install
Install the plugin with npm
$ npm i -D serverless-swift
💡 This serverless plugin assumes you are building Swift lambdas targeting the AWS Lambda "provided" runtime. The AWS Lambda Swfit Sprinter makes this possible.
Add the following to your serverless project's serverless.yml
file
service: demo
provider:
name: aws
runtime: swift
plugins:
# this adds informs serverless to use
# the serverless-swift plugin
- serverless-swift
# creates one artifact for each function
package:
individually: true
functions:
test:
# handler value syntax is `{your-executable-binary}.{bin-name}`
# or `{your-executable-binary}` for short when you are building a
# default bin for a given package.
handler: your-executable-binary
The build needs to generate a swift executable. The name of the executable will either be the Swift project parent folder name or as specified in the Package.swift file, to replace with
Currently on every deploy it creates an AWS Lambda Layer, that is attached automatically to every swift functions. The layer makes it possible for the executable Swift binary to run in the Lambda.
Configuration
Swift private packages on Github
When dealing with private swift packages held in github you can either forwards the ssh keys or the ssh agent so that the container will have access to clone the repos.
SSH Keys
We can forward the ssh folder from the host machine to the running container (when it has no passphrase).
We can do this by setting custom variables to activate it:
custom:
swift:
ssh:
keys: true
Or you can activate it via the command line:
sls <deploy/package> --ssh-keys
SSH Agent
We can forward the ssh agent from the host machine to the running container (useful when ssh key has passphrease). Currently this only works with Docker Machine for MacOS, version 2.1.6.0(408) from the edge channel.
We can do this by setting custom variables to activate it:
custom:
swift:
ssh:
agent: true
Or you can activate it via the command line:
sls <deploy/package> --ssh-agent
🙌 Acknowledgements
This project has been possible thanks to the following people:
- Doug Tangren : https://github.com/softprops/serverless-rust
- Andrea Scuderi : https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core