AWS Lambda

From Wikipedia, the free encyclopedia
AWS Lambda
Developer(s)Amazon.com
Initial releaseNovember 13, 2014; 9 years ago (2014-11-13)
Operating systemCross-platform
Available inEnglish
Websiteaws.amazon.com/lambda Edit this on Wikidata

AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services. It is designed to enable developers to run code without provisioning or managing servers. It executes code in response to events and automatically manages the computing resources required by that code. It was introduced on November 13, 2014.[1]

Node.js, Python, Java, Go,[2] Ruby,[3] and C# (through .NET) are all officially supported as of 2018. In late 2018, custom runtime support[4] was added to AWS Lambda.

AWS Lambda supports running native Linux executables by calling them from a supported runtime, such as Node.js.[5] For example, Haskell code can be run on Lambda.[6]

AWS Lambda was primarily designed for tasks such as handling image and object uploads to Amazon S3, updating DynamoDB tables, responding to website clicks and reacting to sensor readings from IoT connected devices. AWS Lambda can also be used to automatically provision back-end services triggered by custom HTTP requests, and "spin down" such services when not in use to save resources. These custom HTTP requests are configured in AWS API Gateway, which can also handle authentication and authorization in conjunction with AWS Cognito.

Unlike Amazon EC2, which is priced by the hour but metered by the second, AWS Lambda is metered by rounding up to the nearest millisecond with no minimum execution time.

AWS Lambda functions are often used in association with AWS SQS queues to process asynchronous tasks in distributed architectures.

In 2019, at the AWS annual cloud computing conference (AWS re:Invent), the AWS Lambda team announced "Provisioned Concurrency", a feature that "keeps functions initialized and hyper-ready to respond in double-digit milliseconds."[7] The Lambda team described Provisioned Concurrency as "ideal for implementing interactive services, such as web and mobile backends, latency-sensitive microservices, or synchronous APIs."[8]

Specification[edit]

Each AWS Lambda instance is a container created from Amazon Linux AMIs (a Linux distribution related to RHEL) with 128–10240 MB of RAM (in 1 MB increments),[9] 512 MB to 10 GB of ephemeral storage in /tmp folder,[10] and a configurable execution time from 1 to 900 seconds. Ephemeral storage remains locally available only for the duration of the instance and is discarded after all tasks running on the instance are complete.

Since December 2020, Lambda has been capable of supporting Docker containers through ECR up to 10 GB in size.[11]

AWS Lambda Function URL[edit]

The Lambda Function URL gives Lambda a unique and permanent URL which can be accessed by authenticated and non-authenticated users alike.[12] It was launched in April 6, 2022 by the AWS Lambda team.[13]

Format[edit]

A typical function URL has the following format: [12]

https://<url-id>.lambda-url.<region>.on.aws

History[edit]

Before Function URLs, Lambda functions could be invoked only using AWS Lambda APIs or Amazon API Gateway[14]. Response streaming was also made possible with function URLs.[15]

Pricing[edit]

There are no extra charges included with invoking a Function URL, other than the duration and requests.[16] Function URLs are included in Lambda’s request and duration pricing.[17]

Caution with a public function URL[edit]

If a Lambda function URL is made publicly available with AuthType = NONE, it will warrant unauthenticated access to the Lambda function.[18] It can lead to a DDoS attack, which will incur costs to the AWS account which is hosting the Lambda function.

AWS Lambda Layers[edit]

AWS Lambda Layers allow developers to easily manage and share common components across multiple Lambda functions. It's designed to promote code reusability and simplify the deployment of libraries, custom runtimes, and other dependencies that Lambda functions might need. Lambda Layers can be particularly useful in microservices architectures, where multiple functions might share the same dependencies.[19] By using layers, one can ensure that all functions are using the same version of a library, making the application more consistent and easier to manage.

A Lambda Layer is a .zip file archive that allows to package and deploy common components separately from a Lambda function code.[20] A single AWS Lambda function can include up to five layers at a time. The layers are applied in a specified order, allowing later layers to override the content of earlier ones if there are conflicts.[21] This layering system can significantly reduce the size of Lambda deployment packages, as there is no need to include these common components in every function's deployment package.

