Skip to content

Latest commit

 

History

History
91 lines (60 loc) · 3.6 KB

README.md

File metadata and controls

91 lines (60 loc) · 3.6 KB

AWS SDK for Rust code examples for Lambda

Purpose

These examples demonstrate how to perform several AWS Lambda (Lambda) operations using the alpha version of the AWS SDK for Rust.

Use Lambda to run code without provisioning or managing servers.

Code examples

⚠ Important

  • We recommend that you grant this code least privilege, or at most the minimum permissions required to perform the task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
  • This code has not been tested in all AWS Regions. Some AWS services are available only in specific Regions.
  • Running this code might result in charges to your AWS account.

Running the code examples

Prerequisites

You must have an AWS account, and have configured your default credentials and AWS Region as described in https://github.com/awslabs/aws-sdk-rust.

change-java-runtime

If a Lambda function uses a Java runtime, this example sets its runtime to Corretto.

cargo run --bin change-java-runtime -- -a ARN [-r REGION] [-v]

  • ARN is the ARN of the function.
  • REGION is the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

invoke-function

This example invokes a Lambda function.

cargo run --bin invoke-function -- -a ARN [-r REGION] [-v]

  • ARN is the ARN of the function to invoke.
  • REGION is the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

list-all-function-runtimes

This example lists the ARNs and runtimes of all Lambda functions in all Regions.

cargo run --bin list-all-function-runtimes -- [-r REGION] [-v]

  • REGION is the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

list-functions

This example lists your AWS Lambda functions.

cargo run --bin list-functions -- [-r REGION] [-v]

  • REGION is the Region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
  • -v displays additional information.

Resources

Contributing

To propose a new code example to the AWS documentation team, see CONTRIBUTING.md. The team prefers to create code examples that show broad scenarios rather than individual API calls.

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0