Interface Ec2ServiceProps
- All Superinterfaces:
BaseServiceOptions,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
Ec2ServiceProps.Jsii$Proxy
Example:
Vpc vpc;
// Create an ECS cluster
Cluster cluster = Cluster.Builder.create(this, "Cluster").vpc(vpc).build();
// Add capacity to it
cluster.addCapacity("DefaultAutoScalingGroupCapacity", AddCapacityOptions.builder()
.instanceType(new InstanceType("t2.xlarge"))
.desiredCapacity(3)
.build());
Ec2TaskDefinition taskDefinition = new Ec2TaskDefinition(this, "TaskDef");
taskDefinition.addContainer("DefaultContainer", ContainerDefinitionOptions.builder()
.image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
.memoryLimitMiB(512)
.build());
// Instantiate an Amazon ECS Service
Ec2Service ecsService = Ec2Service.Builder.create(this, "Service")
.cluster(cluster)
.taskDefinition(taskDefinition)
.minHealthyPercent(100)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forEc2ServicePropsstatic final classAn implementation forEc2ServiceProps -
Method Summary
Modifier and TypeMethodDescriptionstatic Ec2ServiceProps.Builderbuilder()default BooleanSpecifies whether the task's elastic network interface receives a public IP address.default AvailabilityZoneRebalancingWhether to use Availability Zone rebalancing for the service.default BooleanSpecifies whether the service will use the daemon scheduling strategy.default List<PlacementConstraint> The placement constraints to use for tasks in the service.default List<PlacementStrategy> The placement strategies to use for tasks in the service.default List<ISecurityGroup> The security groups to associate with the service.The task definition to use for tasks in the service.default SubnetSelectionThe subnets to associate with the service.Methods inherited from interface software.amazon.awscdk.services.ecs.BaseServiceOptions
getBakeTime, getCapacityProviderStrategies, getCircuitBreaker, getCloudMapOptions, getCluster, getDeploymentAlarms, getDeploymentController, getDeploymentStrategy, getDesiredCount, getEnableECSManagedTags, getEnableExecuteCommand, getHealthCheckGracePeriod, getLifecycleHooks, getMaxHealthyPercent, getMinHealthyPercent, getPropagateTags, getServiceConnectConfiguration, getServiceName, getTaskDefinitionRevision, getVolumeConfigurationsMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getTaskDefinition
The task definition to use for tasks in the service.[disable-awslint:ref-via-interface]
-
getAssignPublicIp
Specifies whether the task's elastic network interface receives a public IP address.If true, each task will receive a public IP address.
This property is only used for tasks that use the awsvpc network mode.
Default: false
-
getAvailabilityZoneRebalancing
Whether to use Availability Zone rebalancing for the service.If enabled:
maxHealthyPercentmust be greater than 100;daemonmust be false; if there are anyplacementStrategies, the first must be "spread across Availability Zones"; there must be noplacementConstraintsusingattribute:ecs.availability-zone, and the service must not be a target of a Classic Load Balancer.Default: AvailabilityZoneRebalancing.ENABLED
- See Also:
-
getDaemon
Specifies whether the service will use the daemon scheduling strategy.If true, the service scheduler deploys exactly one task on each container instance in your cluster.
When you are using this strategy, do not specify a desired number of tasks or any task placement strategies.
Default: false
-
getPlacementConstraints
The placement constraints to use for tasks in the service.For more information, see Amazon ECS Task Placement Constraints.
Default: - No constraints.
-
getPlacementStrategies
The placement strategies to use for tasks in the service.For more information, see Amazon ECS Task Placement Strategies.
Default: - No strategies.
-
getSecurityGroups
The security groups to associate with the service.If you do not specify a security group, a new security group is created.
This property is only used for tasks that use the awsvpc network mode.
Default: - A new security group is created.
-
getVpcSubnets
The subnets to associate with the service.This property is only used for tasks that use the awsvpc network mode.
Default: - Public subnets if `assignPublicIp` is set, otherwise the first available one of Private, Isolated, Public, in that order.
-
builder
- Returns:
- a
Ec2ServiceProps.BuilderofEc2ServiceProps
-