

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::ServiceDiscovery::Service
<a name="aws-resource-servicediscovery-service"></a>

A complex type that contains information about the specified service.

## Syntax
<a name="aws-resource-servicediscovery-service-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-servicediscovery-service-syntax.json"></a>

```
{
  "Type" : "AWS::ServiceDiscovery::Service",
  "Properties" : {
      "[Description](#cfn-servicediscovery-service-description)" : String,
      "[DnsConfig](#cfn-servicediscovery-service-dnsconfig)" : DnsConfig,
      "[HealthCheckConfig](#cfn-servicediscovery-service-healthcheckconfig)" : HealthCheckConfig,
      "[HealthCheckCustomConfig](#cfn-servicediscovery-service-healthcheckcustomconfig)" : HealthCheckCustomConfig,
      "[Name](#cfn-servicediscovery-service-name)" : String,
      "[NamespaceId](#cfn-servicediscovery-service-namespaceid)" : String,
      "[ServiceAttributes](#cfn-servicediscovery-service-serviceattributes)" : Json,
      "[Tags](#cfn-servicediscovery-service-tags)" : [ Tag, ... ],
      "[Type](#cfn-servicediscovery-service-type)" : String
    }
}
```

### YAML
<a name="aws-resource-servicediscovery-service-syntax.yaml"></a>

```
Type: AWS::ServiceDiscovery::Service
Properties:
  [Description](#cfn-servicediscovery-service-description): String
  [DnsConfig](#cfn-servicediscovery-service-dnsconfig): 
    DnsConfig
  [HealthCheckConfig](#cfn-servicediscovery-service-healthcheckconfig): 
    HealthCheckConfig
  [HealthCheckCustomConfig](#cfn-servicediscovery-service-healthcheckcustomconfig): 
    HealthCheckCustomConfig
  [Name](#cfn-servicediscovery-service-name): String
  [NamespaceId](#cfn-servicediscovery-service-namespaceid): String
  [ServiceAttributes](#cfn-servicediscovery-service-serviceattributes): Json
  [Tags](#cfn-servicediscovery-service-tags): 
    - Tag
  [Type](#cfn-servicediscovery-service-type): String
```

## Properties
<a name="aws-resource-servicediscovery-service-properties"></a>

