interface EcsTarget
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ECS.EcsTarget |
Java | software.amazon.awscdk.services.ecs.EcsTarget |
Python | aws_cdk.aws_ecs.EcsTarget |
TypeScript (source) | @aws-cdk/aws-ecs » EcsTarget |
Example
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const vpc: ec2.Vpc;
const service = new ecs.FargateService(this, 'Service', { cluster, taskDefinition });
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
Name | Type | Description |
---|---|---|
container | string | The name of the container. |
listener | Listener | Listener and properties for adding target group to the listener. |
new | string | ID for a target group to be created. |
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.
listener
Type:
Listener
Listener and properties for adding target group to the listener.
newTargetGroupId
Type:
string
ID for a target group to be created.
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.