aws-cdk-lib.aws_ecs.CloudMapNamespaceOptions

interface CloudMapNamespaceOptions

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

The options for creating an AWS Cloud Map namespace.

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
namestringThe name of the namespace, such as example.com.
type?NamespaceTypeThe type of CloudMap Namespace to create.
useForServiceConnect?booleanThis property specifies whether to set the provided namespace as the service connect default in the cluster properties.
vpc?IVpcThe VPC to associate the namespace with.

name

Type: string

The name of the namespace, such as example.com.


type?

Type: NamespaceType (optional, default: PrivateDns)

The type of CloudMap Namespace to create.


useForServiceConnect?

Type: boolean (optional, default: false)

This property specifies whether to set the provided namespace as the service connect default in the cluster properties.


vpc?

Type: IVpc (optional, default: VPC of the cluster for Private DNS Namespace, otherwise none)

The VPC to associate the namespace with.

This property is required for private DNS namespaces.