Interface EcsRunTaskProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable, TaskStateBaseProps
All Known Implementing Classes:
EcsRunTaskProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.95.0 (build f1ff514)", date="2024-03-26T18:09:30.744Z") @Stability(Stable) public interface EcsRunTaskProps extends software.amazon.jsii.JsiiSerializable, TaskStateBaseProps
Properties for ECS Tasks.

Example:

 IVpc vpc = Vpc.fromLookup(this, "Vpc", VpcLookupOptions.builder()
         .isDefault(true)
         .build());
 Cluster cluster = Cluster.Builder.create(this, "Ec2Cluster").vpc(vpc).build();
 cluster.addCapacity("DefaultAutoScalingGroup", AddCapacityOptions.builder()
         .instanceType(new InstanceType("t2.micro"))
         .vpcSubnets(SubnetSelection.builder().subnetType(SubnetType.PUBLIC).build())
         .build());
 TaskDefinition taskDefinition = TaskDefinition.Builder.create(this, "TD")
         .compatibility(Compatibility.EC2)
         .build();
 taskDefinition.addContainer("TheContainer", ContainerDefinitionOptions.builder()
         .image(ContainerImage.fromRegistry("foo/bar"))
         .memoryLimitMiB(256)
         .build());
 EcsRunTask runTask = EcsRunTask.Builder.create(this, "Run")
         .integrationPattern(IntegrationPattern.RUN_JOB)
         .cluster(cluster)
         .taskDefinition(taskDefinition)
         .launchTarget(EcsEc2LaunchTarget.Builder.create()
                 .placementStrategies(List.of(PlacementStrategy.spreadAcrossInstances(), PlacementStrategy.packedByCpu(), PlacementStrategy.randomly()))
                 .placementConstraints(List.of(PlacementConstraint.memberOf("blieptuut")))
                 .build())
         .propagatedTagSource(PropagatedTagSource.TASK_DEFINITION)
         .build();
 
  • Method Details

    • getCluster

      @Stability(Stable) @NotNull ICluster getCluster()
      The ECS cluster to run the task on.
    • getLaunchTarget

      @Stability(Stable) @NotNull IEcsLaunchTarget getLaunchTarget()
      An Amazon ECS launch type determines the type of infrastructure on which your tasks and services are hosted.

      See Also:
    • getTaskDefinition

      @Stability(Stable) @NotNull TaskDefinition getTaskDefinition()
      [disable-awslint:ref-via-interface] Task Definition used for running tasks in the service.

      Note: this must be TaskDefinition, and not ITaskDefinition, as it requires properties that are not known for imported task definitions If you want to run a RunTask with an imported task definition, consider using CustomState

    • getAssignPublicIp

      @Stability(Stable) @Nullable default Boolean getAssignPublicIp()
      Assign public IP addresses to each task.

      Default: false

    • getContainerOverrides

      @Stability(Stable) @Nullable default List<ContainerOverride> getContainerOverrides()
      Container setting overrides.

      Specify the container to use and the overrides to apply.

      Default: - No overrides

    • getPropagatedTagSource

      @Stability(Stable) @Nullable default PropagatedTagSource getPropagatedTagSource()
      Specifies whether to propagate the tags from the task definition to the task.

      An error will be received if you specify the SERVICE option when running a task.

      Default: - No tags are propagated.

      See Also:
    • getRevisionNumber

      @Stability(Stable) @Nullable default Number getRevisionNumber()
      The revision number of ECS task definiton family.

      Default: - '$latest'

    • getSecurityGroups

      @Stability(Stable) @Nullable default List<ISecurityGroup> getSecurityGroups()
      Existing security groups to use for the tasks.

      Default: - A new security group is created

    • getSubnets

      @Stability(Stable) @Nullable default SubnetSelection getSubnets()
      Subnets to place the task's ENIs.

      Default: - Public subnets if assignPublicIp is set. Private subnets otherwise.

    • builder

      @Stability(Stable) static EcsRunTaskProps.Builder builder()
      Returns:
      a EcsRunTaskProps.Builder of EcsRunTaskProps