aws-cdk-lib.aws_ecs.ServiceConnectProps

interface ServiceConnectProps

LanguageType name
.NETAmazon.CDK.AWS.ECS.ServiceConnectProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecs#ServiceConnectProps
Javasoftware.amazon.awscdk.services.ecs.ServiceConnectProps
Pythonaws_cdk.aws_ecs.ServiceConnectProps
TypeScript (source)aws-cdk-lib » aws_ecs » ServiceConnectProps

Interface for Service Connect configuration.

Example

declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const containerOptions: ecs.ContainerDefinitionOptions;

const container = taskDefinition.addContainer('MyContainer', containerOptions);

container.addPortMappings({
  name: 'api',
  containerPort: 8080,
});

cluster.addDefaultCloudMapNamespace({
  name: 'local',
});

const service = new ecs.FargateService(this, 'Service', {
  cluster,
  taskDefinition,
  serviceConnectConfiguration: {
    services: [
      {
        portMappingName: 'api',
        dnsName: 'http-api',
        port: 80,
      },
    ],
  },
});

Properties

NameTypeDescription
logDriver?LogDriverThe log driver configuration to use for the Service Connect agent logs.
namespace?stringThe cloudmap namespace to register this service into.
services?ServiceConnectService[]The list of Services, including a port mapping, terse client alias, and optional intermediate DNS name.

logDriver?

Type: LogDriver (optional, default: none)

The log driver configuration to use for the Service Connect agent logs.


namespace?

Type: string (optional, default: the cloudmap namespace specified on the cluster.)

The cloudmap namespace to register this service into.


services?

Type: ServiceConnectService[] (optional, default: none)

The list of Services, including a port mapping, terse client alias, and optional intermediate DNS name.

This property may be left blank if the current ECS service does not need to advertise any ports via Service Connect.