In this video, learn how to integrate AWS Lambda and Kinesis streams.
- [Instructor] I introduced Kinesis already, but it's important to understand how it integrates with AWS Lambda. We have a Lambda that sends a message to a stream. So now what? For the next step we need to do something with that message. What we want is that when there is a message in the stream, it triggers an AWS Lambda. In this video we will learn about integration between AWS Lambda and Kinesis data streams. We already know that Lambda receives three parameters when something invokes it, the context, the event, and the callback. The event option is where the service invoking Lambda will send the information about itself. For example, if the service invoking Lambda is an API gateway, in the event option we will see information about HTTP headers, path, and methods. Let's analyze an event object that Kinesis data stream sends to Lambda. Here we can see an example of that kind of event option. Let's go line by line and understand what is going on. We can see that the first element is something called Records. It's an array. So Kinesis can send multiple records at one time to Lambda. Inside each record we have an event ID. This is a unique identifier for each message in the stream. Then we have an option called Kinesis. There we can see some Kinesis properties, like the partition key, the data, and the sequence number. The data is encoded in base 64, so remember to decode it to read what is inside. The sequence number can be useful in case we need to order the messages. At the end of the event message we can see the event name and it is defined as a Kinesis record. We can have records of other services, like Dynamo DB streams. We can also see the ARN, Amazon Resource Name, of the Kinesis stream that generates this message.
- Backend as a service (BaaS)
- Function as a service (FaaS)
- Why infrastructure as code is so important
- Creating an order
- Setting up DynamoDB
- Saving into a DynamoDB table
- Using AWS SDK
- Sending a message to the stream
- Deploying and testing an application
- Cleaning up an AWS environment