Class DnsServiceProps
Service props needed to create a service in a given namespace.
Inheritance
Namespace: Amazon.CDK.AWS.ServiceDiscovery
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class DnsServiceProps : Object, IDnsServiceProps, IBaseServiceProps
Syntax (vb)
Public Class DnsServiceProps
Inherits Object
Implements IDnsServiceProps, IBaseServiceProps
Remarks
Used by createService() for PrivateDnsNamespace and PublicDnsNamespace
ExampleMetadata: lit=aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts infused
Examples
using Amazon.CDK;
using Amazon.CDK;
var app = new App();
var stack = new Stack(app, "aws-servicediscovery-integ");
var namespace = new PublicDnsNamespace(stack, "Namespace", new PublicDnsNamespaceProps {
Name = "foobar.com"
});
var service = namespace.CreateService("Service", new DnsServiceProps {
Name = "foo",
DnsRecordType = DnsRecordType.A,
DnsTtl = Duration.Seconds(30),
HealthCheck = new HealthCheckConfig {
Type = HealthCheckType.HTTPS,
ResourcePath = "/healthcheck",
FailureThreshold = 2
}
});
service.RegisterIpInstance("IpInstance", new IpInstanceBaseProps {
Ipv4 = "54.239.25.192",
Port = 443
});
app.Synth();
Synopsis
Constructors
DnsServiceProps() |
Properties
CustomHealthCheck | Structure containing failure threshold for a custom health checker. |
Description | A description of the service. |
DiscoveryType | Controls how instances within this service can be discovered. |
DnsRecordType | The DNS type of the record that you want AWS Cloud Map to create. |
DnsTtl | The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record. |
HealthCheck | Settings for an optional health check. |
LoadBalancer | Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance. |
Name | A name for the Service. |
RoutingPolicy | The routing policy that you want to apply to all DNS records that AWS Cloud Map creates when you register an instance and specify this service. |
Constructors
DnsServiceProps()
public DnsServiceProps()
Properties
CustomHealthCheck
Structure containing failure threshold for a custom health checker.
public IHealthCheckCustomConfig CustomHealthCheck { get; set; }
Property Value
Remarks
Only one of healthCheckConfig or healthCheckCustomConfig can be specified. See: https://docs.aws.amazon.com/cloud-map/latest/api/API_HealthCheckCustomConfig.html
Default: none
Description
A description of the service.
public string Description { get; set; }
Property Value
System.String
Remarks
Default: none
DiscoveryType
Controls how instances within this service can be discovered.
public Nullable<DiscoveryType> DiscoveryType { get; set; }
Property Value
System.Nullable<DiscoveryType>
Remarks
Default: DNS_AND_API
DnsRecordType
The DNS type of the record that you want AWS Cloud Map to create.
public Nullable<DnsRecordType> DnsRecordType { get; set; }
Property Value
System.Nullable<DnsRecordType>
Remarks
Supported record types include A, AAAA, A and AAAA (A_AAAA), CNAME, and SRV.
Default: A
DnsTtl
The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.
public Duration DnsTtl { get; set; }
Property Value
Remarks
Default: Duration.minutes(1)
HealthCheck
Settings for an optional health check.
public IHealthCheckConfig HealthCheck { get; set; }
Property Value
Remarks
If you specify health check settings, AWS Cloud Map associates the health check with the records that you specify in DnsConfig. Only one of healthCheckConfig or healthCheckCustomConfig can be specified. Not valid for PrivateDnsNamespaces. If you use healthCheck, you can only register IP instances to this service.
Default: none
LoadBalancer
Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance.
public Nullable<bool> LoadBalancer { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Setting this to true
correctly configures the routingPolicy
and performs some additional validation.
Default: false
Name
A name for the Service.
public string Name { get; set; }
Property Value
System.String
Remarks
Default: CloudFormation-generated name
RoutingPolicy
The routing policy that you want to apply to all DNS records that AWS Cloud Map creates when you register an instance and specify this service.
public Nullable<RoutingPolicy> RoutingPolicy { get; set; }
Property Value
System.Nullable<RoutingPolicy>
Remarks
Default: WEIGHTED for CNAME records and when loadBalancer is true, MULTIVALUE otherwise