# CloudMapNamespaceOptions

The options for creating an AWS Cloud Map namespace.

Extends: CloudMapNamespaceOptions
Extends: CloudMapNamespaceOptionsBase

- Source: [`aws-ecs/lib/cluster.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts#L1253)
- Type last changed: v2.263.0 · 31 Jul 2026

## Example

```ts
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,
  minHealthyPercent: 100,
  serviceConnectConfiguration: {
    services: [
      {
        portMappingName: 'api',
        dnsName: 'http-api',
        port: 80,
      },
    ],
  },
});
```

## Properties

- `name`: string (required) — The name of the namespace, such as example.com.

- `type`: [NamespaceType](/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery.NamespaceType.html) = PrivateDns — The type of CloudMap Namespace to create.

- `useForServiceConnect`: boolean = false — This property specifies whether to set the provided namespace as the service connect default in the cluster properties.

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) — The VPC to associate the namespace with.

  **Default:** VPC of the cluster for Private DNS Namespace, otherwise none

  This property is required for private DNS namespaces.
