# CfnService

The `AWS::ECS::Service` resource creates an Amazon Elastic Container Service (Amazon ECS) service that runs and maintains the requested number of tasks and associated load balancers.

> The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect `ServiceConnectConfiguration` property is configured. This is because AWS CloudFormation creates the replacement service first, but each `ServiceConnectService` must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior for `CapacityProviderStrategy` parameter with the standard practice. For more information, see [Amazon ECS adds support for updating capacity provider configuration for ECS services](https://docs.aws.amazon.com/about-aws/whats-new/2025/05/amazon-ecs-capacity-provider-configuration-ecs/) . Previously Amazon ECS ignored the `CapacityProviderStrategy` property if it was set to an empty list for example, `[]` in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ( `[]` ) for the `CapacityProviderStrategy` property in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
>
> - For services created with a capacity provider strategy after the launch:
>
> - If there's a cluster default strategy set, the service will revert to using that default strategy.
> - If no cluster default strategy exists, you will receive the following error:
>
> No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
> - For services created with a capacity provider strategy prior to the launch:
>
> - If `CapacityProviderStrategy` had `FARGATE_SPOT` or `FARGATE` capacity providers, the launch type will be updated to `FARGATE` and the capacity provider will be removed.
> - If the strategy included Auto Scaling group capacity providers, the service will revert to EC2 launch type, and the Auto Scaling group capacity providers will not be used.
>
> Recommended Actions
>
> If you are currently using `CapacityProviderStrategy: []` in your CloudFormation templates, you should take one of the following actions:
>
> - If you do not intend to update the Capacity Provider Strategy:
>
> - Remove the `CapacityProviderStrategy` property entirely from your CloudFormation template
> - Alternatively, use `!Ref AWS ::NoValue` for the `CapacityProviderStrategy` property in your template
> - If you intend to maintain or update the Capacity Provider Strategy, specify the actual Capacity Provider Strategy for the service in your CloudFormation template.
>
> If your CloudFormation template had an empty list ([]) for `CapacityProviderStrategy` prior to the aforementioned launch on June 12, and you are using the same template with `CapacityProviderStrategy: []` , you might encounter the following error:
>
> Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
>
> Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
>
> If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.

Extends: Construct › CfnElement › CfnRefElement › CfnResource › CfnService
Implements: IInspectable, ITaggable, IEnvironmentAware, IServiceRef, IConstruct, IDependable

- CloudFormation: [`AWS::ECS::Service`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ecs-service.html)
- Source: Generated code
- Type last changed: v2.261.0 · 2 Jul 2026

## Example

```ts
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const miCapacityProvider: ecs.ManagedInstancesCapacityProvider;

const service = new ecs.FargateService(this, 'Service', {
  cluster,
  taskDefinition,
  capacityProviderStrategies: [
    {
      capacityProvider: miCapacityProvider.capacityProviderName,
      weight: 1,
    },
  ],
});

// Escape hatch: Force launchType at the CloudFormation level to prevent service replacement
const cfnService = service.node.defaultChild as ecs.CfnService;
cfnService.launchType = 'FARGATE'; // or 'FARGATE_SPOT' depending on your capacity provider
```

## Initializer

```ts
new CfnService(scope: Construct, id: string, props?: CfnServiceProps)
```

## Construct Props

- `availabilityZoneRebalancing`: string = "ENABLED" — Indicates whether to use Availability Zone rebalancing for the service.

  For more information, see [Balancing an Amazon ECS service across Availability Zones](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html) in the **Amazon Elastic Container Service Developer Guide** .

  The default behavior of `AvailabilityZoneRebalancing` differs between create and update requests:

  - For create service requests, when no value is specified for `AvailabilityZoneRebalancing` , Amazon ECS defaults the value to `ENABLED` .
  - For update service requests, when no value is specified for `AvailabilityZoneRebalancing` , Amazon ECS defaults to the existing service’s `AvailabilityZoneRebalancing` value. If the service never had an `AvailabilityZoneRebalancing` value set, Amazon ECS treats this as `DISABLED` .

- `capacityProviderStrategy`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.CapacityProviderStrategyItemProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.CapacityProviderStrategyItemProperty.html)[] — The capacity provider strategy to use for the service.

  If a `capacityProviderStrategy` is specified, the `launchType` parameter must be omitted. If no `capacityProviderStrategy` or `launchType` is specified, the `defaultCapacityProviderStrategy` for the cluster is used.

  A capacity provider strategy can contain a maximum of 20 capacity providers.

  > To remove this property from your service resource, specify an empty `CapacityProviderStrategyItem` array.

