Skip to content
v2.278.0

PrivateDnsNamespaceAttributes Struct ​

Example ​

ts
declare const vpc: ec2.Vpc;

const importedNamespace = cloudmap.PrivateDnsNamespace.fromPrivateDnsNamespaceAttributes(
  this, 'ImportedNamespace', {
    namespaceId: 'ns-xxxxxxxxxxxxx',
    namespaceArn: 'arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-xxxxxxxxxxxxx',
    namespaceName: 'example.local',
  }
);

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

cluster.addExistingDefaultCloudMapNamespace({
  namespace: importedNamespace,
});
python
# vpc: ec2.Vpc


imported_namespace = cloudmap.PrivateDnsNamespace.from_private_dns_namespace_attributes(self, "ImportedNamespace",
    namespace_id="ns-xxxxxxxxxxxxx",
    namespace_arn="arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-xxxxxxxxxxxxx",
    namespace_name="example.local"
)

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

cluster.add_existing_default_cloud_map_namespace(
    namespace=imported_namespace
)
java
Vpc vpc;


IPrivateDnsNamespace importedNamespace = PrivateDnsNamespace.fromPrivateDnsNamespaceAttributes(this, "ImportedNamespace", PrivateDnsNamespaceAttributes.builder()
        .namespaceId("ns-xxxxxxxxxxxxx")
        .namespaceArn("arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-xxxxxxxxxxxxx")
        .namespaceName("example.local")
        .build());

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

cluster.addExistingDefaultCloudMapNamespace(ExistingCloudMapNamespaceOptions.builder()
        .namespace(importedNamespace)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;


var importedNamespace = PrivateDnsNamespace.FromPrivateDnsNamespaceAttributes(this, "ImportedNamespace", new PrivateDnsNamespaceAttributes {
    NamespaceId = "ns-xxxxxxxxxxxxx",
    NamespaceArn = "arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-xxxxxxxxxxxxx",
    NamespaceName = "example.local"
});

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

cluster.AddExistingDefaultCloudMapNamespace(new ExistingCloudMapNamespaceOptions {
    Namespace = importedNamespace
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc


importedNamespace := cloudmap.PrivateDnsNamespace_FromPrivateDnsNamespaceAttributes(this, jsii.String("ImportedNamespace"), &PrivateDnsNamespaceAttributes{
	NamespaceId: jsii.String("ns-xxxxxxxxxxxxx"),
	NamespaceArn: jsii.String("arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-xxxxxxxxxxxxx"),
	NamespaceName: jsii.String("example.local"),
})

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

cluster.AddExistingDefaultCloudMapNamespace(&ExistingCloudMapNamespaceOptions{
	Namespace: importedNamespace,
})

Properties ​

namespaceArnstringnamespace_arnstrnamespaceArnStringNamespaceArnstringNamespaceArn*string required #
Namespace ARN for the Namespace.
namespaceIdstringnamespace_idstrnamespaceIdStringNamespaceIdstringNamespaceId*string required #
Namespace Id for the Namespace.
namespaceNamestringnamespace_namestrnamespaceNameStringNamespaceNamestringNamespaceName*string required #
A name for the Namespace.