-
Notifications
You must be signed in to change notification settings - Fork 113
[doc] Getting Started documentation and tutorial #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
32005a2
Initial Commit for getting started documentation
sebsto 1999660
fix typos and errors
sebsto 76008fd
fix link
sebsto 75e429c
cleanup files
sebsto 54ff67c
simplify package version dependency
sebsto 8f2aed3
fix swiftformat issues
sebsto 6e98a92
remove swift-backtrace in swift >= 5.9 (#305)
tomerd b7ddc82
Merge branch 'swift-server:main' into sebsto/getting-started-doc
sebsto a186ee4
Merge branch 'master' into sebsto/getting-started-doc
sebsto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
xcuserdata | ||
Package.resolved | ||
.serverless | ||
.vscode |
24 changes: 24 additions & 0 deletions
24
Sources/AWSLambdaRuntimeCore/Documentation.docc/Documentation.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# ``AWSLambdaRuntimeCore`` | ||
|
||
An AWS Lambda runtime for the Swift programming language | ||
|
||
## Overview | ||
|
||
Many 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. | ||
|
||
Serverless 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. | ||
|
||
When 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. | ||
|
||
Combine 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. | ||
|
||
Swift 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-api.html) and uses an embedded asynchronous HTTP client based on [SwiftNIO](https://github.com/apple/swift-nio) that is fine-tuned for performance in the AWS Lambda 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. | ||
|
||
## Topics | ||
|
||
### Essentials | ||
|
||
- <doc:quick-setup> | ||
- <doc:/tutorials/table-of-content> | ||
- ``LambdaHandler`` | ||
|
2 changes: 2 additions & 0 deletions
2
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-01-01-package-init.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Create a project directory | ||
mkdir SquareNumber && cd SquareNumber |
4 changes: 4 additions & 0 deletions
4
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-01-02-package-init.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Create a project directory | ||
mkdir SquareNumber && cd SquareNumber | ||
# create a skeleton project | ||
swift package init --type executable |
6 changes: 6 additions & 0 deletions
6
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-01-03-package-init.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Create a project directory | ||
mkdir SquareNumber && cd SquareNumber | ||
# create a skeleton project | ||
swift package init --type executable | ||
# open Xcode in the current directory | ||
xed . |
8 changes: 8 additions & 0 deletions
8
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-01-04-package-init.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Create a project directory | ||
mkdir SquareNumber && cd SquareNumber | ||
# create a skeleton project | ||
swift package init --type executable | ||
# open Xcode in the current directory | ||
xed . | ||
# alternatively, you may open VSCode | ||
code . |
8 changes: 8 additions & 0 deletions
8
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-02-01-package.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// swift-tools-version:5.8 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "SquareNumberLambda", | ||
) |
11 changes: 11 additions & 0 deletions
11
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-02-02-package.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// swift-tools-version:5.8 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "SquareNumberLambda", | ||
platforms: [ | ||
.macOS(.v12), | ||
], | ||
) |
14 changes: 14 additions & 0 deletions
14
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-02-03-package.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// swift-tools-version:5.8 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "SquareNumberLambda", | ||
platforms: [ | ||
.macOS(.v12), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", .upToNextMajor(from: "1.0.0-alpha")), | ||
], | ||
) |
17 changes: 17 additions & 0 deletions
17
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-02-04-package.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// swift-tools-version:5.8 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "SquareNumberLambda", | ||
platforms: [ | ||
.macOS(.v12), | ||
], | ||
products: [ | ||
.executable(name: "SquareNumberLambda", targets: ["SquareNumberLambda"]), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", .upToNextMajor(from: "1.0.0-alpha")), | ||
], | ||
) |
26 changes: 26 additions & 0 deletions
26
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-02-05-package.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// swift-tools-version:5.8 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "SquareNumberLambda", | ||
platforms: [ | ||
.macOS(.v12), | ||
], | ||
products: [ | ||
.executable(name: "SquareNumberLambda", targets: ["SquareNumberLambda"]), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", .upToNextMajor(from: "1.0.0-alpha")), | ||
], | ||
targets: [ | ||
.executableTarget( | ||
name: "SquareNumberLambda", | ||
dependencies: [ | ||
.product(name: "AWSLambdaRuntime", package: "swift-aws-lambda-runtime"), | ||
], | ||
path: "." | ||
), | ||
] | ||
) |
5 changes: 5 additions & 0 deletions
5
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-03-01-main.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
@main | ||
struct SquareNumberHandler: SimpleLambdaHandler { | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-03-02-main.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import AWSLambdaRuntime | ||
|
||
@main | ||
struct SquareNumberHandler: SimpleLambdaHandler { | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-03-03-main.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import AWSLambdaRuntime | ||
|
||
@main | ||
struct SquareNumberHandler: SimpleLambdaHandler { | ||
|
||
func handle(_ event: Event, context: LambdaContext) async throws -> Output { | ||
|
||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-03-04-main.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import AWSLambdaRuntime | ||
|
||
struct Input: Codable { | ||
let number: Double | ||
} | ||
|
||
struct Number: Codable { | ||
let result: Double | ||
} | ||
|
||
@main | ||
struct SquareNumberHandler: SimpleLambdaHandler { | ||
|
||
func handle(_ event: Event, context: LambdaContext) async throws -> Output { | ||
|
||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-03-05-main.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import AWSLambdaRuntime | ||
|
||
struct Input: Codable { | ||
let number: Double | ||
} | ||
|
||
struct Number: Codable { | ||
let result: Double | ||
} | ||
|
||
@main | ||
struct SquareNumberHandler: SimpleLambdaHandler { | ||
typealias Event = Input | ||
typealias Output = Number | ||
|
||
func handle(_ event: Event, context: LambdaContext) async throws -> Output { | ||
|
||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-03-06-main.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import AWSLambdaRuntime | ||
|
||
struct Input: Codable { | ||
let number: Double | ||
} | ||
|
||
struct Number: Codable { | ||
let result: Double | ||
} | ||
|
||
@main | ||
struct SquareNumberHandler: SimpleLambdaHandler { | ||
typealias Event = Input | ||
typealias Output = Number | ||
|
||
func handle(_ event: Event, context: LambdaContext) async throws -> Output { | ||
return Number(result: event.number * event.number) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-03-xx-main.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import AWSLambdaRuntime | ||
|
||
struct Input: Codable { | ||
let number: Double | ||
} | ||
|
||
struct Number: Codable { | ||
let result: Double | ||
} | ||
|
||
@main | ||
struct SquareNumberHandler: SimpleLambdaHandler { | ||
typealias Event = Input | ||
typealias Output = Number | ||
|
||
func handle(_ event: Input, context: LambdaContext) async throws -> Number { | ||
Number(result: event.number * event.number) | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-04-03-console-output.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
2023-04-14T11:42:21+0200 info LocalLambdaServer : [AWSLambdaRuntimeCore] LocalLambdaServer started and listening on 127.0.0.1:7000, receiving events on /invoke | ||
2023-04-14T11:42:21+0200 info Lambda : [AWSLambdaRuntimeCore] lambda runtime starting with LambdaConfiguration | ||
General(logLevel: info)) | ||
Lifecycle(id: 104957691689708, maxTimes: 0, stopSignal: TERM) | ||
RuntimeEngine(ip: 127.0.0.1, port: 7000, requestTimeout: nil |
5 changes: 5 additions & 0 deletions
5
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-04-04-curl.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
curl --header "Content-Type: application/json" \ | ||
--request POST \ | ||
--data '{"number": 3}' \ | ||
http://localhost:7000/invoke | ||
|
6 changes: 6 additions & 0 deletions
6
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-04-05-curl.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
curl --header "Content-Type: application/json" \ | ||
--request POST \ | ||
--data '{"number": 3}' \ | ||
http://localhost:7000/invoke | ||
|
||
{"result":9} |
2 changes: 2 additions & 0 deletions
2
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-04-06-terminal.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export LOCAL_LAMBDA_SERVER_ENABLED=true | ||
|
2 changes: 2 additions & 0 deletions
2
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-04-07-terminal.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export LOCAL_LAMBDA_SERVER_ENABLED=true | ||
swift run |
10 changes: 10 additions & 0 deletions
10
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/03-04-08-terminal.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export LOCAL_LAMBDA_SERVER_ENABLED=true | ||
swift run | ||
|
||
Building for debugging... | ||
Build complete! (0.20s) | ||
2023-04-14T10:52:25+0200 info LocalLambdaServer : [AWSLambdaRuntimeCore] LocalLambdaServer started and listening on 127.0.0.1:7000, receiving events on /invoke | ||
2023-04-14T10:52:25+0200 info Lambda : [AWSLambdaRuntimeCore] lambda runtime starting with LambdaConfiguration | ||
General(logLevel: info)) | ||
Lifecycle(id: 102943961260250, maxTimes: 0, stopSignal: TERM) | ||
RuntimeEngine(ip: 127.0.0.1, port: 7000, requestTimeout: nil |
2 changes: 2 additions & 0 deletions
2
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-01-02-plugin-archive.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
swift package --disable-sandbox plugin archive | ||
|
19 changes: 19 additions & 0 deletions
19
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-01-03-plugin-archive.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
swift package --disable-sandbox plugin archive | ||
|
||
------------------------------------------------------------------------- | ||
building "squarenumberlambda" in docker | ||
------------------------------------------------------------------------- | ||
updating "swift:amazonlinux2" docker image | ||
amazonlinux2: Pulling from library/swift | ||
Digest: sha256:5b0cbe56e35210fa90365ba3a4db9cd2b284a5b74d959fc1ee56a13e9c35b378 | ||
Status: Image is up to date for swift:amazonlinux2 | ||
docker.io/library/swift:amazonlinux2 | ||
building "SquareNumberLambda" | ||
Building for production... | ||
... | ||
------------------------------------------------------------------------- | ||
archiving "SquareNumberLambda" | ||
------------------------------------------------------------------------- | ||
1 archive created | ||
* SquareNumberLambda at /Users/YourUserName/SquareNumberLambda/.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/SquareNumberLambda/SquareNumberLambda.zip | ||
|
21 changes: 21 additions & 0 deletions
21
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-01-04-plugin-archive.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
swift package --disable-sandbox plugin archive | ||
|
||
------------------------------------------------------------------------- | ||
building "squarenumberlambda" in docker | ||
------------------------------------------------------------------------- | ||
updating "swift:amazonlinux2" docker image | ||
amazonlinux2: Pulling from library/swift | ||
Digest: sha256:5b0cbe56e35210fa90365ba3a4db9cd2b284a5b74d959fc1ee56a13e9c35b378 | ||
Status: Image is up to date for swift:amazonlinux2 | ||
docker.io/library/swift:amazonlinux2 | ||
building "SquareNumberLambda" | ||
Building for production... | ||
... | ||
------------------------------------------------------------------------- | ||
archiving "SquareNumberLambda" | ||
------------------------------------------------------------------------- | ||
1 archive created | ||
* SquareNumberLambda at /Users/YourUserName/SquareNumberLambda/.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/SquareNumberLambda/SquareNumberLambda.zip | ||
|
||
|
||
cp .build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/SquareNumberLambda/SquareNumberLambda.zip ~/Desktop |
1 change: 1 addition & 0 deletions
1
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-03-01-aws-cli.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aws --version |
7 changes: 7 additions & 0 deletions
7
...s/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-03-02-lambda-invoke-hidden.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# | ||
# --region the AWS Region to send the command | ||
# --function-name the name of your function | ||
# --cli-binary-format tells the cli to use raw data as input (default is base64) | ||
# --payload the payload to pass to your function code | ||
# result.json the name of the file to store the response from the function | ||
|
14 changes: 14 additions & 0 deletions
14
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-03-02-lambda-invoke.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# | ||
# --region the AWS Region to send the command | ||
# --function-name the name of your function | ||
# --cli-binary-format tells the cli to use raw data as input (default is base64) | ||
# --payload the payload to pass to your function code | ||
# result.json the name of the file to store the response from the function | ||
|
||
aws lambda invoke \ | ||
--region us-west-2 \ | ||
--function-name SquaredNumberLambda \ | ||
--cli-binary-format raw-in-base64-out \ | ||
--payload '{"number":3}' \ | ||
result.json | ||
|
18 changes: 18 additions & 0 deletions
18
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-03-03-lambda-invoke.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# | ||
# --region the AWS Region to send the command | ||
# --function-name the name of your function | ||
# --cli-binary-format tells the cli to use raw data as input (default is base64) | ||
# --payload the payload to pass to your function code | ||
# result.json the name of the file to store the response from the function | ||
|
||
aws lambda invoke \ | ||
--region us-west-2 \ | ||
--function-name SquaredNumberLambda \ | ||
--cli-binary-format raw-in-base64-out \ | ||
--payload '{"number":3}' \ | ||
result.json | ||
|
||
{ | ||
"StatusCode": 200, | ||
"ExecutedVersion": "$LATEST" | ||
} |
20 changes: 20 additions & 0 deletions
20
Sources/AWSLambdaRuntimeCore/Documentation.docc/Resources/code/04-03-04-lambda-invoke.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# --region the AWS Region to send the command | ||
# --function-name the name of your function | ||
# --cli-binary-format tells the cli to use raw data as input (default is base64) | ||
# --payload the payload to pass to your function code | ||
# result.json the name of the file to store the response from the function | ||
|
||
aws lambda invoke \ | ||
--region us-west-2 \ | ||
--function-name SquaredNumberLambda \ | ||
--cli-binary-format raw-in-base64-out \ | ||
--payload '{"number":3}' \ | ||
result.json | ||
|
||
{ | ||
"StatusCode": 200, | ||
"ExecutedVersion": "$LATEST" | ||
} | ||
|
||
cat result.json |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.