Menu
Amazon Route 53
API Reference

CreateService

Creates a service, which defines the configuration for the following entities:

  • Up to three records (A, AAAA, and SRV) or one CNAME record

  • Optionally, a health check

After you create the service, you can submit a RegisterInstance request, and Amazon Route 53 uses the values in the configuration to create the specified entities.

For the current limit on the number of instances that you can register using the same namespace and using the same service, see Limits on Auto Naming in the Route 53 Developer Guide.

Request Syntax

{ "CreatorRequestId": "string", "Description": "string", "DnsConfig": { "DnsRecords": [ { "TTL": number, "Type": "string" } ], "NamespaceId": "string", "RoutingPolicy": "string" }, "HealthCheckConfig": { "FailureThreshold": number, "ResourcePath": "string", "Type": "string" }, "HealthCheckCustomConfig": { "FailureThreshold": number }, "Name": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

CreatorRequestId

A unique string that identifies the request and that allows failed CreateService requests to be retried without the risk of executing the operation twice. CreatorRequestId can be any unique string, for example, a date/time stamp.

Type: String

Length Constraints: Maximum length of 64.

Required: No

Description

A description for the service.

Type: String

Length Constraints: Maximum length of 1024.

Required: No

DnsConfig

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

Type: DnsConfig object

Required: Yes

HealthCheckConfig

Public DNS namespaces only. A complex type that contains settings for an optional Route 53 health check. If you specify settings for a health check, Route 53 associates the health check with all 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.

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

Type: HealthCheckConfig object

Required: No

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.

Type: HealthCheckCustomConfig object

Required: No

Name

The name that you want to assign to the service.

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]))*$)|(^\.$)

Required: Yes

Response Syntax

{ "Service": { "Arn": "string", "CreateDate": number, "CreatorRequestId": "string", "Description": "string", "DnsConfig": { "DnsRecords": [ { "TTL": number, "Type": "string" } ], "NamespaceId": "string", "RoutingPolicy": "string" }, "HealthCheckConfig": { "FailureThreshold": number, "ResourcePath": "string", "Type": "string" }, "HealthCheckCustomConfig": { "FailureThreshold": number }, "Id": "string", "InstanceCount": number, "Name": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Service

A complex type that contains information about the new service.

Type: Service object

Errors

For information about the errors that are common to all actions, see Common Errors.

InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400

NamespaceNotFound

No namespace exists with the specified ID.

HTTP Status Code: 400

ResourceLimitExceeded

The resource can't be created because you've reached the limit on the number of resources.

HTTP Status Code: 400

ServiceAlreadyExists

The service can't be created because a service with the same name already exists.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: