Linux command
aws-lambda 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Create a function
aws lambda create-function --function-name [my-function] --runtime python3.11 --role [arn:aws:iam::account:role/lambda-role] --handler [index.handler] --zip-file fileb://[function.zip]
Invoke a function
aws lambda invoke --function-name [my-function] --payload '{"key": "value"}' response.json
List all functions
aws lambda list-functions
Update function code
aws lambda update-function-code --function-name [my-function] --zip-file fileb://[function.zip]
Update function configuration
aws lambda update-function-configuration --function-name [my-function] --memory-size 512 --timeout 30
Create an event source mapping
aws lambda create-event-source-mapping --function-name [my-function] --event-source-arn [arn:aws:sqs:region:account:queue-name]
Publish a new version
aws lambda publish-version --function-name [my-function]
说明
aws lambda is the AWS CLI interface for AWS Lambda, a serverless compute service that runs code in response to events without provisioning or managing servers. Lambda automatically scales and handles high availability. Lambda supports multiple runtimes including Python, Node.js, Java, Go, Ruby, .NET, and custom runtimes. Functions can be triggered by AWS services, HTTP requests via API Gateway, or direct invocation.
FAQ
What is the aws-lambda command used for?
aws lambda is the AWS CLI interface for AWS Lambda, a serverless compute service that runs code in response to events without provisioning or managing servers. Lambda automatically scales and handles high availability. Lambda supports multiple runtimes including Python, Node.js, Java, Go, Ruby, .NET, and custom runtimes. Functions can be triggered by AWS services, HTTP requests via API Gateway, or direct invocation.
How do I run a basic aws-lambda example?
Run `aws lambda create-function --function-name [my-function] --runtime python3.11 --role [arn:aws:iam::account:role/lambda-role] --handler [index.handler] --zip-file fileb://[function.zip]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more aws-lambda examples?
This page includes 7 examples for aws-lambda, plus related commands for nearby Linux tasks.