ecs_service
Create, terminate, start or stop a service in ECS
Collection: community.aws
Full Name: community.aws.ecs_service
Synopsis
Create, terminate, start or stop a service in ECS
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| access_key | str | |||
| aws_ca_bundle | path | |||
| aws_config | dict | |||
| capacity_provider_strategy | list | [] | ||
| client_token | str | |||
| cluster | str | default | ||
| debug_botocore_endpoint_logs | bool | false | ||
| delay | int | 10 | ||
| deployment_configuration | dict | map[] | ||
| deployment_controller | dict | map[] | ||
| desired_count | int | |||
| enable_execute_command | bool | |||
| endpoint_url | str | |||
| force_deletion | bool | false | ||
| force_new_deployment | bool | false | ||
| health_check_grace_period_seconds | int | |||
| launch_type | str | |||
| load_balancers | list | [] | ||
| name | str | yes | ||
| network_configuration | dict | |||
| placement_constraints | list | [] | ||
| placement_strategy | list | [] | ||
| platform_version | str | |||
| profile | str | |||
| propagate_tags | str | |||
| purge_placement_constraints | bool | false | ||
| purge_placement_strategy | bool | false | ||
| region | str | |||
| repeat | int | 10 | ||
| role | str | |||
| scheduling_strategy | str | |||
| secret_key | str | |||
| service_registries | list | [] | ||
| session_token | str | |||
| state | str | yes | ||
| tags | dict | |||
| task_definition | str | |||
| validate_certs | bool | true | ||
| wait | bool | false |
Example
yaml
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Basic provisioning example
- name: Create, terminate, start or stop a service in ECS
community.aws.ecs_service:
state: present
name: console-test-service
cluster: new_cluster
task_definition: 'new_cluster-task:1'
desired_count: 0
- name: create ECS service on VPC network
community.aws.ecs_service:
state: present
name: console-test-service
cluster: new_cluster
task_definition: 'new_cluster-task:1'
desired_count: 0
network_configuration:
subnets:
- subnet-abcd1234
security_groups:
- sg-aaaa1111
- my_security_group
# Simple example to delete
- name: Create, terminate, start or stop a service in ECS
community.aws.ecs_service:
name: default
state: absent
cluster: new_cluster
# With custom deployment configuration (added in version 2.3), placement constraints and strategy (added in version 2.4)
- name: Create, terminate, start or stop a service in ECS
community.aws.ecs_service:
state: present
name: test-service
cluster: test-cluster
task_definition: test-task-definition
desired_count: 3
deployment_configuration:
minimum_healthy_percent: 75
maximum_percent: 150
placement_constraints:
- type: memberOf
expression: 'attribute:flavor==test'
placement_strategy:
- type: binpack
field: memory
# With deployment circuit breaker (added in version 4.0)
- name: Create, terminate, start or stop a service in ECS
community.aws.ecs_service:
state: present
name: test-service
cluster: test-cluster
task_definition: test-task-definition
desired_count: 3
deployment_configuration:
deployment_circuit_breaker:
enable: true
rollback: true
# With capacity_provider_strategy (added in version 4.0)
- name: Create, terminate, start or stop a service in ECS
community.aws.ecs_service:
state: present
name: test-service
cluster: test-cluster
task_definition: test-task-definition
desired_count: 1
capacity_provider_strategy:
- capacity_provider: test-capacity-provider-1
weight: 1
base: 0
# With tags and tag propagation
- name: Create, terminate, start or stop a service in ECS
community.aws.ecs_service:
state: present
name: tags-test-service
cluster: new_cluster
task_definition: 'new_cluster-task:1'
desired_count: 1
tags:
Firstname: jane
lastName: doe
propagate_tags: SERVICE