BaseServiceProps

class aws_cdk.aws_ecs.BaseServiceProps(*, cluster, capacity_provider_strategies=None, circuit_breaker=None, cloud_map_options=None, deployment_controller=None, desired_count=None, enable_ecs_managed_tags=None, enable_execute_command=None, health_check_grace_period=None, max_healthy_percent=None, min_healthy_percent=None, propagate_tags=None, propagate_task_tags_from=None, service_name=None, launch_type)

Bases: BaseServiceOptions

Complete base service properties that are required to be supplied by the implementation of the BaseService class.

Parameters:
  • cluster (ICluster) – The name of the cluster that hosts the service.

  • capacity_provider_strategies (Optional[Sequence[Union[CapacityProviderStrategy, Dict[str, Any]]]]) – A list of Capacity Provider strategies used to place a service. Default: - undefined

  • circuit_breaker (Union[DeploymentCircuitBreaker, Dict[str, Any], None]) – Whether to enable the deployment circuit breaker. If this property is defined, circuit breaker will be implicitly enabled. Default: - disabled

  • cloud_map_options (Union[CloudMapOptions, Dict[str, Any], None]) – The options for configuring an Amazon ECS service to use service discovery. Default: - AWS Cloud Map service discovery is not enabled.

  • deployment_controller (Union[DeploymentController, Dict[str, Any], None]) – Specifies which deployment controller to use for the service. For more information, see Amazon ECS Deployment Types Default: - Rolling update (ECS)

  • desired_count (Union[int, float, None]) – The desired number of instantiations of the task definition to keep running on the service. Default: - When creating the service, default is 1; when updating the service, default uses the current task number.

  • enable_ecs_managed_tags (Optional[bool]) – Specifies whether to enable Amazon ECS managed tags for the tasks within the service. For more information, see Tagging Your Amazon ECS Resources Default: false

  • enable_execute_command (Optional[bool]) – Whether to enable the ability to execute into a container. Default: - undefined

  • health_check_grace_period (Optional[Duration]) – 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

  • max_healthy_percent (Union[int, float, None]) – The maximum number of tasks, specified as a percentage of the Amazon ECS service’s DesiredCount value, that can run in a service during a deployment. Default: - 100 if daemon, otherwise 200

  • min_healthy_percent (Union[int, float, None]) – The minimum number of tasks, specified as a percentage of the Amazon ECS service’s DesiredCount value, that must continue to run and remain healthy during a deployment. Default: - 0 if daemon, otherwise 50

  • propagate_tags (Optional[PropagatedTagSource]) – Specifies whether to propagate the tags from the task definition or the service to the tasks in the service. Valid values are: PropagatedTagSource.SERVICE, PropagatedTagSource.TASK_DEFINITION or PropagatedTagSource.NONE Default: PropagatedTagSource.NONE

  • propagate_task_tags_from (Optional[PropagatedTagSource]) – (deprecated) 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. Default: PropagatedTagSource.NONE

  • service_name (Optional[str]) – The name of the service. Default: - CloudFormation-generated name.

  • launch_type (LaunchType) – The launch type on which to run your service. LaunchType will be omitted if capacity provider strategies are specified on the service.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ecs as ecs
import aws_cdk.aws_servicediscovery as servicediscovery
import aws_cdk.core as cdk

# cluster: ecs.Cluster
# container_definition: ecs.ContainerDefinition
# namespace: servicediscovery.INamespace

base_service_props = ecs.BaseServiceProps(
    cluster=cluster,
    launch_type=ecs.LaunchType.EC2,

    # the properties below are optional
    capacity_provider_strategies=[ecs.CapacityProviderStrategy(
        capacity_provider="capacityProvider",

        # the properties below are optional
        base=123,
        weight=123
    )],
    circuit_breaker=ecs.DeploymentCircuitBreaker(
        rollback=False
    ),
    cloud_map_options=ecs.CloudMapOptions(
        cloud_map_namespace=namespace,
        container=container_definition,
        container_port=123,
        dns_record_type=servicediscovery.DnsRecordType.A,
        dns_ttl=cdk.Duration.minutes(30),
        failure_threshold=123,
        name="name"
    ),
    deployment_controller=ecs.DeploymentController(
        type=ecs.DeploymentControllerType.ECS
    ),
    desired_count=123,
    enable_eCSManaged_tags=False,
    enable_execute_command=False,
    health_check_grace_period=cdk.Duration.minutes(30),
    max_healthy_percent=123,
    min_healthy_percent=123,
    propagate_tags=ecs.PropagatedTagSource.SERVICE,
    propagate_task_tags_from=ecs.PropagatedTagSource.SERVICE,
    service_name="serviceName"
)

Attributes

capacity_provider_strategies

A list of Capacity Provider strategies used to place a service.

Default:
  • undefined

circuit_breaker

Whether to enable the deployment circuit breaker.

If this property is defined, circuit breaker will be implicitly enabled.

Default:
  • disabled

cloud_map_options

The options for configuring an Amazon ECS service to use service discovery.

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

cluster

The name of the cluster that hosts the service.

deployment_controller

Specifies which deployment controller to use for the service.

For more information, see Amazon ECS Deployment Types

Default:
  • Rolling update (ECS)

desired_count

The desired number of instantiations of the task definition to keep running on the service.

Default:

  • When creating the service, default is 1; when updating the service, default uses

the current task number.

enable_ecs_managed_tags

Specifies whether to enable Amazon ECS managed tags for the tasks within the service.

For more information, see Tagging Your Amazon ECS Resources

Default:

false

enable_execute_command

Whether to enable the ability to execute into a container.

Default:
  • undefined

health_check_grace_period

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

launch_type

The launch type on which to run your service.

LaunchType will be omitted if capacity provider strategies are specified on the service.

See:

Valid values are: LaunchType.ECS or LaunchType.FARGATE or LaunchType.EXTERNAL

max_healthy_percent

The maximum number of tasks, specified as a percentage of the Amazon ECS service’s DesiredCount value, that can run in a service during a deployment.

Default:
  • 100 if daemon, otherwise 200

min_healthy_percent

The minimum number of tasks, specified as a percentage of the Amazon ECS service’s DesiredCount value, that must continue to run and remain healthy during a deployment.

Default:
  • 0 if daemon, otherwise 50

propagate_tags

Specifies whether to propagate the tags from the task definition or the service to the tasks in the service.

Valid values are: PropagatedTagSource.SERVICE, PropagatedTagSource.TASK_DEFINITION or PropagatedTagSource.NONE

Default:

PropagatedTagSource.NONE

propagate_task_tags_from

(deprecated) 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.

Default:

PropagatedTagSource.NONE

Deprecated:

Use propagateTags instead.

Stability:

deprecated

service_name

The name of the service.

Default:
  • CloudFormation-generated name.