Class NetworkMultipleTargetGroupsEc2Service

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.services.ecs.patterns.NetworkMultipleTargetGroupsServiceBase
software.amazon.awscdk.services.ecs.patterns.NetworkMultipleTargetGroupsEc2Service
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.755Z") @Stability(Stable) public class NetworkMultipleTargetGroupsEc2Service extends NetworkMultipleTargetGroupsServiceBase
An EC2 service running on an ECS cluster fronted by a network load balancer.

Example:

 // Two network load balancers, each with their own listener and target group.
 Cluster cluster;
 NetworkMultipleTargetGroupsEc2Service loadBalancedEc2Service = NetworkMultipleTargetGroupsEc2Service.Builder.create(this, "Service")
         .cluster(cluster)
         .memoryLimitMiB(256)
         .taskImageOptions(NetworkLoadBalancedTaskImageProps.builder()
                 .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
                 .build())
         .loadBalancers(List.of(NetworkLoadBalancerProps.builder()
                 .name("lb1")
                 .listeners(List.of(NetworkListenerProps.builder()
                         .name("listener1")
                         .build()))
                 .build(), NetworkLoadBalancerProps.builder()
                 .name("lb2")
                 .listeners(List.of(NetworkListenerProps.builder()
                         .name("listener2")
                         .build()))
                 .build()))
         .targetGroups(List.of(NetworkTargetProps.builder()
                 .containerPort(80)
                 .listener("listener1")
                 .build(), NetworkTargetProps.builder()
                 .containerPort(90)
                 .listener("listener2")
                 .build()))
         .build();
 
  • Constructor Details

    • NetworkMultipleTargetGroupsEc2Service

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

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

      @Stability(Stable) public NetworkMultipleTargetGroupsEc2Service(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable NetworkMultipleTargetGroupsEc2ServiceProps props)
      Constructs a new instance of the NetworkMultipleTargetGroupsEc2Service class.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • NetworkMultipleTargetGroupsEc2Service

      @Stability(Stable) public NetworkMultipleTargetGroupsEc2Service(@NotNull software.constructs.Construct scope, @NotNull String id)
      Constructs a new instance of the NetworkMultipleTargetGroupsEc2Service class.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • getService

      @Stability(Stable) @NotNull public Ec2Service getService()
      The EC2 service in this construct.
    • getTargetGroup

      @Stability(Stable) @NotNull public NetworkTargetGroup getTargetGroup()
      The default target group for the service.
    • getTaskDefinition

      @Stability(Stable) @NotNull public Ec2TaskDefinition getTaskDefinition()
      The EC2 Task Definition in this construct.