Interface DnsServiceProps

All Superinterfaces:
BaseServiceProps, software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
ServiceProps
All Known Implementing Classes:
DnsServiceProps.Jsii$Proxy, ServiceProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-02T15:58:33.627Z") @Stability(Stable) public interface DnsServiceProps extends software.amazon.jsii.JsiiSerializable, BaseServiceProps
Service props needed to create a service in a given namespace.

Used by createService() for PrivateDnsNamespace and PublicDnsNamespace

Example:

 import software.amazon.awscdk.*;
 import software.amazon.awscdk.*;
 App app = new App();
 Stack stack = new Stack(app, "aws-servicediscovery-integ");
 PublicDnsNamespace namespace = PublicDnsNamespace.Builder.create(stack, "Namespace")
         .name("foobar.com")
         .build();
 Service service = namespace.createService("Service", DnsServiceProps.builder()
         .name("foo")
         .dnsRecordType(DnsRecordType.A)
         .dnsTtl(Duration.seconds(30))
         .healthCheck(HealthCheckConfig.builder()
                 .type(HealthCheckType.HTTPS)
                 .resourcePath("/healthcheck")
                 .failureThreshold(2)
                 .build())
         .build());
 service.registerIpInstance("IpInstance", IpInstanceBaseProps.builder()
         .ipv4("54.239.25.192")
         .port(443)
         .build());
 app.synth();
 
  • Method Details

    • getDiscoveryType

      @Stability(Stable) @Nullable default DiscoveryType getDiscoveryType()
      Controls how instances within this service can be discovered.

      Default: DNS_AND_API

    • getDnsRecordType

      @Stability(Stable) @Nullable default DnsRecordType getDnsRecordType()
      The DNS type of the record that you want AWS Cloud Map to create.

      Supported record types include A, AAAA, A and AAAA (A_AAAA), CNAME, and SRV.

      Default: A

    • getDnsTtl

      @Stability(Stable) @Nullable default Duration getDnsTtl()
      The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.

      Default: Duration.minutes(1)

    • getLoadBalancer

      @Stability(Stable) @Nullable default Boolean getLoadBalancer()
      Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance.

      Setting this to true correctly configures the routingPolicy and performs some additional validation.

      Default: false

    • getRoutingPolicy

      @Stability(Stable) @Nullable default RoutingPolicy getRoutingPolicy()
      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.

      Default: WEIGHTED for CNAME records and when loadBalancer is true, MULTIVALUE otherwise

    • builder

      @Stability(Stable) static DnsServiceProps.Builder builder()
      Returns:
      a DnsServiceProps.Builder of DnsServiceProps