Jump to content

AWS Lambda

From Wikipedia, the free encyclopedia
AWS Lambda
Developer(s)Amazon.com
Initial releaseNovember 13, 2014; 10 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 Function as a Service (FaaS) 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]

Specification

[edit]

Each AWS Lambda instance is a container created from Amazon Linux AMIs (a Linux distribution related to RHEL) and a configurable execution time. 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.

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."[5] The Lambda team described Provisioned Concurrency as "ideal for implementing interactive services, such as web and mobile backends, latency-sensitive microservices, or synchronous APIs."[6]

The Lambda Function URL gives Lambda a unique and permanent URL which can be accessed by authenticated and non-authenticated users alike.[7]

Lambda layer

[edit]

AWS Lambda layer is a ZIP archive containing libraries, frameworks or custom code that can be added to AWS Lambda functions. [8] As of December 2024, AWS Lambda layers have significant limitations: [9][10]

  • No semantic versioning support.
  • Incompatibility with major security scanning tools.
  • Contribution to Lambda's 250MB size limit.
  • Impeded local testing.
  • No tree-shaking optimizations.

AWS Serverless Hero Yan Cui recommends alternative code-sharing strategies using package managers (e.g., NPM) due to these constraints. [11]

Best practices

[edit]

Following DevSecOps practices can help end-users to use and secure Lambda-based applications more effectively. [12] In Lambda-based applications, the line between the infrastructure and business logic is blurred and the apps are usually spread across various services. According to Yan Cui, to get the most value from testing efforts, Lambda-based applications should be tested mainly for their integrations, and unit tests should be used only if there is a complex business logic. Also, to make debugging and implementation of Lambda-based easier, developers should use orchestration within the bounded context of a microservice, and should use choreography between the bounded-contexts.[11]

Portability

[edit]

Migration from AWS Lambda to other AWS compute services (e.g., Amazon ECS) can be challenging due to tight integrations with the service provider, a phenomenon known as service lock-in. Tools like AWS Lambda Web Adapter can facilitate portability by enabling developers to build web applications using familiar frameworks, employing the Lambdalith or Lambda monolith pattern. [13][14] However, this approach has some limitations:

  • Coarser-grained alerting and access controls compared to single-purpose functions.
  • Potential cold start penalties, particularly with large web framework dependencies.
  • May require refactoring to accommodate integration differences.
  • May not work as well with non-HTTP APIs.

Hexagonal architecture can facilitate workload portability. It can help with both HTTP and non-HTTP APIs. [11]

Testing

[edit]

Testing integrations between services is crucial, particularly for serverless applications like AWS Lambda, due to their distributed and fragmented architecture. Simulator tools like LocalStack can facilitate testing but may yield false positives because they may diverge from actual AWS services. [15]

To address this limitation, Yan Cui introduced "remocal testing," enabling local execution of application code while interacting with genuine AWS services. This approach allows real-time debugging and rapid code modifications without deployment. However, it necessitates provisioning and subsequent decommissioning of AWS resources, requiring meticulous planning. [11]

Helper Tools

[edit]

Lambda Live Debugger is an open-source tools that helps you debug your AWS Lambda functions from your computer, while they are deployed in the cloud. It supports AWS CDK v2, Serverless Framework v3, AWS Serverless Application Model (SAM) and Terraform. [16]

Security

[edit]

In April 2022, researchers found cryptomining malware targeting AWS Lambda named "Denonia".[17][18][19]

See also

[edit]

References

[edit]
  1. ^ Serverless Development on AWS Building Enterprise-Scale Serverless Solutions. O'Reilly Media. ISBN 9781098141899.
  2. ^ Munns, Chris (January 15, 2018). "Announcing Go Support for AWS Lambda". Amazon Web Services. Archived from the original on October 15, 2019. Retrieved December 10, 2019.
  3. ^ Munns, Chris (November 29, 2018). "Announcing Ruby Support for AWS Lambda". Amazon Web Services. Archived from the original on October 15, 2019. Retrieved December 10, 2019.
  4. ^ "AWS Lambda Now Supports Custom Runtimes and Enables Sharing Common Code Between Functions". Amazon Web Services. November 29, 2018. Archived from the original on October 17, 2019. Retrieved December 10, 2019.
  5. ^ "New – Provisioned Concurrency for Lambda Functions". aws.amazon.com. 3 December 2019. Archived from the original on 2020-10-18. Retrieved 2020-10-12.
  6. ^ "New – Provisioned Concurrency for Lambda Functions". Amazon Web Services. 2019-12-03. Archived from the original on 2020-02-03. Retrieved 2020-02-03.
  7. ^ "Lambda function URLs - AWS Lambda". docs.aws.amazon.com. Archived from the original on 2024-03-01. Retrieved 2024-03-01.
  8. ^ "Managing Lambda dependencies with layers". Archived from the original on 2024-02-04. Retrieved 2024-02-02.
  9. ^ Sbarski, Peter. Serverless Architectures on AWS: With examples using AWS Lambda. ISBN 9781638351146.
  10. ^ Data Engineering with AWS: Learn how to design and build cloud-based data transformation pipelines using AWS. ISBN 9781800569041.
  11. ^ a b c d Cui, Yan (2020). Serverless Architectures on AWS (2nd ed.). Manning. ISBN 978-1617295423.
  12. ^ Katzer, Jason (2020). Learning Serverless: Design, Develop, and Deploy with Confidence. O'Reilly Media. ISBN 978-1492057017.
  13. ^ "AWS Lambda Web Adapter". Archived from the original on 2024-11-28. Retrieved 2024-11-29.
  14. ^ "The Lambda monolith". Archived from the original on 2024-11-26. Retrieved 2024-11-29.
  15. ^ Stojanovic, Slobodan. Serverless Applications with Node.js Using AWS Lambda and Claudia.js. Manning. ISBN 9781638356172.
  16. ^ "Lambda Live Debugger". GitHub. Archived from the original on 2024-10-07. Retrieved 2024-10-04.
  17. ^ "Archived copy". Archived from the original on 2024-11-15. Retrieved 2024-11-04.{{cite web}}: CS1 maint: archived copy as title (link)
  18. ^ "Archived copy". Archived from the original on 2024-03-15. Retrieved 2024-11-04.{{cite web}}: CS1 maint: archived copy as title (link)
  19. ^ "Archived copy". Archived from the original on 2024-04-05. Retrieved 2024-11-04.{{cite web}}: CS1 maint: archived copy as title (link)
[edit]