DnsServiceProps
- class aws_cdk.aws_servicediscovery.DnsServiceProps(*, custom_health_check=None, description=None, health_check=None, name=None, discovery_type=None, dns_record_type=None, dns_ttl=None, load_balancer=None, routing_policy=None)
Bases:
BaseServiceProps
Service props needed to create a service in a given namespace.
Used by createService() for PrivateDnsNamespace and PublicDnsNamespace
- Parameters:
custom_health_check (
Union
[HealthCheckCustomConfig
,Dict
[str
,Any
],None
]) – Structure containing failure threshold for a custom health checker. Only one of healthCheckConfig or healthCheckCustomConfig can be specified. See: https://docs.aws.amazon.com/cloud-map/latest/api/API_HealthCheckCustomConfig.html Default: nonedescription (
Optional
[str
]) – A description of the service. Default: nonehealth_check (
Union
[HealthCheckConfig
,Dict
[str
,Any
],None
]) – Settings for an optional health check. 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: nonename (
Optional
[str
]) – A name for the Service. Default: CloudFormation-generated namediscovery_type (
Optional
[DiscoveryType
]) – Controls how instances within this service can be discovered. Default: DNS_AND_APIdns_record_type (
Optional
[DnsRecordType
]) – 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: Adns_ttl (
Optional
[Duration
]) – The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record. Default: Duration.minutes(1)load_balancer (
Optional
[bool
]) – Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance. Setting this totrue
correctly configures theroutingPolicy
and performs some additional validation. Default: falserouting_policy (
Optional
[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. Default: WEIGHTED for CNAME records and when loadBalancer is true, MULTIVALUE otherwise
- ExampleMetadata:
lit=aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts infused
Example:
import aws_cdk as cdk import aws_cdk as servicediscovery app = cdk.App() stack = cdk.Stack(app, "aws-servicediscovery-integ") namespace = servicediscovery.PublicDnsNamespace(stack, "Namespace", name="foobar.com" ) service = namespace.create_service("Service", name="foo", dns_record_type=servicediscovery.DnsRecordType.A, dns_ttl=cdk.Duration.seconds(30), health_check=cdk.aws_servicediscovery.HealthCheckConfig( type=servicediscovery.HealthCheckType.HTTPS, resource_path="/healthcheck", failure_threshold=2 ) ) service.register_ip_instance("IpInstance", ipv4="54.239.25.192", port=443 ) app.synth()
Attributes
- custom_health_check
Structure containing failure threshold for a custom health checker.
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.
- Default:
none
- discovery_type
Controls how instances within this service can be discovered.
- Default:
DNS_AND_API
- dns_record_type
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
- dns_ttl
The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.
- Default:
Duration.minutes(1)
- health_check
Settings for an optional health check.
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
- load_balancer
Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance.
Setting this to
true
correctly configures theroutingPolicy
and performs some additional validation.- Default:
false
- name
A name for the Service.
- Default:
CloudFormation-generated name
- routing_policy
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