EventBridgeSchedulerTargetProps

class aws_cdk.aws_stepfunctions_tasks.EventBridgeSchedulerTargetProps(*, arn, role, dead_letter_queue=None, input=None, retry_policy=None)

Bases: object

Properties for EventBridgeSchedulerTarget.

Parameters:
  • arn (str) – The Amazon Resource Name (ARN) of the target.

  • role (IRole) – The IAM role that EventBridge Scheduler will use for this target when the schedule is invoked.

  • dead_letter_queue (Optional[IQueue]) – Dead letter queue for failed events. Default: - No dead letter queue

  • input (Optional[str]) – The input to the target. Default: - EventBridge Scheduler delivers a default notification to the target

  • retry_policy (Union[RetryPolicy, Dict[str, Any], None]) – The retry policy settings. Default: - Do not retry

See:

https://docs.aws.amazon.com/scheduler/latest/APIReference/API_Target.html#API_Target_Contents

ExampleMetadata:

infused

Example:

import aws_cdk.aws_scheduler as scheduler
import aws_cdk.aws_kms as kms

# key: kms.Key
# schedule_group: scheduler.CfnScheduleGroup
# target_queue: sqs.Queue
# dead_letter_queue: sqs.Queue


scheduler_role = iam.Role(self, "SchedulerRole",
    assumed_by=iam.ServicePrincipal("scheduler.amazonaws.com")
)
# To send the message to the queue
# This policy changes depending on the type of target.
scheduler_role.add_to_principal_policy(iam.PolicyStatement(
    actions=["sqs:SendMessage"],
    resources=[target_queue.queue_arn]
))

create_schedule_task1 = tasks.EventBridgeSchedulerCreateScheduleTask(self, "createSchedule",
    schedule_name="TestSchedule",
    action_after_completion=tasks.ActionAfterCompletion.NONE,
    client_token="testToken",
    description="TestDescription",
    start_date=Date(),
    end_date=Date(Date().get_time() + 1000 * 60 * 60),
    flexible_time_window=Duration.minutes(5),
    group_name=schedule_group.ref,
    kms_key=key,
    schedule=tasks.Schedule.rate(Duration.minutes(5)),
    timezone="UTC",
    enabled=True,
    target=tasks.EventBridgeSchedulerTarget(
        arn=target_queue.queue_arn,
        role=scheduler_role,
        retry_policy=tasks.RetryPolicy(
            maximum_retry_attempts=2,
            maximum_event_age=Duration.minutes(5)
        ),
        dead_letter_queue=dead_letter_queue
    )
)

Attributes

arn

The Amazon Resource Name (ARN) of the target.

See:

https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets.html

dead_letter_queue

Dead letter queue for failed events.

Default:
  • No dead letter queue

input

The input to the target.

Default:
  • EventBridge Scheduler delivers a default notification to the target

retry_policy

The retry policy settings.

Default:
  • Do not retry

role

The IAM role that EventBridge Scheduler will use for this target when the schedule is invoked.