PARALLAX

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

NameTypeRequiredDefaultDescription
access_keystr
aws_ca_bundlepath
aws_configdict
capacity_provider_strategylist[]
client_tokenstr
clusterstrdefault
debug_botocore_endpoint_logsboolfalse
delayint10
deployment_configurationdictmap[]
deployment_controllerdictmap[]
desired_countint
enable_execute_commandbool
endpoint_urlstr
force_deletionboolfalse
force_new_deploymentboolfalse
health_check_grace_period_secondsint
launch_typestr
load_balancerslist[]
namestryes
network_configurationdict
placement_constraintslist[]
placement_strategylist[]
platform_versionstr
profilestr
propagate_tagsstr
purge_placement_constraintsboolfalse
purge_placement_strategyboolfalse
regionstr
repeatint10
rolestr
scheduling_strategystr
secret_keystr
service_registrieslist[]
session_tokenstr
statestryes
tagsdict
task_definitionstr
validate_certsbooltrue
waitboolfalse

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
Search
    ↑ ↓ move↵ openesc close