- `cluster`: string | [IClusterRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ecs.IClusterRef.html) — The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on.

  If you do not specify a cluster, the default cluster is assumed.

- `deploymentConfiguration`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.DeploymentConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.DeploymentConfigurationProperty.html) — Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.

- `deploymentController`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.DeploymentControllerProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.DeploymentControllerProperty.html) — The deployment controller to use for the service.

- `desiredCount`: number — The number of instantiations of the specified task definition to place and keep running in your service.

  For new services, if a desired count is not specified, a default value of `1` is used. When using the `DAEMON` scheduling strategy, the desired count is not required.

  For existing services, if a desired count is not specified, it is omitted from the operation.

- `enableEcsManagedTags`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Specifies whether to turn on Amazon ECS managed tags for the tasks within the service.

  For more information, see [Tagging your Amazon ECS resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) in the *Amazon Elastic Container Service Developer Guide* .

  When you use Amazon ECS managed tags, you must set the `propagateTags` request parameter.

- `enableExecuteCommand`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Determines whether the execute command functionality is turned on for the service.

  If `true` , the execute command functionality is turned on for all containers in tasks as part of the service.

- `forceNewDeployment`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ForceNewDeploymentProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ForceNewDeploymentProperty.html) — Determines whether to force a new deployment of the service.

  By default, deployments aren't forced. You can use this option to start a new deployment with no service definition changes. For example, you can update a service's tasks to use a newer Docker image with the same image/tag combination ( `my_image:latest` ) or to roll Fargate tasks onto a newer platform version.

- `healthCheckGracePeriodSeconds`: number — The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a task has first started.

  If you do not specify a health check grace period value, the default value of 0 is used. If you do not use any of the health checks, then `healthCheckGracePeriodSeconds` is unused.

  If your service has more running tasks than desired, unhealthy tasks in the grace period might be stopped to reach the desired count.

- `launchType`: string — The launch type on which to run your service.

  For more information, see [Amazon ECS Launch Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) in the *Amazon Elastic Container Service Developer Guide* .

  > If you want to use Managed Instances, you must use the `capacityProviderStrategy` request parameter

- `loadBalancers`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.LoadBalancerProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.LoadBalancerProperty.html)[] — A list of load balancer objects to associate with the service.

  If you specify the `Role` property, `LoadBalancers` must be specified as well. For information about the number of load balancers that you can specify per service, see [Service Load Balancing](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html) in the *Amazon Elastic Container Service Developer Guide* .

  > To remove this property from your service resource, specify an empty `LoadBalancer` array.

- `monitoring`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.MonitoringConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.MonitoringConfigurationProperty.html) — The optional monitoring configuration for a service, which defines the resolution for the service-level ``CPUUtilization`` and ``MemoryUtilization`` Amazon CloudWatch metrics.

  When not specified, Amazon ECS uses the default resolution of ``60`` seconds.

- `networkConfiguration`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.NetworkConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.NetworkConfigurationProperty.html) — The network configuration for the service.

  This parameter is required for task definitions that use the `awsvpc` network mode to receive their own elastic network interface, and it is not supported for other network modes. For more information, see [Task Networking](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html) in the *Amazon Elastic Container Service Developer Guide* .

