EcsTarget Struct
Example
ts
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const vpc: ec2.Vpc;
const service = new ecs.FargateService(this, 'Service', { cluster, taskDefinition, minHealthyPercent: 100 });
const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { vpc, internetFacing: true });
const listener = lb.addListener('Listener', { port: 80 });
service.registerLoadBalancerTargets(
{
containerName: 'web',
containerPort: 80,
newTargetGroupId: 'ECS',
listener: ecs.ListenerConfig.applicationListener(listener, {
protocol: elbv2.ApplicationProtocol.HTTPS
}),
},
);
Properties
containerNamestringcontainer_namestrcontainerNameStringContainerNamestringContainerName*stringrequired#The name of the container.
containerPortnumbercontainer_portint | floatcontainerPortNumberContainerPortdoubleContainerPort*float64= Container port of the first adde…#The port number of the container.
Only applicable when using application/network load balancers.
default
Default: Container port of the first added port mapping.
listenerListenerConfiglistenerListenerConfiglistenerListenerConfigListenerListenerConfigListenerListenerConfigrequired#Listener and properties for adding target group to the listener.
newTargetGroupIdstringnew_target_group_idstrnewTargetGroupIdStringNewTargetGroupIdstringNewTargetGroupId*stringrequired#ID for a target group to be created.