Class EcsTarget
Inheritance
System.Object
EcsTarget
Implements
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public class EcsTarget : Object, IEcsTarget
Syntax (vb)
Public Class EcsTarget
Inherits Object
Implements 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
Constructors
EcsTarget() |
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. |
Constructors
EcsTarget()
public EcsTarget()
Properties
ContainerName
The name of the container.
public string ContainerName { get; set; }
Property Value
System.String
ContainerPort
The port number of the container.
public Nullable<double> ContainerPort { get; set; }
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.
public ListenerConfig Listener { get; set; }
Property Value
NewTargetGroupId
ID for a target group to be created.
public string NewTargetGroupId { get; set; }
Property Value
System.String
Protocol
The protocol used for the port mapping.
public Nullable<Protocol> Protocol { get; set; }
Property Value
System.Nullable<Protocol>
Remarks
Only applicable when using application load balancers.
Default: Protocol.TCP