Interface EcsEc2LaunchTargetOptions
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
EcsEc2LaunchTargetOptions.Jsii$Proxy
@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)",
date="2024-10-25T14:21:24.490Z")
@Stability(Stable)
public interface EcsEc2LaunchTargetOptions
extends software.amazon.jsii.JsiiSerializable
Options to run an ECS task on EC2 in StepFunctions and ECS.
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();
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
A builder forEcsEc2LaunchTargetOptions
static final class
An implementation forEcsEc2LaunchTargetOptions
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
default List<PlacementConstraint>
Placement constraints.default List<PlacementStrategy>
Placement strategies.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getPlacementConstraints
Placement constraints.Default: - None
-
getPlacementStrategies
Placement strategies.Default: - None
-
builder
- Returns:
- a
EcsEc2LaunchTargetOptions.Builder
ofEcsEc2LaunchTargetOptions
-