Class EcsEc2LaunchTarget

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.stepfunctions.tasks.EcsEc2LaunchTarget
All Implemented Interfaces:
IEcsLaunchTarget, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:47.951Z") @Stability(Stable) public class EcsEc2LaunchTarget extends software.amazon.jsii.JsiiObject implements IEcsLaunchTarget
Configuration for running an ECS task on EC2.

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())
         .build();
 

See Also:
  • Constructor Details

    • EcsEc2LaunchTarget

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

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

      @Stability(Stable) public EcsEc2LaunchTarget(@Nullable EcsEc2LaunchTargetOptions options)
      Parameters:
      options -
    • EcsEc2LaunchTarget

      @Stability(Stable) public EcsEc2LaunchTarget()
  • Method Details