Skip to content
v2.278.0

ExistingCloudMapNamespaceOptions Struct ​

The options for using an existing AWS Cloud Map namespace as the default namespace of a cluster.

Example ​

ts
declare const vpc: ec2.Vpc;

// Create or reference an existing namespace
const existingNamespace = new cloudmap.PrivateDnsNamespace(this, 'Namespace', {
  name: 'example.local',
  vpc,
});

const cluster = new ecs.Cluster(this, 'Cluster', { vpc });

// Use the existing namespace as the default
cluster.addExistingDefaultCloudMapNamespace({
  namespace: existingNamespace,
  useForServiceConnect: true,
});
python
# vpc: ec2.Vpc


# Create or reference an existing namespace
existing_namespace = cloudmap.PrivateDnsNamespace(self, "Namespace",
    name="example.local",
    vpc=vpc
)

cluster = ecs.Cluster(self, "Cluster", vpc=vpc)

# Use the existing namespace as the default
cluster.add_existing_default_cloud_map_namespace(
    namespace=existing_namespace,
    use_for_service_connect=True
)
java
Vpc vpc;


// Create or reference an existing namespace
PrivateDnsNamespace existingNamespace = PrivateDnsNamespace.Builder.create(this, "Namespace")
        .name("example.local")
        .vpc(vpc)
        .build();

Cluster cluster = Cluster.Builder.create(this, "Cluster").vpc(vpc).build();

// Use the existing namespace as the default
cluster.addExistingDefaultCloudMapNamespace(ExistingCloudMapNamespaceOptions.builder()
        .namespace(existingNamespace)
        .useForServiceConnect(true)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;


// Create or reference an existing namespace
var existingNamespace = new PrivateDnsNamespace(this, "Namespace", new PrivateDnsNamespaceProps {
    Name = "example.local",
    Vpc = vpc
});

var cluster = new Cluster(this, "Cluster", new ClusterProps { Vpc = vpc });

// Use the existing namespace as the default
cluster.AddExistingDefaultCloudMapNamespace(new ExistingCloudMapNamespaceOptions {
    Namespace = existingNamespace,
    UseForServiceConnect = true
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc


// Create or reference an existing namespace
existingNamespace := cloudmap.NewPrivateDnsNamespace(this, jsii.String("Namespace"), &PrivateDnsNamespaceProps{
	Name: jsii.String("example.local"),
	Vpc: Vpc,
})

cluster := ecs.NewCluster(this, jsii.String("Cluster"), &ClusterProps{
	Vpc: Vpc,
})

// Use the existing namespace as the default
cluster.AddExistingDefaultCloudMapNamespace(&ExistingCloudMapNamespaceOptions{
	Namespace: existingNamespace,
	UseForServiceConnect: jsii.Boolean(true),
})

Properties ​

namespaceINamespacenamespaceINamespacenamespaceINamespaceNamespaceINamespaceNamespaceINamespace required #
The existing Cloud Map namespace to use as the cluster's default namespace.

The full INamespace is required (rather than a ref) because the cluster needs the namespace name, ARN and type to wire up Service Discovery and Service Connect.

[disable-awslint:prefer-ref-interface]

useForServiceConnectoptionalbooleanuse_for_service_connectoptionalbooluseForServiceConnectoptionalBooleanUseForServiceConnectoptionalboolUseForServiceConnectoptional*bool = false #
This property specifies whether to set the provided namespace as the service connect default in the cluster properties.