- `placementConstraints`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.PlacementConstraintProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.PlacementConstraintProperty.html)[] — An array of placement constraint objects to use for tasks in your service.

  You can specify a maximum of 10 constraints for each task. This limit includes constraints in the task definition and those specified at runtime.

  > To remove this property from your service resource, specify an empty `PlacementConstraint` array.

- `placementStrategies`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.PlacementStrategyProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.PlacementStrategyProperty.html)[] — The placement strategy objects to use for tasks in your service.

  You can specify a maximum of 5 strategy rules for each service.

  > To remove this property from your service resource, specify an empty `PlacementStrategy` array.

- `platformVersion`: string = "LATEST" — The platform version that your tasks in the service are running on.

  A platform version is specified only for tasks using the Fargate launch type. If one isn't specified, the `LATEST` platform version is used. For more information, see [AWS Fargate platform versions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) in the *Amazon Elastic Container Service Developer Guide* .

- `propagateTags`: string — Specifies whether to propagate the tags from the task definition to the task.

  If no value is specified, the tags aren't propagated. Tags can only be propagated to the task during task creation. To add tags to a task after task creation, use the [TagResource](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TagResource.html) API action.

  You must set this to a value other than `NONE` when you use Cost Explorer. For more information, see [Amazon ECS usage reports](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/usage-reports.html) in the *Amazon Elastic Container Service Developer Guide* .

  The default is `NONE` .

- `role`: string | [IRoleRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_iam.IRoleRef.html) — The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf.

  This parameter is only permitted if you are using a load balancer with your service and your task definition doesn't use the `awsvpc` network mode. If you specify the `role` parameter, you must also specify a load balancer object with the `loadBalancers` parameter.

  > If your account has already created the Amazon ECS service-linked role, that role is used for your service unless you specify a role here. The service-linked role is required if your task definition uses the `awsvpc` network mode or if the service is configured to use service discovery, an external deployment controller, multiple target groups, or Elastic Inference accelerators in which case you don't specify a role here. For more information, see [Using service-linked roles for Amazon ECS](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using-service-linked-roles.html) in the *Amazon Elastic Container Service Developer Guide* .

  If your specified role has a path other than `/` , then you must either specify the full role ARN (this is recommended) or prefix the role name with the path. For example, if a role with the name `bar` has a path of `/foo/` then you would specify `/foo/bar` as the role name. For more information, see [Friendly names and paths](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-friendly-names) in the *IAM User Guide* .

- `schedulingStrategy`: string — The scheduling strategy to use for the service. For more information, see [Services](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html) .

  There are two service scheduler strategies available:

  - `REPLICA` -The replica scheduling strategy places and maintains the desired number of tasks across your cluster. By default, the service scheduler spreads tasks across Availability Zones. You can use task placement strategies and constraints to customize task placement decisions. This scheduler strategy is required if the service uses the `CODE_DEPLOY` or `EXTERNAL` deployment controller types.
  - `DAEMON` -The daemon scheduling strategy deploys exactly one task on each active container instance that meets all of the task placement constraints that you specify in your cluster. The service scheduler also evaluates the task placement constraints for running tasks and will stop tasks that don't meet the placement constraints. When you're using this strategy, you don't need to specify a desired number of tasks, a task placement strategy, or use Service Auto Scaling policies.

  > Tasks using the Fargate launch type or the `CODE_DEPLOY` or `EXTERNAL` deployment controller types don't support the `DAEMON` scheduling strategy.

- `serviceConnectConfiguration`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ServiceConnectConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ServiceConnectConfigurationProperty.html) — The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace.

  Tasks that run in a namespace can use short names to connect to services in the namespace. Tasks can connect to services across all of the clusters in the namespace. Tasks connect through a managed proxy container that collects logs and metrics for increased visibility. Only the tasks that Amazon ECS services create are supported with Service Connect. For more information, see [Service Connect](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect.html) in the *Amazon Elastic Container Service Developer Guide* .

- `serviceName`: string — The name of your service.

  Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a Region or across multiple Regions.

  > The stack update fails if you change any properties that require replacement and the `ServiceName` is configured. This is because AWS CloudFormation creates the replacement service first, but each `ServiceName` must be unique in the cluster.

