aws-cdk-lib.aws_servicediscovery.ServiceProps

interface ServiceProps

LanguageType name
.NETAmazon.CDK.AWS.ServiceDiscovery.ServiceProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsservicediscovery#ServiceProps
Javasoftware.amazon.awscdk.services.servicediscovery.ServiceProps
Pythonaws_cdk.aws_servicediscovery.ServiceProps
TypeScript (source)aws-cdk-lib » aws_servicediscovery » ServiceProps

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_servicediscovery as servicediscovery } from 'aws-cdk-lib';

declare const namespace: servicediscovery.INamespace;
const serviceProps: servicediscovery.ServiceProps = {
  namespace: namespace,

  // the properties below are optional
  customHealthCheck: {
    failureThreshold: 123,
  },
  description: 'description',
  discoveryType: servicediscovery.DiscoveryType.API,
  dnsRecordType: servicediscovery.DnsRecordType.A,
  dnsTtl: cdk.Duration.minutes(30),
  healthCheck: {
    failureThreshold: 123,
    resourcePath: 'resourcePath',
    type: servicediscovery.HealthCheckType.HTTP,
  },
  loadBalancer: false,
  name: 'name',
  routingPolicy: servicediscovery.RoutingPolicy.WEIGHTED,
};

Properties

NameTypeDescription
namespaceINamespaceThe namespace that you want to use for DNS configuration.
customHealthCheck?HealthCheckCustomConfigStructure containing failure threshold for a custom health checker.
description?stringA description of the service.
discoveryType?DiscoveryTypeControls how instances within this service can be discovered.
dnsRecordType?DnsRecordTypeThe DNS type of the record that you want AWS Cloud Map to create.
dnsTtl?DurationThe amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.
healthCheck?HealthCheckConfigSettings for an optional health check.
loadBalancer?booleanWhether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance.
name?stringA name for the Service.
routingPolicy?RoutingPolicyThe 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.

namespace

Type: INamespace

The namespace that you want to use for DNS configuration.


customHealthCheck?

Type: HealthCheckCustomConfig (optional, default: 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


description?

Type: string (optional, default: none)

A description of the service.


discoveryType?

Type: DiscoveryType (optional, default: DNS_AND_API)

Controls how instances within this service can be discovered.


dnsRecordType?

Type: DnsRecordType (optional, default: A)

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.


dnsTtl?

Type: Duration (optional, default: Duration.minutes(1))

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


healthCheck?

Type: HealthCheckConfig (optional, default: 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.


loadBalancer?

Type: boolean (optional, default: false)

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.


name?

Type: string (optional, default: CloudFormation-generated name)

A name for the Service.


routingPolicy?

Type: RoutingPolicy (optional, default: WEIGHTED for CNAME records and when loadBalancer is true, MULTIVALUE otherwise)

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.