AWS Lambda is a Serverless Compute service, and it allows you to run code without provisioning or managing servers.

You can upload your code, and the service runs and scales your code, including setting up automatic triggers to call other AWS services.  Convenient, there is no new language to learn; you can run code in one of the (very popular) supported languages: Java, Go, PowerShell, Node.js, C#, Python, and Ruby. It also provides a Runtime API, allowing you to use any additional programming languages.

You can also try some pre-built Functions for commonly triggered events for even quicker set up.

You only pay for the compute time used by the functions, and there is no charge for when they aren’t running.  You are charged for every 100ms of code execution and the number of times the code is triggered.

You can create and test Lambda- based applications via Lambda Console, AWS CLI, or SAM CLI.

How Lambda Works

(How it Works from AWS)

Building Blocks of Lambda

  • Lambda Function: Custom code and any dependent libraries
  • Event Source: AWS Service that triggers the function
  • Downstream Resource: AWS Service that the function calls when triggered
  • Log Stream: Annotate function code with custom logging statements for further analysis of execution flow
    • Function invocations and metrics are automatically reported via CloudWatch
  • AWS SAM: Model to define serverless applications
    • Supported by CloudFormation and defines simplified syntax for serverless resources

References

2 thoughts on “AWS Lambda: Write Serverless Code

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.