Lambda Function to schedule with Amazon EventBridge using Java.

First create a Lambda function:

Write a handler in Java for events:

  1. Create maven project using quickstart in any IDE (Eclipse,IntelliJ).
  2. Provide dependencies for aws-lambda-java-core, aws-lambda-java-events in POM.xml
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.amazonaws.services.lambda.runtime.events.ScheduledEvent;

public class ScheduleLambda
{
public void requestHandler(ScheduledEvent event, Context context) {
LambdaLogger logger = context.getLogger();
logger.log("Lambda Schedule occured! ");
logger.log("Lambda event occure "+event.getId().toString());
logger.log("Lambda event Detail "+event.getDetailType().toString());
logger.log("Lambda event "+event.toString());

}
}
mvn clean package

Schedule Lambda function using AWS EventBridge:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Swapnil Watkar

Swapnil Watkar

Hi ! I am a Software Engineer, experienced in Mobile and Web applications Also AWS Certified Solutions Architect — Associate