Interface ILoadBalancerTargetOptions
Properties for defining an ECS target.
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public interface ILoadBalancerTargetOptions
Syntax (vb)
Public Interface ILoadBalancerTargetOptions
Remarks
The port mapping for it must already have been created through addPortMapping().
ExampleMetadata: infused
Examples
Cluster cluster;
TaskDefinition taskDefinition;
Vpc vpc;
var service = new Ec2Service(this, "Service", new Ec2ServiceProps { Cluster = cluster, TaskDefinition = taskDefinition });
var lb = new LoadBalancer(this, "LB", new LoadBalancerProps { Vpc = vpc });
lb.AddListener(new LoadBalancerListener { ExternalPort = 80 });
lb.AddTarget(service.LoadBalancerTarget(new LoadBalancerTargetOptions {
ContainerName = "MyContainer",
ContainerPort = 80
}));
Synopsis
Properties
ContainerName | The name of the container. |
ContainerPort | The port number of the container. |
Protocol | The protocol used for the port mapping. |
Properties
ContainerName
The name of the container.
string ContainerName { get; }
Property Value
System.String
ContainerPort
The port number of the container.
virtual Nullable<double> ContainerPort { get; }
Property Value
System.Nullable<System.Double>
Remarks
Only applicable when using application/network load balancers.
Default: - Container port of the first added port mapping.
Protocol
The protocol used for the port mapping.
virtual Nullable<Protocol> Protocol { get; }
Property Value
System.Nullable<Protocol>
Remarks
Only applicable when using application load balancers.
Default: Protocol.TCP