interface LoadBalancerTargetOptions
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ECS.LoadBalancerTargetOptions |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#LoadBalancerTargetOptions |
Java | software.amazon.awscdk.services.ecs.LoadBalancerTargetOptions |
Python | aws_cdk.aws_ecs.LoadBalancerTargetOptions |
TypeScript (source) | aws-cdk-lib » aws_ecs » LoadBalancerTargetOptions |
Properties for defining an ECS target.
The port mapping for it must already have been created through addPortMapping().
Example
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const vpc: ec2.Vpc;
const service = new ecs.Ec2Service(this, 'Service', { cluster, taskDefinition });
const lb = new elb.LoadBalancer(this, 'LB', { vpc });
lb.addListener({ externalPort: 80 });
lb.addTarget(service.loadBalancerTarget({
containerName: 'MyContainer',
containerPort: 80,
}));
Properties
Name | Type | Description |
---|---|---|
container | string | The name of the container. |
container | number | The port number of the container. |
protocol? | Protocol | The protocol used for the port mapping. |
containerName
Type:
string
The name of the container.
containerPort?
Type:
number
(optional, default: Container port of the first added port mapping.)
The port number of the container.
Only applicable when using application/network load balancers.
protocol?
Type:
Protocol
(optional, default: Protocol.TCP)
The protocol used for the port mapping.
Only applicable when using application load balancers.