Class PrivateDnsNamespace
Define a Service Discovery HTTP Namespace.
Inherited Members
Namespace: Amazon.CDK.AWS.ServiceDiscovery
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class PrivateDnsNamespace : Resource, IPrivateDnsNamespace, INamespace, IResource, IConstruct, IDependable
Syntax (vb)
Public Class PrivateDnsNamespace Inherits Resource Implements IPrivateDnsNamespace, INamespace, IResource, IConstruct, IDependable
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
Examples
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;
using Amazon.CDK;
using Amazon.CDK;
var app = new App();
var stack = new Stack(app, "aws-servicediscovery-integ");
var vpc = new Vpc(stack, "Vpc", new VpcProps { MaxAzs = 2 });
var namespace = new PrivateDnsNamespace(stack, "Namespace", new PrivateDnsNamespaceProps {
Name = "boobar.com",
Vpc = vpc
});
var service = namespace.CreateService("Service", new DnsServiceProps {
DnsRecordType = DnsRecordType.A_AAAA,
DnsTtl = Duration.Seconds(30),
LoadBalancer = true
});
var loadbalancer = new ApplicationLoadBalancer(stack, "LB", new ApplicationLoadBalancerProps { Vpc = vpc, InternetFacing = true });
service.RegisterLoadBalancer("Loadbalancer", loadbalancer);
var arnService = namespace.CreateService("ArnService", new DnsServiceProps {
DiscoveryType = DiscoveryType.API
});
arnService.RegisterNonIpInstance("NonIpInstance", new NonIpInstanceBaseProps {
CustomAttributes = new Dictionary<string, string> { { "arn", "arn://" } }
});
app.Synth();
Synopsis
Constructors
PrivateDnsNamespace(Construct, string, IPrivateDnsNamespaceProps) | Define a Service Discovery HTTP Namespace. |
Properties
NamespaceArn | Namespace Arn of the namespace. |
NamespaceHostedZoneId | ID of hosted zone created by namespace. |
NamespaceId | Namespace Id of the PrivateDnsNamespace. |
NamespaceName | The name of the PrivateDnsNamespace. |
PROPERTY_INJECTION_ID | Uniquely identifies this class. |
PrivateDnsNamespaceArn | Define a Service Discovery HTTP Namespace. |
PrivateDnsNamespaceId | Define a Service Discovery HTTP Namespace. |
PrivateDnsNamespaceName | Define a Service Discovery HTTP Namespace. |
Type | Type of the namespace. |
Methods
CreateService(string, IDnsServiceProps?) | Creates a service within the namespace. |
FromPrivateDnsNamespaceAttributes(Construct, string, IPrivateDnsNamespaceAttributes) | Define a Service Discovery HTTP Namespace. |
Constructors
PrivateDnsNamespace(Construct, string, IPrivateDnsNamespaceProps)
Define a Service Discovery HTTP Namespace.
public PrivateDnsNamespace(Construct scope, string id, IPrivateDnsNamespaceProps props)
Parameters
- scope Construct
- id string
- props IPrivateDnsNamespaceProps
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
Examples
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;
using Amazon.CDK;
using Amazon.CDK;
var app = new App();
var stack = new Stack(app, "aws-servicediscovery-integ");
var vpc = new Vpc(stack, "Vpc", new VpcProps { MaxAzs = 2 });
var namespace = new PrivateDnsNamespace(stack, "Namespace", new PrivateDnsNamespaceProps {
Name = "boobar.com",
Vpc = vpc
});
var service = namespace.CreateService("Service", new DnsServiceProps {
DnsRecordType = DnsRecordType.A_AAAA,
DnsTtl = Duration.Seconds(30),
LoadBalancer = true
});
var loadbalancer = new ApplicationLoadBalancer(stack, "LB", new ApplicationLoadBalancerProps { Vpc = vpc, InternetFacing = true });
service.RegisterLoadBalancer("Loadbalancer", loadbalancer);
var arnService = namespace.CreateService("ArnService", new DnsServiceProps {
DiscoveryType = DiscoveryType.API
});
arnService.RegisterNonIpInstance("NonIpInstance", new NonIpInstanceBaseProps {
CustomAttributes = new Dictionary<string, string> { { "arn", "arn://" } }
});
app.Synth();
Properties
NamespaceArn
Namespace Arn of the namespace.
public virtual string NamespaceArn { get; }
Property Value
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
NamespaceHostedZoneId
ID of hosted zone created by namespace.
public virtual string NamespaceHostedZoneId { get; }
Property Value
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
NamespaceId
Namespace Id of the PrivateDnsNamespace.
public virtual string NamespaceId { get; }
Property Value
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
NamespaceName
The name of the PrivateDnsNamespace.
public virtual string NamespaceName { get; }
Property Value
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
PrivateDnsNamespaceArn
Define a Service Discovery HTTP Namespace.
public virtual string PrivateDnsNamespaceArn { get; }
Property Value
Remarks
Attribute: true
PrivateDnsNamespaceId
Define a Service Discovery HTTP Namespace.
public virtual string PrivateDnsNamespaceId { get; }
Property Value
Remarks
Attribute: true
PrivateDnsNamespaceName
Define a Service Discovery HTTP Namespace.
public virtual string PrivateDnsNamespaceName { get; }
Property Value
Remarks
Attribute: true
Type
Type of the namespace.
public virtual NamespaceType Type { get; }
Property Value
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
Methods
CreateService(string, IDnsServiceProps?)
Creates a service within the namespace.
public virtual Service CreateService(string id, IDnsServiceProps? props = null)
Parameters
- id string
- props IDnsServiceProps
Returns
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
FromPrivateDnsNamespaceAttributes(Construct, string, IPrivateDnsNamespaceAttributes)
Define a Service Discovery HTTP Namespace.
public static IPrivateDnsNamespace FromPrivateDnsNamespaceAttributes(Construct scope, string id, IPrivateDnsNamespaceAttributes attrs)
Parameters
- scope Construct
- id string
- attrs IPrivateDnsNamespaceAttributes
Returns
Remarks
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts infused
Examples
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2;
using Amazon.CDK;
using Amazon.CDK;
var app = new App();
var stack = new Stack(app, "aws-servicediscovery-integ");
var vpc = new Vpc(stack, "Vpc", new VpcProps { MaxAzs = 2 });
var namespace = new PrivateDnsNamespace(stack, "Namespace", new PrivateDnsNamespaceProps {
Name = "boobar.com",
Vpc = vpc
});
var service = namespace.CreateService("Service", new DnsServiceProps {
DnsRecordType = DnsRecordType.A_AAAA,
DnsTtl = Duration.Seconds(30),
LoadBalancer = true
});
var loadbalancer = new ApplicationLoadBalancer(stack, "LB", new ApplicationLoadBalancerProps { Vpc = vpc, InternetFacing = true });
service.RegisterLoadBalancer("Loadbalancer", loadbalancer);
var arnService = namespace.CreateService("ArnService", new DnsServiceProps {
DiscoveryType = DiscoveryType.API
});
arnService.RegisterNonIpInstance("NonIpInstance", new NonIpInstanceBaseProps {
CustomAttributes = new Dictionary<string, string> { { "arn", "arn://" } }
});
app.Synth();