- `serviceRegistries`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ServiceRegistryProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ServiceRegistryProperty.html)[] — The details of the service discovery registry to associate with this service. For more information, see [Service discovery](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html) .

  > Each service may be associated with one service registry. Multiple service registries for each service isn't supported. > To remove this property from your service resource, specify an empty `ServiceRegistry` array.

- `tags`: [CfnTag](/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — The metadata that you apply to the service to help you categorize and organize them.

  Each tag consists of a key and an optional value, both of which you define. When a service is deleted, the tags are deleted as well.

  The following basic restrictions apply to tags:

  - Maximum number of tags per resource - 50
  - For each resource, each tag key must be unique, and each tag key can have only one value.
  - Maximum key length - 128 Unicode characters in UTF-8
  - Maximum value length - 256 Unicode characters in UTF-8
  - If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : /

- `taskDefinition`: string | [ITaskDefinitionRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ecs.ITaskDefinitionRef.html) — The `family` and `revision` ( `family:revision` ) or full ARN of the task definition to run in your service.

  If a `revision` isn't specified, the latest `ACTIVE` revision is used.

  A task definition must be specified if the service uses either the `ECS` or `CODE_DEPLOY` deployment controllers.

  For more information about deployment types, see [Amazon ECS deployment types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) .

- `volumeConfigurations`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ServiceVolumeConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ServiceVolumeConfigurationProperty.html)[] — The configuration for a volume specified in the task definition as a volume that is configured at launch time.

  Currently, the only supported volume type is an Amazon EBS volume.

  > To remove this property from your service resource, specify an empty `ServiceVolumeConfiguration` array.

- `vpcLatticeConfigurations`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.VpcLatticeConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.VpcLatticeConfigurationProperty.html)[] — The VPC Lattice configuration for the service being created.

## Properties

- `attrName`: string (required) — The name of the Amazon ECS service, such as `sample-webapp` .

- `attrServiceArn`: string (required) — The ARN that identifies the service.

  For more information about the ARN format, see [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids) in the *Amazon ECS Developer Guide* .

- `availabilityZoneRebalancing`: string — Indicates whether to use Availability Zone rebalancing for the service.

- `capacityProviderStrategy`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.CapacityProviderStrategyItemProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.CapacityProviderStrategyItemProperty.html)[] — The capacity provider strategy to use for the service.

- `CFN_RESOURCE_TYPE_NAME`: string (required) (static) — The CloudFormation resource type name for this resource class.

- `cfnOptions`: [ICfnResourceOptions](/cdk/api/v2/docs/aws-cdk-lib.ICfnResourceOptions.html) (required) — Options for this resource, such as condition, update policy etc.

- `cfnResourceType`: string (required) — AWS resource type.

- `cluster`: string — The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on.

- `creationStack`: string[] (required)

- `deploymentConfiguration`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.DeploymentConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.DeploymentConfigurationProperty.html) — Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.

- `deploymentController`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.DeploymentControllerProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.DeploymentControllerProperty.html) — The deployment controller to use for the service.

- `desiredCount`: number — The number of instantiations of the specified task definition to place and keep running in your service.

- `enableEcsManagedTags`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Specifies whether to turn on Amazon ECS managed tags for the tasks within the service.

- `enableExecuteCommand`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Determines whether the execute command functionality is turned on for the service.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) (required)

- `forceNewDeployment`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ForceNewDeploymentProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ForceNewDeploymentProperty.html) — Determines whether to force a new deployment of the service.

- `healthCheckGracePeriodSeconds`: number — The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing, VPC Lattice, and container health checks after a task has first started.

- `launchType`: string — The launch type on which to run your service.

- `loadBalancers`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.LoadBalancerProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.LoadBalancerProperty.html)[] — A list of load balancer objects to associate with the service.

- `logicalId`: string (required) — The logical ID for this CloudFormation stack element.

  The logical ID of the element
  is calculated from the path of the resource node in the construct tree.

  To override this value, use `overrideLogicalId(newLogicalId)`.

