ladderlore
  • 输入服务名称,例如 S3 或 IAM。

服务 · 无服务器

AWS Lambda

Runs your code in response to events, with no servers to manage.

本课尚未翻译,暂以英文显示。

  1. 1An event arrives: a file lands in S3, a request comes through API Gateway, or an EventBridge rule fires.
  2. 2Lambda runs your function, which here saves the result in Amazon DynamoDB.
Events from other services trigger a Lambda function.

分步说明

  1. 1An event arrives: a file lands in S3, a request comes through API Gateway, or an EventBridge rule fires.
  2. 2Lambda runs your function, which here saves the result in Amazon DynamoDB.
  • You deploy

    Lambda
    A function: your code
    Fargate
    A container image
    EC2
    A server built from an AMI
  • You manage

    Lambda
    Your code and its settings
    Fargate
    Your containers and their settings
    EC2
    The operating system and everything on it
  • You pay for

    Lambda
    Requests and run time
    Fargate
    CPU and memory while tasks run
    EC2
    Instances while they run
  • One run can last

    Lambda
    Up to 15 minutes, by default
    Fargate
    As long as needed
    EC2
    As long as needed
Lambda, Fargate and EC2 compared.

1 / 2

  • You deploy

    Lambda
    A function: your code
    Fargate
    A container image
    EC2
    A server built from an AMI
  • You manage

    Lambda
    Your code and its settings
    Fargate
    Your containers and their settings
    EC2
    The operating system and everything on it

2 / 2

  • You pay for

    Lambda
    Requests and run time
    Fargate
    CPU and memory while tasks run
    EC2
    Instances while they run
  • One run can last

    Lambda
    Up to 15 minutes, by default
    Fargate
    As long as needed
    EC2
    As long as needed
Lambda, Fargate and EC2 compared.

是什么

AWS Lambda runs your code without you provisioning or managing servers. You upload a function, connect it to a trigger, and Lambda runs it each time the event happens. AWS handles the servers, the operating system, scaling and patching. AWS now calls this kind of function a Lambda Event Function, to tell it apart from newer Lambda options.

是什么

Many AWS services can trigger a function. A new file in Amazon Simple Storage Service (Amazon S3) or a request through Amazon API Gateway can start it. So can a message in an Amazon Simple Queue Service (Amazon SQS) queue, or a rule or schedule in Amazon EventBridge. Lambda scales automatically, from a few events a day to heavy traffic.

You pay for the number of requests and the time your code runs, not for idle time. By default, one run can last up to 15 minutes. Longer jobs fit better on AWS Fargate, AWS Batch or Amazon Elastic Compute Cloud (Amazon EC2).

要记住

  • Event-driven: code runs when something happens.
  • No servers to provision, patch or scale.
  • Pay per request and for run time, not for idle time.
  • One run lasts up to 15 minutes by default.
  • You manage your code, its permissions and your data. AWS runs everything under it.

考试中

  • “Run code in response to events without provisioning or managing servers” points to AWS Lambda.
  • “A job that runs for several hours” does not fit Lambda. Look at AWS Batch, AWS Fargate or Amazon EC2.