

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

# AWS::ECS::Service ServiceRegistry
<a name="aws-properties-ecs-service-serviceregistry"></a>

The details for the service registry.

Each service may be associated with one service registry. Multiple service registries for each service are not supported.

When you add, update, or remove the service registries configuration, Amazon ECS starts a new deployment. New tasks are registered and deregistered to the updated service registry configuration.

## Syntax
<a name="aws-properties-ecs-service-serviceregistry-syntax"></a>

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

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

```
{
  "[ContainerName](#cfn-ecs-service-serviceregistry-containername)" : String,
  "[ContainerPort](#cfn-ecs-service-serviceregistry-containerport)" : Integer,
  "[Port](#cfn-ecs-service-serviceregistry-port)" : Integer,
  "[RegistryArn](#cfn-ecs-service-serviceregistry-registryarn)" : String
}
```

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

```
  [ContainerName](#cfn-ecs-service-serviceregistry-containername): String
  [ContainerPort](#cfn-ecs-service-serviceregistry-containerport): Integer
  [Port](#cfn-ecs-service-serviceregistry-port): Integer
  [RegistryArn](#cfn-ecs-service-serviceregistry-registryarn): String
```

## Properties
<a name="aws-properties-ecs-service-serviceregistry-properties"></a>

`ContainerName`  <a name="cfn-ecs-service-serviceregistry-containername"></a>
The container name value to be used for your service discovery service. It's already specified in the task definition. If the task definition that your service task specifies uses the `bridge` or `host` network mode, you must specify a `containerName` and `containerPort` combination from the task definition. If the task definition that your service task specifies uses the `awsvpc` network mode and a type SRV DNS record is used, you must specify either a `containerName` and `containerPort` combination or a `port` value. However, you can't specify both.  
*Required*: No  
*Type*: String  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ContainerPort`  <a name="cfn-ecs-service-serviceregistry-containerport"></a>
The port value to be used for your service discovery service. It's already specified in the task definition. If the task definition your service task specifies uses the `bridge` or `host` network mode, you must specify a `containerName` and `containerPort` combination from the task definition. If the task definition your service task specifies uses the `awsvpc` network mode and a type SRV DNS record is used, you must specify either a `containerName` and `containerPort` combination or a `port` value. However, you can't specify both.  
*Required*: No  
*Type*: Integer  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Port`  <a name="cfn-ecs-service-serviceregistry-port"></a>
The port value used if your service discovery service specified an SRV record. This field might be used if both the `awsvpc` network mode and SRV records are used.  
*Required*: No  
*Type*: Integer  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`RegistryArn`  <a name="cfn-ecs-service-serviceregistry-registryarn"></a>
The Amazon Resource Name (ARN) of the service registry. The currently supported service registry is Amazon Cloud Map. For more information, see [CreateService](https://docs.amazonaws.cn/cloud-map/latest/api/API_CreateService.html).  
*Required*: No  
*Type*: String  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## See also
<a name="aws-properties-ecs-service-serviceregistry--seealso"></a>
+  [Associate an Application Load Balancer with a service](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#aws-resource-ecs-service--examples--Associate_an_Application_Load_Balancer_with_a_service) 