Class ScheduledEc2Task

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.ecs.patterns.ScheduledTaskBase
software.amazon.awscdk.services.ecs.patterns.ScheduledEc2Task
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:01.286Z") @Stability(Stable) public class ScheduledEc2Task extends ScheduledTaskBase
A scheduled EC2 task that will be initiated off of CloudWatch Events.

Example:

 // Instantiate an Amazon EC2 Task to run at a scheduled interval
 Cluster cluster;
 ScheduledEc2Task ecsScheduledTask = ScheduledEc2Task.Builder.create(this, "ScheduledTask")
         .cluster(cluster)
         .scheduledEc2TaskImageOptions(ScheduledEc2TaskImageOptions.builder()
                 .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
                 .memoryLimitMiB(256)
                 .environment(Map.of("name", "TRIGGER", "value", "CloudWatch Events"))
                 .build())
         .schedule(Schedule.expression("rate(1 minute)"))
         .enabled(true)
         .ruleName("sample-scheduled-task-rule")
         .build();
 
  • Constructor Details

    • ScheduledEc2Task

      protected ScheduledEc2Task(software.amazon.jsii.JsiiObjectRef objRef)
    • ScheduledEc2Task

      protected ScheduledEc2Task(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • ScheduledEc2Task

      @Stability(Stable) public ScheduledEc2Task(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ScheduledEc2TaskProps props)
      Constructs a new instance of the ScheduledEc2Task class.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • getTask

      @Stability(Stable) @NotNull public EcsTask getTask()
      The ECS task in this construct.
    • getTaskDefinition

      @Stability(Stable) @NotNull public Ec2TaskDefinition getTaskDefinition()
      The EC2 task definition in this construct.