Skip to content
v2.278.0

CfnServiceProps Struct ​

Properties for defining a CfnService.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_servicediscovery as servicediscovery } from 'aws-cdk-lib';
const cfnServiceProps: servicediscovery.CfnServiceProps = {
  description: 'description',
  dnsConfig: {
    dnsRecords: [{
      ttl: 123,
      type: 'type',
    }],

    // the properties below are optional
    namespaceId: 'namespaceId',
    routingPolicy: 'routingPolicy',
  },
  healthCheckConfig: {
    type: 'type',

    // the properties below are optional
    failureThreshold: 123,
    resourcePath: 'resourcePath',
  },
  healthCheckCustomConfig: {
    failureThreshold: 123,
  },
  name: 'name',
  namespaceId: 'namespaceId',
  serviceAttributes: {
    serviceAttributesKey: 'serviceAttributes',
  },
  tags: [{
    key: 'key',
    value: 'value',
  }],
  type: 'type',
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_servicediscovery as servicediscovery

cfn_service_props = servicediscovery.CfnServiceProps(
    description="description",
    dns_config=servicediscovery.CfnService.DnsConfigProperty(
        dns_records=[servicediscovery.CfnService.DnsRecordProperty(
            ttl=123,
            type="type"
        )],

        # the properties below are optional
        namespace_id="namespaceId",
        routing_policy="routingPolicy"
    ),
    health_check_config=servicediscovery.CfnService.HealthCheckConfigProperty(
        type="type",

        # the properties below are optional
        failure_threshold=123,
        resource_path="resourcePath"
    ),
    health_check_custom_config=servicediscovery.CfnService.HealthCheckCustomConfigProperty(
        failure_threshold=123
    ),
    name="name",
    namespace_id="namespaceId",
    service_attributes={
        "service_attributes_key": "serviceAttributes"
    },
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    type="type"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.servicediscovery.*;

CfnServiceProps cfnServiceProps = CfnServiceProps.builder()
        .description("description")
        .dnsConfig(DnsConfigProperty.builder()
                .dnsRecords(List.of(DnsRecordProperty.builder()
                        .ttl(123)
                        .type("type")
                        .build()))

                // the properties below are optional
                .namespaceId("namespaceId")
                .routingPolicy("routingPolicy")
                .build())
        .healthCheckConfig(HealthCheckConfigProperty.builder()
                .type("type")

                // the properties below are optional
                .failureThreshold(123)
                .resourcePath("resourcePath")
                .build())
        .healthCheckCustomConfig(HealthCheckCustomConfigProperty.builder()
                .failureThreshold(123)
                .build())
        .name("name")
        .namespaceId("namespaceId")
        .serviceAttributes(Map.of(
                "serviceAttributesKey", "serviceAttributes"))
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .type("type")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ServiceDiscovery;

var cfnServiceProps = new CfnServiceProps {
    Description = "description",
    DnsConfig = new DnsConfigProperty {
        DnsRecords = new [] { new DnsRecordProperty {
            Ttl = 123,
            Type = "type"
        } },

        // the properties below are optional
        NamespaceId = "namespaceId",
        RoutingPolicy = "routingPolicy"
    },
    HealthCheckConfig = new HealthCheckConfigProperty {
        Type = "type",

        // the properties below are optional
        FailureThreshold = 123,
        ResourcePath = "resourcePath"
    },
    HealthCheckCustomConfig = new HealthCheckCustomConfigProperty {
        FailureThreshold = 123
    },
    Name = "name",
    NamespaceId = "namespaceId",
    ServiceAttributes = new Dictionary<string, string> {
        { "serviceAttributesKey", "serviceAttributes" }
    },
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    Type = "type"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnServiceProps := &CfnServiceProps{
	Description: jsii.String("description"),
	DnsConfig: &DnsConfigProperty{
		DnsRecords: []interface{}{
			&DnsRecordProperty{
				Ttl: jsii.Number(123),
				Type: jsii.String("type"),
			},
		},

		// the properties below are optional
		NamespaceId: jsii.String("namespaceId"),
		RoutingPolicy: jsii.String("routingPolicy"),
	},
	HealthCheckConfig: &HealthCheckConfigProperty{
		Type: jsii.String("type"),

		// the properties below are optional
		FailureThreshold: jsii.Number(123),
		ResourcePath: jsii.String("resourcePath"),
	},
	HealthCheckCustomConfig: &HealthCheckCustomConfigProperty{
		FailureThreshold: jsii.Number(123),
	},
	Name: jsii.String("name"),
	NamespaceId: jsii.String("namespaceId"),
	ServiceAttributes: map[string]*string{
		"serviceAttributesKey": jsii.String("serviceAttributes"),
	},
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	Type: jsii.String("type"),
}

Properties ​

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
The description of the service.
dnsConfigoptionalIResolvable | CfnService.DnsConfigPropertydns_configoptionaltyping.Union[IResolvable, DnsConfigProperty]dnsConfigoptionalIResolvableDnsConfigoptionalIResolvableDnsConfigoptionalinterface{} #
A complex type that contains information about the Route 53 DNS records that you want AWS Cloud Map to create when you register an instance.

The record types of a service can only be changed by deleting the service and recreating it with a new Dnsconfig .

healthCheckConfigoptionalIResolvable | CfnService.HealthCheckConfigPropertyhealth_check_configoptionaltyping.Union[IResolvable, HealthCheckConfigProperty]healthCheckConfigoptionalIResolvableHealthCheckConfigoptionalIResolvableHealthCheckConfigoptionalinterface{} #
*Public DNS and HTTP namespaces only.* A complex type that contains settings for an optional health check. If you specify settings for a health check, AWS Cloud Map associates the health check with the records that you specify in `DnsConfig` .

For information about the charges for health checks, see Amazon Route 53 Pricing .

healthCheckCustomConfigoptionalIResolvable | CfnService.HealthCheckCustomConfigPropertyhealth_check_custom_configoptionaltyping.Union[IResolvable, HealthCheckCustomConfigProperty]healthCheckCustomConfigoptionalIResolvableHealthCheckCustomConfigoptionalIResolvableHealthCheckCustomConfigoptionalinterface{} #
A complex type that contains information about an optional custom health check.

If you specify a health check configuration, you can specify either HealthCheckCustomConfig or HealthCheckConfig but not both.

nameoptionalstringnameoptionalstrnameoptionalStringNameoptionalstringNameoptional*string #
The name of the service.
namespaceIdoptionalstringnamespace_idoptionalstrnamespaceIdoptionalStringNamespaceIdoptionalstringNamespaceIdoptional*string #
The ID or Amazon Resource Name (ARN) of the namespace that you want to use to create the service.
notes

For namespaces shared with your AWS account, specify the namespace ARN. For more information about shared namespaces, see Cross-account AWS Cloud Map namespace sharing in the AWS Cloud Map Developer Guide .

serviceAttributesoptionalIResolvable | { [key: string]: string }service_attributesoptionaltyping.Union[IResolvable, typing.Mapping[str, str]]serviceAttributesoptionalIResolvableServiceAttributesoptionalIResolvableServiceAttributesoptionalinterface{} #
A complex type that contains information about attributes associated with a specific service.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
The tags for the service.

Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

typeoptionalstringtypeoptionalstrtypeoptionalStringTypeoptionalstringTypeoptional*string #
If present, specifies that the service instances are only discoverable using the `DiscoverInstances` API operation.

No DNS records is registered for the service instances. The only valid value is HTTP .