github.com/hobbeswalsh/terraform@v0.3.7-0.20150619183303-ad17cf55a0fa/website/source/docs/providers/aws/r/ecs_service.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_ecs_service" 4 sidebar_current: "docs-aws-resource-ecs-service" 5 description: |- 6 Provides an ECS service. 7 --- 8 9 # aws\_ecs\_service 10 11 Provides an ECS service - effectively a task that is expected to run until an error occures or user terminates it (typically a webserver or a database). 12 13 See [ECS Services section in AWS developer guide](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html). 14 15 ## Example Usage 16 17 ``` 18 resource "aws_ecs_service" "mongo" { 19 name = "mongodb" 20 cluster = "${aws_ecs_cluster.foo.id}" 21 task_definition = "${aws_ecs_task_definition.mongo.arn}" 22 desired_count = 3 23 iam_role = "${aws_iam.foo.id}" 24 25 load_balancer { 26 elb_name = "${aws_elb.foo.id}" 27 container_name = "mongo" 28 container_port = 8080 29 } 30 } 31 ``` 32 33 ## Argument Reference 34 35 The following arguments are supported: 36 37 * `name` - (Required) The name of the service (up to 255 letters, numbers, hyphens, and underscores) 38 * `task_definition` - (Required) The family and revision (`family:revision`) or full ARN of the task definition that you want to run in your service. 39 * `desired_count` - (Required) The number of instances of the task definition to place and keep running 40 * `cluster` - (Optional) ARN of an ECS cluster 41 * `iam_role` - (Optional) IAM role that allows your Amazon ECS container agent to make calls to your load balancer on your behalf. This parameter is only required if you are using a load balancer with your service. 42 * `load_balancer` - (Optional) A load balancer block. Load balancers documented below. 43 44 Load balancers support the following: 45 46 * `elb_name` - (Required) The name of the load balancer. 47 * `container_name` - (Required) The name of the container to associate with the load balancer (as it appears in a container definition). 48 * `container_port` - (Required) The port on the container to associate with the load balancer. 49 50 51 ## Attributes Reference 52 53 The following attributes are exported: 54 55 * `id` - The Amazon Resource Name (ARN) that identifies the service 56 * `name` - The name of the service 57 * `cluster` - The Amazon Resource Name (ARN) of cluster which the service runs on 58 * `iam_role` - The ARN of IAM role used for ELB 59 * `desired_count` - The number of instances of the task definition