ServiceProps

class aws_cdk.aws_servicediscovery.ServiceProps(*, custom_health_check=None, description=None, health_check=None, name=None, dns_record_type=None, dns_ttl=None, load_balancer=None, routing_policy=None, namespace)

Bases: aws_cdk.aws_servicediscovery.DnsServiceProps

Parameters
  • custom_health_check (Optional[HealthCheckCustomConfig]) – 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 (Optional[str]) – A description of the service. Default: none

  • health_check (Optional[HealthCheckConfig]) – 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

  • name (Optional[str]) – A name for the Service. Default: CloudFormation-generated name

  • dns_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: A

  • dns_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 to true correctly configures the routingPolicy and performs some additional validation. Default: false

  • routing_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

  • namespace (INamespace) – The namespace that you want to use for DNS configuration.

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_servicediscovery as servicediscovery
import aws_cdk.core as cdk

# namespace: servicediscovery.INamespace

service_props = servicediscovery.ServiceProps(
    namespace=namespace,

    # the properties below are optional
    custom_health_check=servicediscovery.HealthCheckCustomConfig(
        failure_threshold=123
    ),
    description="description",
    dns_record_type=servicediscovery.DnsRecordType.A,
    dns_ttl=cdk.Duration.minutes(30),
    health_check=servicediscovery.HealthCheckConfig(
        failure_threshold=123,
        resource_path="resourcePath",
        type=servicediscovery.HealthCheckType.HTTP
    ),
    load_balancer=False,
    name="name",
    routing_policy=servicediscovery.RoutingPolicy.WEIGHTED
)

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

Return type

Optional[HealthCheckCustomConfig]

description

A description of the service.

Default

none

Return type

Optional[str]

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

Return type

Optional[DnsRecordType]

dns_ttl

The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.

Default

Duration.minutes(1)

Return type

Optional[Duration]

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

Return type

Optional[HealthCheckConfig]

load_balancer

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

Return type

Optional[bool]

name

A name for the Service.

Default

CloudFormation-generated name

Return type

Optional[str]

namespace

The namespace that you want to use for DNS configuration.

Return type

INamespace

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

Return type

Optional[RoutingPolicy]