Creating an AWS Lambda function
In this section, we will create a Lambda function to process Kinesis events.
Note
For a more detailed coverage of this topic, refer to the blog by Sunil Dalal at: https://www.polyglotdeveloper.com/lambda/2017-07-05-Using-Lambda-as-Kinesis-events-processor/. Refer to Creating a .jar Deployment Package Using Maven and Eclipse IDE (Java) for more details: https://docs.aws.amazon.com/lambda/latest/dg/java-create-jar-pkg-maven-and-eclipse.html.
- Create a maven project. Create an
example
package and key in the following Java code in a class (ProcessKinesisEvents
):
package example; import java.io.IOException; import com.amazonaws.services.lambda.runtime.events.KinesisEvent; import com.amazonaws.services.lambda.runtime.events.KinesisEvent.KinesisEventRecord; publicclass ProcessKinesisEvents { public String handleRequest(KinesisEvent event) throws IOException { System.out.println("Record Size - " + event.getRecords().size()); for(KinesisEventRecord rec : event...