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 });
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
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.
Listener
Listener and properties for adding target group to the listener.
ListenerConfig Listener { get; }
Property Value
NewTargetGroupId
ID for a target group to be created.
string NewTargetGroupId { get; }
Property Value
System.String
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