Interface IEcsTarget
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IEcsTarget
Syntax (vb)
Public Interface IEcsTarget
Remarks
ExampleMetadata: infused
Examples
Cluster cluster;
TaskDefinition taskDefinition;
Vpc vpc;
var service = new FargateService(this, "Service", new FargateServiceProps { Cluster = cluster, TaskDefinition = taskDefinition, MinHealthyPercent = 100 });
var lb = new ApplicationLoadBalancer(this, "LB", new ApplicationLoadBalancerProps { Vpc = vpc, InternetFacing = true });
var listener = lb.AddListener("Listener", new BaseApplicationListenerProps { Port = 80 });
service.RegisterLoadBalancerTargets(new EcsTarget {
ContainerName = "web",
ContainerPort = 80,
NewTargetGroupId = "ECS",
Listener = ListenerConfig.ApplicationListener(listener, new AddApplicationTargetsProps {
Protocol = ApplicationProtocol.HTTPS
})
});
Synopsis
Properties
| ContainerName | The name of the container. |
| ContainerPort | The port number of the container. |
| Listener | Listener and properties for adding target group to the listener. |
| NewTargetGroupId | ID for a target group to be created. |
| Protocol | The protocol used for the port mapping. |
Properties
ContainerName
The name of the container.
string ContainerName { get; }
Property Value
Remarks
ExampleMetadata: infused
ContainerPort
The port number of the container.
double? ContainerPort { get; }
Property Value
Remarks
Only applicable when using application/network load balancers.
Default: - Container port of the first added port mapping.
Listener
Listener and properties for adding target group to the listener.
ListenerConfig Listener { get; }
Property Value
Remarks
ExampleMetadata: infused
NewTargetGroupId
ID for a target group to be created.
string NewTargetGroupId { get; }
Property Value
Remarks
ExampleMetadata: infused
Protocol
The protocol used for the port mapping.
Protocol? Protocol { get; }
Property Value
Remarks
Only applicable when using application load balancers.
Default: Protocol.TCP