The Serverless Framework now supports the recently released Lambda Event Destinations. Essentially, destinations are the ability for asynchronous Lambda invocations to have their execution results sent to other AWS services without needing to wait for the Lambda execution to finish. Previously, you would have to wait for a Lambda success or failure or need to leverage something like Step Functions.
We first wrote about Lambda Destinations when AWS announced support for them right before re:Invent 2019.
Essentially, destinations are the ability for asynchronous Lambda invocations to have their execution results sent to other AWS services without needing to wait for the Lambda execution to finish. Previously, you would have to wait for a Lambda success or failure or need to leverage something like Step Functions. Now, you can invoke functions asynchronously, and send the results of the invocations to different places depending on success or failure.
Today, we're excited to announce support for Lambda Destinations in the Serverless Framework! Make sure you've upgraded to
v1.66.0 or higher and let's look at how to add them.
You can watch the video below for an abbreviated version or work through the entire guide!
The first step to adding Lambda destinations is to decide what resources you would like to use as a destination on a success or failure. Currently, event destinations can be configured as another Lambda function, an SNS topic, SQS queue, or Amazon EventBridge. You can either create these resources in your
serverless.yml file or you can reference already-existing resource ARNs.
serverless.yml, you'll add a
destinations section to a function that you want to configure Event destinations with:
1 functions: 2 helloStarting: 3 handler: handler.starting 4 destinations: 5 onSuccess: someOtherFunction 6 onFailure: arn:of:some:existing:resource
Inside of the
destinations configuration you can add either an
onFailure or both. The value for those bits of configuration can either be another function defined in the same
serverless.yml file or an ARN of the destination resource.
Now let's look at a few configuration examples. You can find full-fledged example services of the below snippets on GitHub here.
What is AWS Lambda? Introduction to AWS Lambda on Amazon Web Services. Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 175 fully-featured services from data centers globally. Millions of customers—including the fastest-growing startups, largest enterprises, and leading government agencies—are using AWS to lower costs, become more agile, and innovate faster.
How to Build and Manage Infrastructure as Code with Amazon Web Services - AWS CloudFormation, AWS CloudWatch and Amazon EC2
An Introduction to Infrastructures for WEB projects in AWS - Let's review a particular project in detail and the cost of infrastructure maintenance. And so, we have an internal WEB application that consists of a static website on React, a backend on Go, and a database DynamoDB. All code is stored on Github and for CI/CD we use Github Actions. The infrastructure code is defined in Terraform.
Recently, AWS announced the beta release of Amazon Honeycode, a fully managed service allowing customers to build mobile and web applications without writing any code quickly.
Easily run Kubernetes-based applications on AWS by leveraging AWS Fargate and Amazon Elastic Kubernetes Service together. Learn more here.