Skip to content
v2.275.0

LambdaInvoke Class ​

Use an AWS Lambda function as a target for AWS EventBridge Scheduler.

Example ​

ts
declare const fn: lambda.Function;

const target = new targets.LambdaInvoke(fn, {
    input: ScheduleTargetInput.fromObject({
        "payload": "useful",
    }),
});

const schedule = new Schedule(this, 'Schedule', {
    schedule: ScheduleExpression.rate(Duration.minutes(10)),
    target,
    description: 'This is a test schedule that invokes a lambda function every 10 minutes.',
});
python
# fn: lambda.Function


target = targets.LambdaInvoke(fn,
    input=ScheduleTargetInput.from_object({
        "payload": "useful"
    })
)

schedule = Schedule(self, "Schedule",
    schedule=ScheduleExpression.rate(Duration.minutes(10)),
    target=target,
    description="This is a test schedule that invokes a lambda function every 10 minutes."
)
java
Function fn;


LambdaInvoke target = LambdaInvoke.Builder.create(fn)
        .input(ScheduleTargetInput.fromObject(Map.of(
                "payload", "useful")))
        .build();

Schedule schedule = Schedule.Builder.create(this, "Schedule")
        .schedule(ScheduleExpression.rate(Duration.minutes(10)))
        .target(target)
        .description("This is a test schedule that invokes a lambda function every 10 minutes.")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Function fn;


var target = new LambdaInvoke(fn, new ScheduleTargetBaseProps {
    Input = ScheduleTargetInput.FromObject(new Dictionary<string, string> {
        { "payload", "useful" }
    })
});

var schedule = new Schedule(this, "Schedule", new ScheduleProps {
    Schedule = ScheduleExpression.Rate(Duration.Minutes(10)),
    Target = target,
    Description = "This is a test schedule that invokes a lambda function every 10 minutes."
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var fn Function


target := targets.NewLambdaInvoke(fn, &ScheduleTargetBaseProps{
	Input: awscdk.ScheduleTargetInput_FromObject(map[string]*string{
		"payload": jsii.String("useful"),
	}),
})

schedule := awscdk.NewSchedule(this, jsii.String("Schedule"), &ScheduleProps{
	Schedule: awscdk.ScheduleExpression_Rate(awscdk.Duration_Minutes(jsii.Number(10))),
	Target: Target,
	Description: jsii.String("This is a test schedule that invokes a lambda function every 10 minutes."),
})

Initializer ​

ts
new LambdaInvoke(func: IFunction, props?: ScheduleTargetBaseProps)
python
LambdaInvoke(func: IFunction, props: typing.Optional[ScheduleTargetBaseProps] = None)
java
new LambdaInvoke(IFunction func, ScheduleTargetBaseProps props)
csharp
new LambdaInvoke(IFunction func, ScheduleTargetBaseProps? props = null)
go
NewLambdaInvoke(Func IFunction, Props ScheduleTargetBaseProps)

Methods ​

bind(schedule: ISchedule): ScheduleTargetConfigdef bind(self, schedule: ISchedule) -> ScheduleTargetConfigpublic ScheduleTargetConfig bind(ISchedule schedule)public ScheduleTargetConfig Bind(ISchedule schedule)func Bind(Schedule ISchedule) ScheduleTargetConfig#
Create a return a Schedule Target Configuration for the given schedule.
returns

Returns: a Schedule Target Configuration