aws::ecs-service

Create an ECS service.

Example

aws::ecs-service example-ecs-service
    name: "example-ecs-service"
    task-definition: $(external-query aws::ecs-task-definition { family: 'test-fargate-task-definition', revision: 1 })
    cluster: $(aws::ecs-cluster ecs-cluster-example)
    desired-count: 1
    enable-ecs-managed-tags: false
    launch-type: EC2
    scheduling-strategy: REPLICA

    deployment-configuration
        maximum-percent: 200
        minimum-healthy-percent: 100
    end

    deployment-controller
        type: ECS
    end

    network-configuration
        aws-vpc-configuration
            assign-public-ip: DISABLED
            security-groups: [
                $(aws::security-group security-group)
            ]
            subnets: [
                $(aws::subnet "subnet-us-east-1a"),
                $(aws::subnet "subnet-us-east-1b")
            ]
        end
    end

    placement-constraint
        expression: "agentVersion > 0"
        type: "memberOf"
    end

    placement-strategy
        type: binpack
        field: "MEMORY"
    end
end

Attributes

Attribute Description
capacity-provider-strategy-item list The capacity provider strategy to use for the service. Cannot be set if launch-type is set.
deployment-configuration The deployment parameters that control how many tasks run during the deployment.
deployment-controller The deployment controller to use for the service. Defaults to ECS.
desired-count The number of instantiations of the specified task definition to keep running on your cluster.
enable-ecs-managed-tags Enable or disable Amazon ECS managed tags for the tasks within the service.
health-check-grace-period-seconds The period of time, in seconds, that the Amazon ECS service scheduler should ignore unhealthy Elastic Load Balancing target health checks after a task first starts. Can only be set if load-balancer is set. Valid values are between 0 to 2147483647.
launch-type The launch type on which to run your service. Defaults to REPLICA. Cannot be set if capacity-provider-strategy-item is set.
load-balancer list The load balancers to use with your service.
network-configuration The network configuration for the service.
placement-constraint list The placement constraints to use for tasks in your service. Maximum allowed items are 10.
placement-strategy list The placement strategies to use for tasks in your service. Maximum allowed items are 5.
platform-version The platform version that your tasks in the service should run on.
propagate-tags The option to propagate the tags from the task definition or the service to the tasks in the service.
role The role that allows Amazon ECS to make calls to your load balancer Can only be set if load-balancer is set.
scheduling-strategy The scheduling strategy to use for the service.
name The name of the service. Must be a string 1 to 255 characters long containing letters, numbers, and hyphens. Must begin with a letter. Valid values satisfy the regex: [^[a-zA-Z]([-a-zA-Z0-9]{0,254})?]. (Required)
service-registries list The details of the service discovery registries to assign to this service.
task-definition The task definition to run in your service.
tags map The tags to apply to the service.
cluster The cluster on which to run your service. (Required)

Outputs

Attribute Description
arn The Amazon Resource Name (ARN) of the service.
running-count The number of tasks in the cluster that are currently running.
pending-count The number of tasks in the cluster that are currently pending.