Usage[edit]

Create a Lambda Layer: One first creates a layer by packaging libraries or other dependencies into a .zip file and then uploading it to Lambda.[22] The runtimes that the layer is compatible with can be specified when creating a layer.[23]

Add the Layer to Lambda Functions: When creating or updating a Lambda function, the layers to be included in the function can be specified. The Lambda service will then merge function code with the specified layers to create the execution environment.[24]

Versioning: Each time a new version of a layer is published, it receives a unique version number.[25] This is useful for managing updates to layers separately from function code. It also ensures that functions can continue using older versions of a layer if needed.

Sharing Layers: Layers can be shared across different AWS accounts or made public to the broader AWS community.[26] This is particularly useful for commonly used libraries or runtime extensions.

See also[edit]

References[edit]

  1. ^ Barr, Jeff (November 13, 2014). "AWS Lambda – Run Code in the Cloud". AWS News Blog. Retrieved August 29, 2022.
  2. ^ Munns, Chris (January 15, 2018). "Announcing Go Support for AWS Lambda". Amazon Web Services. Retrieved December 10, 2019.
  3. ^ Munns, Chris (November 29, 2018). "Announcing Ruby Support for AWS Lambda". Amazon Web Services. Retrieved December 10, 2019.
  4. ^ "AWS Lambda Now Supports Custom Runtimes and Enables Sharing Common Code Between Functions". Amazon Web Services. November 29, 2018. Retrieved December 10, 2019.
  5. ^ Wagner, Tim (April 15, 2015). "Running Arbitrary Executables in AWS Lambda". AWS Compute Blog. Retrieved December 10, 2019.
  6. ^ Bailly, Arnaud. "abailly/aws-lambda-haskell: Running Haskell code on AWS Lambda". GitHub. Retrieved December 10, 2019.
  7. ^ "New – Provisioned Concurrency for Lambda Functions". aws.amazon.com. 3 December 2019. Retrieved 2020-10-12.
  8. ^ "New – Provisioned Concurrency for Lambda Functions". Amazon Web Services. 2019-12-03. Retrieved 2020-02-03.
  9. ^ "AWS Lambda now supports up to 10 GB of memory and 6 vCPU cores for Lambda Functions". About AWS. December 1, 2021. Retrieved January 29, 2021.
  10. ^ Yun, Channy (24 March 2022). "AWS Lambda Now Supports Up to 10 GB Ephemeral Storage". AWS News Blog. Retrieved 1 April 2022.
  11. ^ "New for AWS Lambda – Container Image Support". Amazon Web Services. 2020-12-01. Retrieved 2021-06-03.
  12. ^ a b "Lambda function URLs - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-03-01.
  13. ^ "Document history - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-03-01.
  14. ^ "Invoking Lambda functions - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-03-01.
  15. ^ "Configuring a Lambda function to stream responses - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-03-01.
  16. ^ "Serverless Computing – AWS Lambda Pricing – Amazon Web Services". Amazon Web Services, Inc. Retrieved 2024-03-01.
  17. ^ "Announcing AWS Lambda Function URLs: Built-in HTTPS Endpoints for Single-Function Microservices | AWS News Blog". aws.amazon.com. 2022-04-06. Retrieved 2024-03-01.
  18. ^ "Security and auth model for Lambda function URLs - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-03-01.
  19. ^ "Building Serverless SaaS Microservices with AWS Lambda Layers | AWS Partner Network (APN) Blog". aws.amazon.com. 2022-08-11. Retrieved 2024-02-02.
  20. ^ "Working with Lambda layers - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-02-02.
  21. ^ "Adding layers to functions - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-02-02.
  22. ^ "Packaging your layer content - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-02-02.
  23. ^ "Creating and deleting layers in Lambda - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-02-02.
  24. ^ "Adding layers to functions - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-02-02.
  25. ^ "Working with Lambda layers - AWS Lambda". docs.aws.amazon.com. Retrieved 2024-02-02.
  26. ^ "Sharing Lambda Layers - AWS Serverless Application Repository". docs.aws.amazon.com. Retrieved 2024-02-02.

External links[edit]