Class ScheduledEc2Task

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IConstruct, IDependable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:48.800Z") @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.