Amazon EC2 Container Service
Developer Guide (API Version 2014-11-13)

Launching an Amazon ECS Container Instance

You can launch an Amazon ECS container instance using the AWS Management Console, as described in this topic. Before you begin, be sure that you've completed the steps in Setting Up with Amazon ECS. After you've launched your instance, you can use it to run tasks.

To launch a container instance

  1. Open the Amazon EC2 console at

  2. From the navigation bar, select the region to use.


    Amazon ECS is available in the following regions:

    Region NameRegion
    US East (N. Virginia)us-east-1
    US West (N. California)us-west-1
    US West (Oregon)us-west-2
    EU (Ireland)eu-west-1
    EU (Frankfurt)eu-central-1
    Asia Pacific (Tokyo)ap-northeast-1
    Asia Pacific (Singapore)ap-southeast-1
    Asia Pacific (Sydney)ap-southeast-2
  3. From the console dashboard, choose Launch Instance.

  4. On the Choose an Amazon Machine Image (AMI) page, choose Community AMIs.

  5. Choose an AMI for your container instance. You can choose the Amazon ECS-optimized AMI, or another operating system, such as CoreOS or Ubuntu. If you do not choose the Amazon ECS-optimized AMI, you need to follow the procedures in Installing the Amazon ECS Container Agent.


    For Amazon ECS-specific CoreOS installation instructions, see

    To use the Amazon ECS-optimized AMI, type amazon-ecs-optimized in the Search community AMIs field and press the Enter key. Choose Select next to the amzn-ami-2016.03.b-amazon-ecs-optimized AMI. The current Amazon ECS-optimized AMI IDs by region are listed below for reference.

    RegionAMI NameAMI ID
  6. On the Choose an Instance Type page, you can select the hardware configuration of your instance. The t2.micro instance type is selected by default. The instance type that you select determines the resources available for your tasks to run on.

  7. Choose Next: Configure Instance Details.

  8. On the Configure Instance Details page, verify that your Auto-assign Public IP field is set to Enable so that your instance is accessible from the Internet.

  9. On the Configure Instance Details page, select the ecsInstanceRole IAM role value that you created for your container instances in Setting Up with Amazon ECS.


    If you do not launch your container instance with the proper IAM permissions, your Amazon ECS agent will not connect to your cluster. For more information, see Amazon ECS Container Instance IAM Role.

  10. (Optional) Configure your Amazon ECS container instance with user data, such as the agent environment variables from Amazon ECS Container Agent Configuration; Amazon EC2 user data scripts are executed only once, when the instance is first launched.

    By default, your container instance launches into your default cluster. If you want to launch into your own cluster instead of the default, choose the Advanced Details list and paste the following script into the User data field, replacing your_cluster_name with the name of your cluster.

    echo ECS_CLUSTER=your_cluster_name >> /etc/ecs/ecs.config

    Or, if you have an ecs.config file in Amazon S3 and have enabled Amazon S3 read-only access to your container instance role, choose the Advanced Details list and paste the following script into the User data field, replacing your_bucket_name with the name of your bucket to install the AWS CLI and write your configuration file at launch time.


    For more information about this configuration, see Storing Container Instance Configuration in Amazon S3.

    yum install -y aws-cli
    aws s3 cp s3://your_bucket_name/ecs.config /etc/ecs/ecs.config
  11. Choose Next: Add Storage.

  12. On the Add Storage page, configure the storage for your container instance.

    If you are using an Amazon ECS-optimized AMI prior to the 2015.09.d version, your instance has a single volume that is shared by the operating system and Docker.

    If you are using the 2015.09.d or later Amazon ECS-optimized AMI, your instance has two volumes configured. The Root volume is for the operating system's use, and the second Amazon EBS volume (attached to /dev/xvdcz) is for Docker's use.

    You can optionally increase or decrease the volume sizes for your instance to meet your application needs.

  13. Choose Review and Launch.

  14. On the Review Instance Launch page, under Security Groups, you'll see that the wizard created and selected a security group for you. Instead, select the security group that you created in Setting Up with Amazon ECS using the following steps:

    1. Choose Edit security groups.

    2. On the Configure Security Group page, ensure that the Select an existing security group option is selected.

    3. Select the security group you created for your container instance from the list of existing security groups, and choose Review and Launch.

  15. On the Review Instance Launch page, choose Launch.

  16. In the Select an existing key pair or create a new key pair dialog box, choose Choose an existing key pair, then select the key pair that you created when getting set up.

    When you are ready, select the acknowledgment field, and then choose Launch Instances.

  17. A confirmation page lets you know that your instance is launching. Choose View Instances to close the confirmation page and return to the console.

  18. On the Instances screen, you can view the status of your instance. It takes a short time for an instance to launch. When you launch an instance, its initial state is pending. After the instance starts, its state changes to running, and it receives a public DNS name. (If the Public DNS column is hidden, choose the Show/Hide icon and select Public DNS.)