go/lambda/README.md
These examples demonstrate how to perform several AWS Lambda operations.
You must have an AWS account, and have your default credentials and AWS Region configured as described in Configuring the AWS SDK for Go in the AWS SDK for Go Developer Guide.
This example enables an Amazon S3 bucket to send notifications to an AWS Lambda function.
go run ConfigureFunction.go -f FUNCTION -a ARN
The unit test mocks the service client and the AddPermission function.
This example creates an AWS Lambda function.
go run MakeFunction.go -z ZIPFILE -b BUCKET -f FUNCTION -h HANDLER -a ROLE-ARN -r RUNTIME
The unit test mocks the service client and the CreateFunction function.
This example executes an AWS Lambda function.
go run RunFunction.go -f FUNCTION -f FUNCTION [-m MAX-ITEMS]
The unit test mocks the service client and the Invoke function.
This example displays a list of your AWS Lambda functions.
go run ShowFunctions.go
The unit test mocks the service client and the ListFunctions function.
Unit tests should delete any resources they create. However, they might result in charges to your AWS account.
To run a unit test, enter the following.
go test
You should see something like the following, where PATH is the path to the folder containing the Go files.
PASS
ok PATH 6.593s
To see any log messages, enter the following.
go test -test.v
You should see additional log messages. The last two lines should be similar to the previous output shown.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0