Slide 12
Slide 12 text
import AWSLambdaSwift
struct Event: Codable {
}
struct Result: Codable {
let result: String
}
func sample(event: Event, context: Context) -> Result {
let boto3 = Python.import("boto3")
let dynamodb = boto3.resource("dynamodb")
let table = dynamodb.Table("swift-sample")
return Result(result: "\(table.scan())")
}
let runtime = try Runtime()
runtime.registerLambda("sample", handlerFunction: sample)
try runtime.start()