AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

Service

Define a CloudMap Service.

Import

import { Service } from 'aws-cdk-lib/aws-servicediscovery';

Or use the module namespace:

import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery';
// servicediscovery.Service

Properties

Configuration passed to the constructor as ServiceProps.

namespaceRequired
INamespace

The namespace that you want to use for DNS configuration.

5 properties inherited from DnsServiceProps
discoveryTypeOptionalinherited from DnsServiceProps
DiscoveryType

Controls how instances within this service can be discovered.

Default: DNS_AND_API

dnsRecordTypeOptionalinherited from DnsServiceProps
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

dnsTtlOptionalinherited from DnsServiceProps
Duration

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

Default: Duration.minutes(1)

loadBalancerOptionalinherited from DnsServiceProps
boolean

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

routingPolicyOptionalinherited from DnsServiceProps
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

4 properties inherited from BaseServiceProps
customHealthCheckOptionalinherited from BaseServiceProps
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

descriptionOptionalinherited from BaseServiceProps
string

A description of the service.

Default: none

healthCheckOptionalinherited from BaseServiceProps
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

nameOptionalinherited from BaseServiceProps
string

A name for the Service.

Default: CloudFormation-generated name

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter