The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications. This page shows you how to use SAM to deploy Server-side Swift applications to AWS. Each application uses AWS Lambda Functions written in Swift. The functions use the AWS SDK for Swift and the Swift AWS Lambda Runtime.
To deploy an application using SAM, you need an AWS account and the following tools on your development machine. While it may work with alternative versions, we recommend you deploy the specified minimum version.
Note: make sure you upgrade to SAM CLI version 1.103.0 or later. These templates will only work with that version of SAM or greater.
Once you have the tools installed, from a command prompt on your machine, use the sam init command to initialize a new project.
sam init --location gh:aws-samples/aws-sam-swift
When prompted, specify a name for your project and select the template for the type of project you want to generate. Then switch to the project’s folder.
Application specific instructions to build, deploy, and use the application are located in the README.md file of the generated project.
The tool supports these templates.
Hello World creates a basic Lambda function written in Swift that returns a welcome message. It also creates an Amazon API Gateway REST endpoint to invoke your function.
REST API creates a full REST API using Amazon API Gateway to add, update, select, and remove items in an Amazon DynamoDB database. API Gateway uses Lambda functions written in Swift to handle each action.
GraphQL API creates an AWS AppSync GraphQL API that queries location data from the Amazon Location Service. It also queries weather data from a 3rd party weather API. AppSync uses Lambda functions written in Swift to handle each action.
This library is licensed under the MIT-0 License. See the LICENSE file in the project code repository.