`Description`  <a name="cfn-servicediscovery-service-description"></a>
The description of the service.  
*Required*: No  
*Type*: String  
*Maximum*: `1024`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`DnsConfig`  <a name="cfn-servicediscovery-service-dnsconfig"></a>
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`.
*Required*: No  
*Type*: [DnsConfig](aws-properties-servicediscovery-service-dnsconfig.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`HealthCheckConfig`  <a name="cfn-servicediscovery-service-healthcheckconfig"></a>
*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](https://aws.amazon.com/route53/pricing/).  
*Required*: No  
*Type*: [HealthCheckConfig](aws-properties-servicediscovery-service-healthcheckconfig.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`HealthCheckCustomConfig`  <a name="cfn-servicediscovery-service-healthcheckcustomconfig"></a>
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.
*Required*: No  
*Type*: [HealthCheckCustomConfig](aws-properties-servicediscovery-service-healthcheckcustomconfig.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Name`  <a name="cfn-servicediscovery-service-name"></a>
The name of the service.  
*Required*: No  
*Type*: String  
*Pattern*: `((?=^.{1,127}$)^([a-zA-Z0-9_][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9_]|[a-zA-Z0-9])(\.([a-zA-Z0-9_][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9_]|[a-zA-Z0-9]))*$)|(^\.$)`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`NamespaceId`  <a name="cfn-servicediscovery-service-namespaceid"></a>
The ID or Amazon Resource Name (ARN) of the namespace that you want to use to create the service. 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](https://docs.aws.amazon.com/cloud-map/latest/dg/sharing-namespaces.html) in the *AWS Cloud Map Developer Guide*.  
*Required*: No  
*Type*: String  
*Maximum*: `255`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ServiceAttributes`  <a name="cfn-servicediscovery-service-serviceattributes"></a>
A complex type that contains information about attributes associated with a specific service.  
*Required*: No  
*Type*: Json  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Tags`  <a name="cfn-servicediscovery-service-tags"></a>
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.  
*Required*: No  
*Type*: Array of [Tag](aws-properties-servicediscovery-service-tag.md)  
*Minimum*: `0`  
*Maximum*: `200`  
*Update requires*: Updates are not supported.

`Type`  <a name="cfn-servicediscovery-service-type"></a>
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`.  
*Required*: No  
*Type*: String  
*Allowed values*: `HTTP`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-servicediscovery-service-return-values"></a>

### Ref
<a name="aws-resource-servicediscovery-service-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the value of `Id` for the service, such as `srv-e4anhexample0004`.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-servicediscovery-service-return-values-fn--getatt"></a>

The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the `Fn::GetAtt` intrinsic function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-servicediscovery-service-return-values-fn--getatt-fn--getatt"></a>

`Arn`  <a name="Arn-fn::getatt"></a>
The Amazon Resource Name (ARN) of the service.

`Id`  <a name="Id-fn::getatt"></a>
The ID of the service.

`Name`  <a name="Name-fn::getatt"></a>
The name that you assigned to the service.

## Examples
<a name="aws-resource-servicediscovery-service--examples"></a>

**Topics**
+ [Create a service](#aws-resource-servicediscovery-service--examples--Create_a_service)
+ [Specify attributes at the service level](#aws-resource-servicediscovery-service--examples--Specify_attributes_at_the_service_level)

### Create a service
<a name="aws-resource-servicediscovery-service--examples--Create_a_service"></a>

The following example creates a service based on a public DNS namespace. The service includes settings for Amazon Route 53 A and AAAA records that have a routing policy of `WEIGHTED`. It also includes a Route 53 health check.

#### JSON
<a name="aws-resource-servicediscovery-service--examples--Create_a_service--json"></a>

```
{
  "Resources": {
    "Service": {
      "Type": "AWS::ServiceDiscovery::Service",
      "Properties": {
        "Description": "Service based on a public DNS namespace",
        "DnsConfig": {
          "DnsRecords": [
            {
              "Type": "A",
              "TTL": 60
            },
            {
              "Type": "AAAA",
              "TTL": 60
            }
          ],
          "RoutingPolicy": "WEIGHTED"
        },
        "HealthCheckConfig": {
          "FailureThreshold": 3,
          "ResourcePath": "/",
          "Type": "HTTPS"
        },
        "Name": "example-public-DNS-service",
        "NamespaceId": "ns-e4anhexample0004"
      }
    }
  }
}
```

#### YAML
<a name="aws-resource-servicediscovery-service--examples--Create_a_service--yaml"></a>

```
Resources:
  Service:
    Type: AWS::ServiceDiscovery::Service
    Properties:
      Description: Service based on a public DNS namespace
      DnsConfig:
        DnsRecords:
          - Type: A
            TTL: 60
          - Type: AAAA
            TTL: 60
        RoutingPolicy: WEIGHTED
      HealthCheckConfig:
        FailureThreshold: 3
        ResourcePath: /
        Type: HTTPS
      Name: example-public-DNS-service
      NamespaceId: ns-e4anhexample0004
```

### Specify attributes at the service level
<a name="aws-resource-servicediscovery-service--examples--Specify_attributes_at_the_service_level"></a>

This example specifies the port that the client application should use to communicate with the service, as a service attribute. The example also specifies the service revision and that 100% of traffic should be directed to the revision.

#### JSON
<a name="aws-resource-servicediscovery-service--examples--Specify_attributes_at_the_service_level--json"></a>

```
{
  "Resources": {
    "Service": {
      "Type": "AWS::ServiceDiscovery::Service",
      "Properties": {
        "Description": "Service based on a public DNS namespace",
        "DnsConfig": {
          "DnsRecords": [
            {
              "Type": "A",
              "TTL": 60
            },
            {
              "Type": "AAAA",
              "TTL": 60
            }
          ],
          "RoutingPolicy": "WEIGHTED"
        },
        "ServiceAttributes": {
          "Port": "8080",
          "Weight": "{'revision-A': '100'}"
        },
        "HealthCheckConfig": {
          "FailureThreshold": 3,
          "ResourcePath": "/",
          "Type": "HTTPS"
        },
        "Name": "example-public-DNS-service",
        "NamespaceId": "ns-e4anhexample0004"
      }
    }
  }
}
```

#### YAML
<a name="aws-resource-servicediscovery-service--examples--Specify_attributes_at_the_service_level--yaml"></a>

```
Resources:
  Service:
    Type: AWS::ServiceDiscovery::Service
    Properties:
      Description: Service based on a public DNS namespace
      DnsConfig:
        DnsRecords:
          - Type: A
            TTL: 60
          - Type: AAAA
            TTL: 60
        RoutingPolicy: WEIGHTED
      HealthCheckConfig:
        FailureThreshold: 3
        ResourcePath: /
        Type: HTTPS
      ServiceAttributes:
        Port: 8080
        Weight: {'revision-A': '100'}
      Name: example-public-DNS-service
      NamespaceId: ns-e4anhexample0004
```

## See also
<a name="aws-resource-servicediscovery-service--seealso"></a>
+ [CreateService](https://docs.aws.amazon.com/cloud-map/latest/api/API_CreateService.html) in the * AWS Cloud Map API Reference *



# AWS::ServiceDiscovery::Service DnsConfig
<a name="aws-properties-servicediscovery-service-dnsconfig"></a>

A complex type that contains information about the Amazon Route 53 DNS records that you want AWS Cloud Map to create when you register an instance.

## Syntax
<a name="aws-properties-servicediscovery-service-dnsconfig-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-servicediscovery-service-dnsconfig-syntax.json"></a>

```
{
  "[DnsRecords](#cfn-servicediscovery-service-dnsconfig-dnsrecords)" : [ DnsRecord, ... ],
  "[NamespaceId](#cfn-servicediscovery-service-dnsconfig-namespaceid)" : String,
  "[RoutingPolicy](#cfn-servicediscovery-service-dnsconfig-routingpolicy)" : String
}
```

### YAML
<a name="aws-properties-servicediscovery-service-dnsconfig-syntax.yaml"></a>

```
  [DnsRecords](#cfn-servicediscovery-service-dnsconfig-dnsrecords): 
    - DnsRecord
  [NamespaceId](#cfn-servicediscovery-service-dnsconfig-namespaceid): String
  [RoutingPolicy](#cfn-servicediscovery-service-dnsconfig-routingpolicy): String
```

## Properties
<a name="aws-properties-servicediscovery-service-dnsconfig-properties"></a>

`DnsRecords`  <a name="cfn-servicediscovery-service-dnsconfig-dnsrecords"></a>
An array that contains one `DnsRecord` object for each Route 53 DNS record that you want AWS Cloud Map to create when you register an instance.  
The record type of a service can't be updated directly and can only be changed by deleting the service and recreating it with a new `DnsConfig`.
*Required*: Yes  
*Type*: Array of [DnsRecord](aws-properties-servicediscovery-service-dnsrecord.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`NamespaceId`  <a name="cfn-servicediscovery-service-dnsconfig-namespaceid"></a>
 *Use NamespaceId in [Service](https://docs.aws.amazon.com/cloud-map/latest/api/API_Service.html) instead.*   
The ID of the namespace to use for DNS configuration.  
*Required*: No  
*Type*: String  
*Maximum*: `64`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`RoutingPolicy`  <a name="cfn-servicediscovery-service-dnsconfig-routingpolicy"></a>
The routing policy that you want to apply to all Route 53 DNS records that AWS Cloud Map creates when you register an instance and specify this service.  
If you want to use this service to register instances that create alias records, specify `WEIGHTED` for the routing policy.
You can specify the following values:    
MULTIVALUE  
If you define a health check for the service and the health check is healthy, Route 53 returns the applicable value for up to eight instances.  
For example, suppose that the service includes configurations for one `A` record and a health check. You use the service to register 10 instances. Route 53 responds to DNS queries with IP addresses for up to eight healthy instances. If fewer than eight instances are healthy, Route 53 responds to every DNS query with the IP addresses for all of the healthy instances.  
If you don't define a health check for the service, Route 53 assumes that all instances are healthy and returns the values for up to eight instances.  
For more information about the multivalue routing policy, see [Multivalue Answer Routing](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html#routing-policy-multivalue) in the *Route 53 Developer Guide*.  
WEIGHTED  
Route 53 returns the applicable value from one randomly selected instance from among the instances that you registered using the same service. Currently, all records have the same weight, so you can't route more or less traffic to any instances.  
For example, suppose that the service includes configurations for one `A` record and a health check. You use the service to register 10 instances. Route 53 responds to DNS queries with the IP address for one randomly selected instance from among the healthy instances. If no instances are healthy, Route 53 responds to DNS queries as if all of the instances were healthy.  
If you don't define a health check for the service, Route 53 assumes that all instances are healthy and returns the applicable value for one randomly selected instance.  
For more information about the weighted routing policy, see [Weighted Routing](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html#routing-policy-weighted) in the *Route 53 Developer Guide*.
*Required*: No  
*Type*: String  
*Allowed values*: `MULTIVALUE | WEIGHTED`  
*Update requires*: Updates are not supported.

## See also
<a name="aws-properties-servicediscovery-service-dnsconfig--seealso"></a>
+ [Return values](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html#aws-resource-servicediscovery-service-return-values) in the topic [AWS::ServiceDiscovery::Service](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html)
+ [DnsConfig](https://docs.aws.amazon.com/cloud-map/latest/api/API_DnsConfig.html) in the * AWS Cloud Map API Reference *



# AWS::ServiceDiscovery::Service DnsRecord
<a name="aws-properties-servicediscovery-service-dnsrecord"></a>

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.

## Syntax
<a name="aws-properties-servicediscovery-service-dnsrecord-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-servicediscovery-service-dnsrecord-syntax.json"></a>

```
{
  "[TTL](#cfn-servicediscovery-service-dnsrecord-ttl)" : Number,
  "[Type](#cfn-servicediscovery-service-dnsrecord-type)" : String
}
```

### YAML
<a name="aws-properties-servicediscovery-service-dnsrecord-syntax.yaml"></a>

```
  [TTL](#cfn-servicediscovery-service-dnsrecord-ttl): Number
  [Type](#cfn-servicediscovery-service-dnsrecord-type): String
```

## Properties
<a name="aws-properties-servicediscovery-service-dnsrecord-properties"></a>

`TTL`  <a name="cfn-servicediscovery-service-dnsrecord-ttl"></a>
The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.  
Alias records don't include a TTL because Route 53 uses the TTL for the AWS resource that an alias record routes traffic to. If you include the `AWS_ALIAS_DNS_NAME` attribute when you submit a [RegisterInstance](https://docs.aws.amazon.com/cloud-map/latest/api/API_RegisterInstance.html) request, the `TTL` value is ignored. Always specify a TTL for the service; you can use a service to register instances that create either alias or non-alias records.
*Required*: Yes  
*Type*: Number  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Type`  <a name="cfn-servicediscovery-service-dnsrecord-type"></a>
The type of the resource, which indicates the type of value that Route 53 returns in response to DNS queries. You can specify values for `Type` in the following combinations:  
+  `A` 
+  `AAAA` 
+ `A` and `AAAA`
+  `SRV` 
+  `CNAME` 
If you want AWS Cloud Map to create a Route 53 alias record when you register an instance, specify `A` or `AAAA` for `Type`.  
You specify other settings, such as the IP address for `A` and `AAAA` records, when you register an instance. For more information, see [RegisterInstance](https://docs.aws.amazon.com/cloud-map/latest/api/API_RegisterInstance.html).  
The following values are supported:    
A  
Route 53 returns the IP address of the resource in IPv4 format, such as 192.0.2.44.  
AAAA  
Route 53 returns the IP address of the resource in IPv6 format, such as 2001:0db8:85a3:0000:0000:abcd:0001:2345.  
CNAME  
Route 53 returns the domain name of the resource, such as www.example.com. Note the following:  
+ You specify the domain name that you want to route traffic to when you register an instance. For more information, see [Attributes](https://docs.aws.amazon.com/cloud-map/latest/api/API_RegisterInstance.html#cloudmap-RegisterInstance-request-Attributes) in the topic [RegisterInstance](https://docs.aws.amazon.com/cloud-map/latest/api/API_RegisterInstance.html).
+ You must specify `WEIGHTED` for the value of `RoutingPolicy`.
+ You can't specify both `CNAME` for `Type` and settings for `HealthCheckConfig`. If you do, the request will fail with an `InvalidInput` error.  
SRV  
Route 53 returns the value for an `SRV` record. The value for an `SRV` record uses the following values:  
 `priority weight port service-hostname`   
Note the following about the values:  
+ The values of `priority` and `weight` are both set to `1` and can't be changed. 
+ The value of `port` comes from the value that you specify for the `AWS_INSTANCE_PORT` attribute when you submit a [RegisterInstance](https://docs.aws.amazon.com/cloud-map/latest/api/API_RegisterInstance.html) request. 
+ The value of `service-hostname` is a concatenation of the following values:
  + The value that you specify for `InstanceId` when you register an instance.
  + The name of the service.
  + The name of the namespace. 

  For example, if the value of `InstanceId` is `test`, the name of the service is `backend`, and the name of the namespace is `example.com`, the value of `service-hostname` is:

   `test.backend.example.com` 
If you specify settings for an `SRV` record and if you specify values for `AWS_INSTANCE_IPV4`, `AWS_INSTANCE_IPV6`, or both in the `RegisterInstance` request, AWS Cloud Map automatically creates `A` and/or `AAAA` records that have the same name as the value of `service-hostname` in the `SRV` record. You can ignore these records.
*Required*: Yes  
*Type*: String  
*Allowed values*: `SRV | A | AAAA | CNAME`  
*Update requires*: Updates are not supported.

## See also
<a name="aws-properties-servicediscovery-service-dnsrecord--seealso"></a>
+ [Return values](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html#aws-resource-servicediscovery-service-return-values) in the topic [AWS::ServiceDiscovery::Service](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html)
+ [DnsRecord](https://docs.aws.amazon.com/cloud-map/latest/api/API_DnsRecord.html) in the *AWS Cloud Map API Reference*



# AWS::ServiceDiscovery::Service HealthCheckConfig
<a name="aws-properties-servicediscovery-service-healthcheckconfig"></a>

*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`.

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

Health checks are basic Route 53 health checks that monitor an AWS endpoint. For information about pricing for health checks, see [Amazon Route 53 Pricing](https://aws.amazon.com/route53/pricing/).

Note the following about configuring health checks.

A and AAAA records  
If `DnsConfig` includes configurations for both `A` and `AAAA` records, AWS Cloud Map creates a health check that uses the IPv4 address to check the health of the resource. If the endpoint tthat's specified by the IPv4 address is unhealthy, Route 53 considers both the `A` and `AAAA` records to be unhealthy. 

CNAME records  
You can't specify settings for `HealthCheckConfig` when the `DNSConfig` includes `CNAME` for the value of `Type`. If you do, the `CreateService` request will fail with an `InvalidInput` error.

Request interval  
A Route 53 health checker in each health-checking AWS Region sends a health check request to an endpoint every 30 seconds. On average, your endpoint receives a health check request about every two seconds. However, health checkers don't coordinate with one another. Therefore, you might sometimes see several requests in one second that's followed by a few seconds with no health checks at all.

Health checking regions  
Health checkers perform checks from all Route 53 health-checking Regions. For a list of the current Regions, see [Regions](https://docs.aws.amazon.com/Route53/latest/APIReference/API_HealthCheckConfig.html#Route53-Type-HealthCheckConfig-Regions).

Alias records  
When you register an instance, if you include the `AWS_ALIAS_DNS_NAME` attribute, AWS Cloud Map creates a Route 53 alias record. Note the following:  
+ Route 53 automatically sets `EvaluateTargetHealth` to true for alias records. When `EvaluateTargetHealth` is true, the alias record inherits the health of the referenced AWS resource. such as an ELB load balancer. For more information, see [EvaluateTargetHealth](https://docs.aws.amazon.com/Route53/latest/APIReference/API_AliasTarget.html#Route53-Type-AliasTarget-EvaluateTargetHealth).
+ If you include `HealthCheckConfig` and then use the service to register an instance that creates an alias record, Route 53 doesn't create the health check.

Charges for health checks  
Health checks are basic Route 53 health checks that monitor an AWS endpoint. For information about pricing for health checks, see [Amazon Route 53 Pricing](https://aws.amazon.com/route53/pricing/).

## Syntax
<a name="aws-properties-servicediscovery-service-healthcheckconfig-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-servicediscovery-service-healthcheckconfig-syntax.json"></a>

```
{
  "[FailureThreshold](#cfn-servicediscovery-service-healthcheckconfig-failurethreshold)" : Number,
  "[ResourcePath](#cfn-servicediscovery-service-healthcheckconfig-resourcepath)" : String,
  "[Type](#cfn-servicediscovery-service-healthcheckconfig-type)" : String
}
```

### YAML
<a name="aws-properties-servicediscovery-service-healthcheckconfig-syntax.yaml"></a>

```
  [FailureThreshold](#cfn-servicediscovery-service-healthcheckconfig-failurethreshold): Number
  [ResourcePath](#cfn-servicediscovery-service-healthcheckconfig-resourcepath): String
  [Type](#cfn-servicediscovery-service-healthcheckconfig-type): String
```

## Properties
<a name="aws-properties-servicediscovery-service-healthcheckconfig-properties"></a>

`FailureThreshold`  <a name="cfn-servicediscovery-service-healthcheckconfig-failurethreshold"></a>
The number of consecutive health checks that an endpoint must pass or fail for Route 53 to change the current status of the endpoint from unhealthy to healthy or the other way around. For more information, see [How Route 53 Determines Whether an Endpoint Is Healthy](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html) in the *Route 53 Developer Guide*.  
*Required*: No  
*Type*: Number  
*Minimum*: `1`  
*Maximum*: `10`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ResourcePath`  <a name="cfn-servicediscovery-service-healthcheckconfig-resourcepath"></a>
The path that you want Route 53 to request when performing health checks. The path can be any value that your endpoint returns an HTTP status code of a 2xx or 3xx format for when the endpoint is healthy. An example file is `/docs/route53-health-check.html`. Route 53 automatically adds the DNS name for the service. If you don't specify a value for `ResourcePath`, the default value is `/`.  
If you specify `TCP` for `Type`, you must *not* specify a value for `ResourcePath`.  
*Required*: No  
*Type*: String  
*Maximum*: `255`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Type`  <a name="cfn-servicediscovery-service-healthcheckconfig-type"></a>
The type of health check that you want to create, which indicates how Route 53 determines whether an endpoint is healthy.  
You can't change the value of `Type` after you create a health check.
You can create the following types of health checks:  
+ **HTTP**: Route 53 tries to establish a TCP connection. If successful, Route 53 submits an HTTP request and waits for an HTTP status code of 200 or greater and less than 400.
+ **HTTPS**: Route 53 tries to establish a TCP connection. If successful, Route 53 submits an HTTPS request and waits for an HTTP status code of 200 or greater and less than 400.
**Important**  
If you specify HTTPS for the value of `Type`, the endpoint must support TLS v1.0 or later.
+ **TCP**: Route 53 tries to establish a TCP connection.

  If you specify `TCP` for `Type`, don't specify a value for `ResourcePath`.
For more information, see [How Route 53 Determines Whether an Endpoint Is Healthy](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html) in the *Route 53 Developer Guide*.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `HTTP | HTTPS | TCP`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## See also
<a name="aws-properties-servicediscovery-service-healthcheckconfig--seealso"></a>
+ [Return values](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html#aws-resource-servicediscovery-service-return-values) in the topic [AWS::ServiceDiscovery::Service](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html)
+ [HealthCheckConfig](https://docs.aws.amazon.com/cloud-map/latest/api/API_HealthCheckConfig.html) in the * AWS Cloud Map API Reference *



# AWS::ServiceDiscovery::Service HealthCheckCustomConfig
<a name="aws-properties-servicediscovery-service-healthcheckcustomconfig"></a>

A complex type that contains information about an optional custom health check. A custom health check, which requires that you use a third-party health checker to evaluate the health of your resources, is useful in the following circumstances:
+ You can't use a health check that's defined by `HealthCheckConfig` because the resource isn't available over the internet. For example, you can use a custom health check when the instance is in an Amazon VPC. (To check the health of resources in a VPC, the health checker must also be in the VPC.)
+ You want to use a third-party health checker regardless of where your resources are located.

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

To change the status of a custom health check, submit an `UpdateInstanceCustomHealthStatus` request. AWS Cloud Map doesn't monitor the status of the resource, it just keeps a record of the status specified in the most recent `UpdateInstanceCustomHealthStatus` request.

Here's how custom health checks work:

1. You create a service.

1. You register an instance.

1. You configure a third-party health checker to monitor the resource that's associated with the new instance. 
**Note**  
AWS Cloud Map doesn't check the health of the resource directly. 

1. The third-party health-checker determines that the resource is unhealthy and notifies your application.

1. Your application submits an `UpdateInstanceCustomHealthStatus` request.

1. AWS Cloud Map waits for 30 seconds.

1. If another `UpdateInstanceCustomHealthStatus` request doesn't arrive during that time to change the status back to healthy, AWS Cloud Map stops routing traffic to the resource.

## Syntax
<a name="aws-properties-servicediscovery-service-healthcheckcustomconfig-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-servicediscovery-service-healthcheckcustomconfig-syntax.json"></a>

```
{
  "[FailureThreshold](#cfn-servicediscovery-service-healthcheckcustomconfig-failurethreshold)" : Number
}
```

### YAML
<a name="aws-properties-servicediscovery-service-healthcheckcustomconfig-syntax.yaml"></a>

```
  [FailureThreshold](#cfn-servicediscovery-service-healthcheckcustomconfig-failurethreshold): Number
```

## Properties
<a name="aws-properties-servicediscovery-service-healthcheckcustomconfig-properties"></a>

`FailureThreshold`  <a name="cfn-servicediscovery-service-healthcheckcustomconfig-failurethreshold"></a>
This parameter is no longer supported and is always set to 1. AWS Cloud Map waits for approximately 30 seconds after receiving an `UpdateInstanceCustomHealthStatus` request before changing the status of the service instance.
The number of 30-second intervals that you want AWS Cloud Map to wait after receiving an `UpdateInstanceCustomHealthStatus` request before it changes the health status of a service instance.  
Sending a second or subsequent `UpdateInstanceCustomHealthStatus` request with the same value before 30 seconds has passed doesn't accelerate the change. AWS Cloud Map still waits `30` seconds after the first request to make the change.  
*Required*: No  
*Type*: Number  
*Minimum*: `1`  
*Maximum*: `10`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-servicediscovery-service-healthcheckcustomconfig--seealso"></a>
+ [Return values](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html#aws-resource-servicediscovery-service-return-values) in the topic [AWS::ServiceDiscovery::Service](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicediscovery-service.html)
+ [HealthCheckCustomConfig](https://docs.aws.amazon.com/cloud-map/latest/api/API_HealthCheckCustomConfig.html) in the * AWS Cloud Map API Reference *



# AWS::ServiceDiscovery::Service Tag
<a name="aws-properties-servicediscovery-service-tag"></a>

A custom key-value pair that's associated with a resource.

## Syntax
<a name="aws-properties-servicediscovery-service-tag-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-servicediscovery-service-tag-syntax.json"></a>

```
{
  "[Key](#cfn-servicediscovery-service-tag-key)" : String,
  "[Value](#cfn-servicediscovery-service-tag-value)" : String
}
```

### YAML
<a name="aws-properties-servicediscovery-service-tag-syntax.yaml"></a>

```
  [Key](#cfn-servicediscovery-service-tag-key): String
  [Value](#cfn-servicediscovery-service-tag-value): String
```

## Properties
<a name="aws-properties-servicediscovery-service-tag-properties"></a>

`Key`  <a name="cfn-servicediscovery-service-tag-key"></a>
The key identifier, or name, of the tag.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Value`  <a name="cfn-servicediscovery-service-tag-value"></a>
The string value that's associated with the key of the tag. You can set the value of a tag to an empty string, but you can't set the value of a tag to null.  
*Required*: Yes  
*Type*: String  
*Minimum*: `0`  
*Maximum*: `256`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)