Interface LoadBalancerTargetOptions

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
LoadBalancerTargetOptions.Jsii$Proxy

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-08-02T00:29:10.330Z") @Stability(Stable) public interface LoadBalancerTargetOptions extends software.amazon.jsii.JsiiSerializable
Properties for defining an ECS target.

The port mapping for it must already have been created through addPortMapping().

Example:

 Cluster cluster;
 TaskDefinition taskDefinition;
 Vpc vpc;
 Ec2Service service = Ec2Service.Builder.create(this, "Service").cluster(cluster).taskDefinition(taskDefinition).build();
 LoadBalancer lb = LoadBalancer.Builder.create(this, "LB").vpc(vpc).build();
 lb.addListener(LoadBalancerListener.builder().externalPort(80).build());
 lb.addTarget(service.loadBalancerTarget(LoadBalancerTargetOptions.builder()
         .containerName("MyContainer")
         .containerPort(80)
         .build()));
 
  • Method Details

    • getContainerName

      @Stability(Stable) @NotNull String getContainerName()
      The name of the container.
    • getContainerPort

      @Stability(Stable) @Nullable default Number getContainerPort()
      The port number of the container.

      Only applicable when using application/network load balancers.

      Default: - Container port of the first added port mapping.

    • getProtocol

      @Stability(Stable) @Nullable default Protocol getProtocol()
      The protocol used for the port mapping.

      Only applicable when using application load balancers.

      Default: Protocol.TCP

    • builder

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