AWS CloudFormation
User Guide (Version )

AWS::ServiceDiscovery::Service

A complex type that contains information about a service, which defines the configuration of the following entities:

  • For public and private DNS namespaces, one of the following combinations of DNS records in Amazon Route 53:

    • A

    • AAAA

    • A and AAAA

    • SRV

    • CNAME

  • Optionally, a health check

Syntax

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

JSON

{ "Type" : "AWS::ServiceDiscovery::Service", "Properties" : { "Description" : String, "DnsConfig" : DnsConfig, "HealthCheckConfig" : HealthCheckConfig, "HealthCheckCustomConfig" : HealthCheckCustomConfig, "Name" : String, "NamespaceId" : String } }

YAML

Type: AWS::ServiceDiscovery::Service Properties: Description: String DnsConfig: DnsConfig HealthCheckConfig: HealthCheckConfig HealthCheckCustomConfig: HealthCheckCustomConfig Name: String NamespaceId: String

Properties

Description

The description of the service.

Required: No

Type: String

Maximum: 1024

Update requires: No interruption

DnsConfig

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.

Required: No

Type: DnsConfig

Update requires: No interruption

HealthCheckConfig

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.

Required: No

Type: HealthCheckConfig

Update requires: No interruption

HealthCheckCustomConfig

A complex type that contains information about an optional custom health check.

Important

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

Required: No

Type: HealthCheckCustomConfig

Update requires: Replacement

Name

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

NamespaceId

The ID of the namespace that was used to create the service.

Required: No

Type: String

Maximum: 64

Update requires: Replacement

Return Values

Ref

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 Ref.

Fn::GetAtt

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 Fn::GetAtt.

Arn

The Amazon Resource Name (ARN) of the service.

Id

The ID of the service.

Name

The name that you assigned to the service.

Examples

Create a service

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

{ "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

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

See Also