Step 1: Configuring basic service parameters - Amazon Elastic Container Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Step 1: Configuring basic service parameters

Important

Amazon ECS has provided a new console experience for creating a service. For more information, see Creating a service using the new console.

All services require some configuration parameters that define the service, such as the task definition to use, which cluster that the service runs on, how many tasks are placed for the service. This is called the service definition. For more information about the parameters defined in a service definition, see Service definition parameters.

This procedure covers how to create a service and covers the service definition parameters that are required. After you configured these parameters, you can create your service or move on to the procedures for optional service definition configuration. For example, you can move on to configuring your service to use a load balancer.

Note

If your cluster is configured with a default capacity provider strategy, you can only create a service using the default capacity provider strategy when using the console. Likewise, if no default capacity provider is defined, you can only use a launch type when creating a service using the console. It's not currently possible to have a mixed strategy using both capacity providers and launch types in the console.

To configure the basic service definition parameters

  1. Open the Amazon ECS console at https://console.amazonaws.cn/ecs/.

  2. On the navigation bar, select the Region that your cluster is in.

  3. In the navigation pane, choose Task Definitions and select the task definition to create your service from.

  4. On the Task Definition name page, select the revision of the task definition to create your service from.

  5. Review the task definition, and choose Actions, Create Service.

  6. On the Configure service page, complete the following steps.

    1. Choose either a capacity provider strategy or a launch type.

      • To use a Capacity provider strategy, first choose Switch to capacity provider strategy. Next, choose whether your service uses the default capacity provider strategy that's defined for the cluster or a custom capacity provider strategy. A capacity provider must already be associated with the cluster to be used in a custom capacity provider strategy. For more information, see Amazon ECS capacity providers.

      • To use a Launch type, choose Switch to launch type and select FARGATE, EC2, or EXTERNAL. For more information about launch types, see Amazon ECS launch types.

    2. For Platform operating system, if you chose the Fargate launch type, then select the platform operating system (for example, LINUX).

    3. For Platform version, if you chose a Fargate capacity provider or the Fargate launch type, then select the platform version to use.

      Note

      When the LATEST platform version is selected, we validate the operating system that was specified for the task, and then set the appropriate platform version. If the Operating System is set to Windows-Server-2019-Full or Windows-Server-2019-Core, the 1.0.0 platform is used. If the operating system is Linux, the 1.4.0 platform version is used.

    4. Cluster: Select the cluster to create your service in.

    5. Service name: Type a name for your service. It must be unique.

    6. Service type: Select a scheduling strategy for your service. For more information, see Service scheduler concepts.

    7. Number of tasks: If you chose the REPLICA service type, enter the number of tasks to launch and maintain on your cluster.

      Note

      If your launch type is EC2 and your task definition uses static host port mappings on your container instances, then you need at least one container instance with the specified port available in your cluster for each task in your service. This restriction doesn't apply if your task definition uses dynamic host port mappings with the bridge network mode. For more information, see portMappings.

    8. If you're using the Rolling update deployment type, fill out the following deployment configuration parameters. For more information about how these parameters are used, see Deployment configuration.

      • Minimum healthy percent: Specify a lower limit for the number of tasks that your service must remain in the RUNNING state during a deployment. Specify the number as a percentage of the desired number of tasks. This number must be a whole number.

      • Maximum percent: Specify an upper limit for the number of tasks that your service allows in the RUNNING or PENDING state during a deployment. Specify the number as a percentage of the desired number of tasks. This number must be a whole number.

  7. For Deployment circuit breaker, choose the deployment circuit breaker logic. For more information, see Using the deployment circuit breaker.

  8. On the Deployments page, complete the following steps.

    1. For Deployment type, choose whether your service uses a rolling update deployment or a blue/green deployment using Amazon CodeDeploy. For more information, see Amazon ECS Deployment types.

    2. If you selected the blue/green deployment type, complete the following steps:

      1. For Deployment configuration choose the deployment configuration to use for the service. This determines how traffic is shifted when your task set is updated. For more information, see Blue/Green deployment with CodeDeploy

      2. For Service role for CodeDeploy choose the IAM service role for Amazon CodeDeploy. For more information, see Amazon ECS CodeDeploy IAM Role

  9. (Optional) If you selected the EC2 launch type and the REPLICA service type, for Task Placement, you can specify how tasks are placed using task placement strategies and constraints. Choose from the following options. For more information, see Amazon ECS task placement.

    • AZ Balanced Spread - Distribute tasks across Availability Zones and across container instances in the Availability Zone.

    • AZ Balanced BinPack - Distribute tasks across Availability Zones and across container instances with the least available memory.

    • BinPack - Distribute tasks based on the least available amount of CPU or memory.

    • One Task Per Host - Place, at most, one task from the service on each container instance.

    • Custom - Define your own task placement strategy. See Amazon ECS task placement for examples.

  10. In the Task tagging configuration section, complete the following steps:

    1. Select Enable ECS managed tags if you want Amazon ECS to automatically tag the tasks in the service with the Amazon ECS managed tags. For more information, see Tagging Your Amazon ECS Resources.

    2. For Propagate tags from, select one of the following:

      • Do not propagate – This option will not propagate any tags to the tasks in the service.

      • Service – This option will propagate the tags specified on your service to each of the tasks in the service.

      • Task Definitions – This option will propagate the tags specified in the task definition of a task to the tasks in the service.

      Note

      If you specify a tag with the same key in the Tags section, it will override the tag propagated from either the service or the task definition.

  11. In the Tags section, specify the key and value for each tag to associate with the task. For more information, see Tagging Your Amazon ECS Resources.

  12. Choose Next step and navigate to Step 2: Configure a network.