- `monitoring`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.MonitoringConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.MonitoringConfigurationProperty.html) — The optional monitoring configuration for a service, which defines the resolution for the service-level ``CPUUtilization`` and ``MemoryUtilization`` Amazon CloudWatch metrics.

- `networkConfiguration`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.NetworkConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.NetworkConfigurationProperty.html) — The network configuration for the service.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) (required) — The tree node.

- `placementConstraints`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.PlacementConstraintProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.PlacementConstraintProperty.html)[] — An array of placement constraint objects to use for tasks in your service.

- `placementStrategies`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.PlacementStrategyProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.PlacementStrategyProperty.html)[] — The placement strategy objects to use for tasks in your service.

- `platformVersion`: string — The platform version that your tasks in the service are running on.

- `propagateTags`: string — Specifies whether to propagate the tags from the task definition to the task.

- `ref`: string (required) — Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.

  If, by any chance, the intrinsic reference of a resource is not a string, you could
  coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`.

- `role`: string — The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf.

- `schedulingStrategy`: string — The scheduling strategy to use for the service.

  For more information, see [Services](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html) .

- `serviceConnectConfiguration`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ServiceConnectConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ServiceConnectConfigurationProperty.html) — The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace.

- `serviceName`: string — The name of your service.

- `serviceRef`: [ServiceReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_ecs.ServiceReference.html) (required) — A reference to a Service resource.

- `serviceRegistries`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ServiceRegistryProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ServiceRegistryProperty.html)[] — The details of the service discovery registry to associate with this service.

  For more information, see [Service discovery](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html) .

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) (required) — The stack in which this element is defined.

  CfnElements must be defined within a stack scope (directly or indirectly).

- `tags`: [TagManager](/cdk/api/v2/docs/aws-cdk-lib.TagManager.html) (required) — Tag Manager which manages the tags for this resource.

- `tagsRaw`: [CfnTag](/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — The metadata that you apply to the service to help you categorize and organize them.

- `taskDefinition`: string — The `family` and `revision` ( `family:revision` ) or full ARN of the task definition to run in your service.

- `volumeConfigurations`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.ServiceVolumeConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ServiceVolumeConfigurationProperty.html)[] — The configuration for a volume specified in the task definition as a volume that is configured at launch time.

- `vpcLatticeConfigurations`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnService.VpcLatticeConfigurationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.VpcLatticeConfigurationProperty.html)[] — The VPC Lattice configuration for the service being created.

## Methods

- `addDeletionOverride(path: string): void` — Syntactic sugar for `addOverride(path, undefined)`.

  **Parameters**

  - `path` — The path of the value to delete.

- `addDependency(target: CfnResource): void` — Use `addResourceDependency` instead.

  This method has been renamed to `addResourceDependency` to more clearly
  set it apart from `construct.node.addDependency`. See the documentation
  of that function for more details.

- `addDependsOn(target: CfnResource): void` — Use `addResourceDependency` instead.

  This can be used for resources across stacks (or nested stack) boundaries
  and the dependency will automatically be transferred to the relevant scope.

  This method has been renamed to `addResourceDependency`, which makes it
  more clear that this method operates at a different level from the
  construct-level `construct.node.addDependency()` mechanism.

- `addMetadata(key: string, value: any): void` — Add a value to the CloudFormation Resource Metadata.

- `addOverride(path: string, value: any): void` — Adds an override to the synthesized CloudFormation resource.

  To add a
  property override, either use `addPropertyOverride` or prefix `path` with
  "Properties." (i.e. `Properties.TopicName`).

  If the override is nested, separate each nested level using a dot (.) in the path parameter.
  If there is an array as part of the nesting, specify the index in the path.

  To include a literal `.` in the property name, prefix with a `\`. In most
  programming languages you will need to write this as `"\\."` because the
  `\` itself will need to be escaped.

  For example,
  ```typescript
  cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
  cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
  ```
  would add the overrides
  ```json
  "Properties": {
    "GlobalSecondaryIndexes": [
      {
        "Projection": {
          "NonKeyAttributes": [ "myattribute" ]
          ...
        }
        ...
      },
      {
        "ProjectionType": "INCLUDE"
        ...
      },
    ]
    ...
  }
  ```

  The `value` argument to `addOverride` will not be processed or translated
  in any way. Pass raw JSON values in here with the correct capitalization
  for CloudFormation. If you pass CDK classes or structs, they will be
  rendered with lowercased key names, and CloudFormation will reject the
  template.

  **Parameters**

  - `path` — - The path of the property, you can use dot notation to override values in complex types.
  - `value` — - The value.

- `addPropertyDeletionOverride(propertyPath: string): void` — Adds an override that deletes the value of a property from the resource definition.

  **Parameters**

  - `propertyPath` — The path to the property.

- `addPropertyOverride(propertyPath: string, value: any): void` — Adds an override to a resource property.

  Syntactic sugar for `addOverride("Properties.<...>", value)`.

  **Parameters**

  - `propertyPath` — The path of the property.
  - `value` — The value.

- `addResourceDependency(target: CfnResource, reason?: string): void` — Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

  This can be used for resources across stacks (or nested stack) boundaries
  and the dependency will automatically be transferred to the relevant scope.

  This method only adds dependencies between L1 resources. If you are
  looking for a generic construct-to-construct dependency mechanism that works
  for all constructs including L2s, use `construct.node.addDependency` instead.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Sets the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  strength instead of the global default from the consuming stack's context.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void` — Sets the deletion policy of the resource based on the removal policy specified.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some
  cases, a snapshot can be taken of the resource prior to deletion
  (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy
  can be found in the following link:

- `arnForService(resource: IServiceRef): string` (static)

- `cfnPropertyName(cdkPropertyName: string): string`

- `getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Reference` — Returns a token for an runtime attribute of this resource.

  Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility
  in case there is no generated attribute.

  **Parameters**

  - `attributeName` — The name of the attribute.

- `getMetadata(key: string): any` — Retrieve a value value from the CloudFormation Resource Metadata.

- `inspect(inspector: TreeInspector): void` — Examines the CloudFormation resource and discloses attributes.

  **Parameters**

  - `inspector` — tree inspector to collect and process attributes.

- `isCfnElement(x: any): boolean` (static) — Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

  Uses duck-typing instead of `instanceof` to allow stack elements from different
  versions of this library to be included in the same stack.

  **Returns:** The construct as a stack element or undefined if it is not a stack element.

- `isCfnResource(x: any): boolean` (static) — Check whether the given object is a CfnResource.

- `isCfnService(x: any): boolean` (static) — Checks whether the given object is a CfnService.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `obtainDependencies(): Stack | CfnResource[]` — Retrieves an array of resources and stacks this resource depends on.

  For resources depended on directly, returns the `CfnResource` object. For
  dependencies on other stacks, returns the `Stack` object. The order of the
  array is not guaranteed.

- `overrideLogicalId(newLogicalId: string): void` — Overrides the auto-generated logical ID with a specific ID.

  **Parameters**

  - `newLogicalId` — The new logical ID to use for this stack element.

- `removeDependency(target: CfnResource): void` — Use `removeResourceDependency` instead

  This can be used for resources across stacks (including nested stacks)
  and the dependency will automatically be removed from the relevant scope.

- `removeResourceDependency(target: CfnResource): void` — Indicates that this resource no longer depends on another resource.

  This can be used for resources across stacks (including nested stacks)
  and the dependency will automatically be removed from the relevant scope.

- `replaceDependency(target: CfnResource, newTarget: CfnResource): void` — Replaces one dependency with another.

  **Parameters**

  - `target` — The dependency to replace.
  - `newTarget` — The new dependency to add.

- `toString(): string` — Returns a string representation of this construct.

  **Returns:** a string representation of this resource

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
