AWS Lambda Destination Support

AWS Lambda Destination Support

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.

What Are Lambda Destinations?

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!

Adding Lambda Destinations

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.

Inside of 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 onSuccess or 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.

aws aws lambda amazon web services

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

What is AWS Lambda? Introduction to AWS Lambda on Amazon Web Services

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.

Infrastructure as Code on Amazon Web Services (AWS)

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

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.

AWS Launches a No-Code Mobile and Web App Builder in Beta: Amazon Honeycode

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.

AWS Fargate for Amazon Elastic Kubernetes Service | Caylent

Easily run Kubernetes-based applications on AWS by leveraging AWS Fargate and Amazon Elastic Kubernetes Service together. Learn more here.