# ApplicationMultipleTargetGroupsServiceBase

The base class for ApplicationMultipleTargetGroupsEc2Service and ApplicationMultipleTargetGroupsFargateService classes.

Extends: Construct › ApplicationMultipleTargetGroupsServiceBase
Implements: IConstruct, IDependable
Superclass of: ApplicationMultipleTargetGroupsEc2Service, ApplicationMultipleTargetGroupsFargateService

- Source: [`aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts#L369)
- Type last changed: v2.37.0 · 9 Aug 2022

## Initializer

```ts
new ApplicationMultipleTargetGroupsServiceBase(scope: Construct, id: string, props?: ApplicationMultipleTargetGroupsServiceBaseProps)
```

## Construct Props

- `cloudMapOptions`: [CloudMapOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CloudMapOptions.html) — The options for configuring an Amazon ECS service to use service discovery.

  **Default:** AWS Cloud Map service discovery is not enabled.

- `cluster`: [ICluster](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ICluster.html) — The name of the cluster that hosts the service.

  **Default:** create a new cluster; if both cluster and vpc are omitted, a new VPC will be created for you.

  If a cluster is specified, the vpc construct should be omitted. Alternatively, you can omit both cluster and vpc.

- `desiredCount`: number — The desired number of instantiations of the task definition to keep running on the service.

  **Default:** The default is 1 for all new services and uses the existing service's desired count when updating an existing service.

- `enableECSManagedTags`: boolean = false — Specifies whether to enable 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)

- `enableExecuteCommand`: boolean = false — Whether ECS Exec should be enabled.

- `healthCheckGracePeriod`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started.

  **Default:** defaults to 60 seconds if at least one load balancer is in-use and it is not already set

- `loadBalancers`: [ApplicationLoadBalancerProps](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs_patterns.ApplicationLoadBalancerProps.html)[] — The application load balancer that will serve traffic to the service.

  **Default:** a new load balancer with a listener will be created.

- `propagateTags`: [PropagatedTagSource](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.PropagatedTagSource.html) = none — Specifies whether to propagate the tags from the task definition or the service to the tasks in the service.

  Tags can only be propagated to the tasks within the service during service creation.

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

  **Default:** CloudFormation-generated name.

- `targetGroups`: [ApplicationTargetProps](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs_patterns.ApplicationTargetProps.html)[] — Properties to specify ALB target groups.

  **Default:** default portMapping registered as target group and attached to the first defined listener

- `taskImageOptions`: [ApplicationLoadBalancedTaskImageProps](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs_patterns.ApplicationLoadBalancedTaskImageProps.html) = none — The properties required to create a new task definition.

  Only one of TaskDefinition or TaskImageOptions must be specified.

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) — The VPC where the container instances will be launched or the elastic network interfaces (ENIs) will be deployed.

  **Default:** uses the VPC defined in the cluster or creates a new VPC.

  If a vpc is specified, the cluster construct should be omitted. Alternatively, you can omit both vpc and cluster.

## Properties

- `cluster`: [ICluster](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ICluster.html) — The cluster that hosts the service.

- `internalDesiredCount`: number — The desired number of instantiations of the task definition to keep running on the service.

  The default is 1 for all new services and uses the existing services desired count
  when updating an existing service, if one is not provided.

- `listener`: [ApplicationListener](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListener.html) — - Use `listeners` instead.

- `listeners`: [ApplicationListener](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationListener.html)[] — The listeners of the service.

- `loadBalancer`: [ApplicationLoadBalancer](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html) — - Use `loadBalancers` instead.

- `loadBalancers`: [ApplicationLoadBalancer](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationLoadBalancer.html)[] — The load balancers of the service.

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

- `targetGroups`: [ApplicationTargetGroup](/cdk/api/v2/docs/aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationTargetGroup.html)[] — The target groups of the service.

## Methods

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

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

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

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
