aws-lambda
Manage AWS Lambda functions
TLDR
Run a function
Run a function with an input payload in JSON format
List functions
Display the configuration of a function
List function aliases
Display the reserved concurrency configuration for a function
List which AWS services can invoke the function
SYNOPSIS
aws lambda [command] [options]
PARAMETERS
create-function
Creates a Lambda function.
update-function-code
Updates the code of an existing Lambda function.
invoke
Invokes a Lambda function and returns the result.
delete-function
Deletes a Lambda function.
get-function
Retrieves information about a Lambda function.
list-functions
Lists all Lambda functions in your account.
--function-name name
Specifies the name of the Lambda function.
--runtime runtime
Specifies the runtime environment for the function (e.g., python3.9, nodejs16.x).
--zip-file fileb://path/to/file.zip
Specifies the path to the ZIP file containing the function code.
--handler handler
Specifies the function entry point (e.g., `index.handler`).
--role arn
Specifies the IAM role that the function will assume.
DESCRIPTION
The `aws-lambda` command is not a standard Linux command but typically refers to a command-line tool or script used to interact with Amazon Web Services (AWS) Lambda service. It's part of the AWS CLI or a custom-built tool. It allows users to manage Lambda functions, including creating, deploying, updating, invoking, and deleting them. This includes tasks like packaging code into deployment bundles, configuring function settings (memory, timeout, execution role), uploading these packages to AWS, testing function execution, monitoring function metrics, and managing function versions and aliases.
The specific functionalities and syntax depend on the AWS CLI version and any custom tooling developed around it. The AWS CLI is regularly updated to support new Lambda features and improvements. Using `aws-lambda` typically requires configuring your AWS credentials correctly via `aws configure` so the tool can authenticate to your AWS account.
CAVEATS
Requires properly configured AWS credentials. Function code must be packaged into a ZIP file. IAM role must have appropriate permissions for the function to access other AWS services.
PACKAGING REQUIREMENTS
The Lambda function code and any dependencies must be packaged into a deployment package (typically a ZIP file). The structure and contents of this package depend on the programming language and runtime used. For example, Python functions need their dependencies within the archive, while Node.js function dependencies can be uploaded in layers or bundled together.
IAM PERMISSIONS
The IAM role associated with the Lambda function needs to have specific permissions granted to allow the function to access other AWS services (e.g., S3, DynamoDB, SNS). Without these permissions, the function will not be able to perform those actions.
INVOCATION TYPES
Lambda functions can be invoked synchronously or asynchronously. Synchronous invocation waits for the function to complete and returns the result. Asynchronous invocation puts the event in a queue and returns immediately. The choice of invocation type depends on the use case.
HISTORY
The `aws lambda` command is a component of the AWS CLI, which has evolved significantly since AWS Lambda's initial release in 2014. The command has been enhanced with new features and options as Lambda's capabilities have expanded, including support for layers, container images, and new runtimes. Its usage is now widespread among developers building serverless applications on AWS.