AWS ecs-dg.pdf - Amazon Elastic Container Service Developer Guide API Version Amazon Elastic Container Service Developer Guide Amazon Elastic Container

AWS ecs-dg.pdf - Amazon Elastic Container Service Developer...

This preview shows page 1 out of 760 pages.

You've reached the end of your free preview.

Want to read all 760 pages?

Unformatted text preview: Amazon Elastic Container Service Developer Guide API Version 2014-11-13 Amazon Elastic Container Service Developer Guide Amazon Elastic Container Service: Developer Guide Copyright © 2020 Amazon Web Services, Inc. and/or its affiliates. All rights reserved. Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon. Amazon Elastic Container Service Developer Guide Table of Contents What is Amazon ECS? ......................................................................................................................... 1 Features of Amazon ECS ............................................................................................................. 1 Containers and Images ....................................................................................................... 2 Task Definitions ................................................................................................................. 3 Tasks and Scheduling ......................................................................................................... 4 Clusters ............................................................................................................................. 4 Container Agent ................................................................................................................. 4 How to Get Started with Amazon ECS .......................................................................................... 5 Related Services ......................................................................................................................... 5 Accessing Amazon ECS ................................................................................................................ 6 Setting Up ........................................................................................................................................ 7 Sign Up for AWS ........................................................................................................................ 7 Create an IAM User .................................................................................................................... 7 Create a Key Pair ....................................................................................................................... 9 Create a Virtual Private Cloud .................................................................................................... 11 Create a Security Group ............................................................................................................ 12 Install the AWS CLI ................................................................................................................... 13 Getting started ................................................................................................................................ 14 Docker basics ........................................................................................................................... 14 Installing Docker on Amazon Linux 2 .................................................................................. 14 Create a Docker Image ...................................................................................................... 15 Push your image to Amazon Elastic Container Registry ......................................................... 17 Clean up ......................................................................................................................... 18 Getting started with Amazon ECS using Amazon EC2 .................................................................... 18 Prerequisites .................................................................................................................... 18 Step 1: Register a task definition ........................................................................................ 18 Step 2: Create a cluster ..................................................................................................... 19 Step 3: Create a Service .................................................................................................... 20 Step 4: View your Service .................................................................................................. 21 Step 5: Clean Up .............................................................................................................. 21 Getting started with Amazon ECS using Fargate ........................................................................... 22 Prerequisites .................................................................................................................... 22 Step 1: Create a Task Definition ......................................................................................... 22 Step 2: Configure the Service ............................................................................................ 23 Step 3: Configure the Cluster ............................................................................................. 23 Step 4: Review ................................................................................................................. 24 Step 5: View your Service .................................................................................................. 24 Step 6: Clean Up .............................................................................................................. 24 AWS Fargate .................................................................................................................................... 26 Task Definitions ........................................................................................................................ 27 Network Mode ................................................................................................................. 28 Task CPU and Memory ...................................................................................................... 28 Task Resource Limits ......................................................................................................... 28 Logging ........................................................................................................................... 28 Amazon ECS Task Execution IAM Role ................................................................................. 29 Example Task Definition .................................................................................................... 29 Task Storage .................................................................................................................... 30 Tasks and Services .................................................................................................................... 30 Task Networking .............................................................................................................. 31 Private Registry Authentication .................................................................................................. 31 Clusters ................................................................................................................................... 32 Fargate Spot ............................................................................................................................ 32 Fargate Task Retirement ............................................................................................................ 32 Fargate Savings Plans ............................................................................................................... 32 API Version 2014-11-13 iii Amazon Elastic Container Service Developer Guide Platform Versions ..................................................................................................................... 32 Platform version considerations ......................................................................................... 33 Available platform versions ............................................................................................... 33 Migrating from platform version 1.3.0 to 1.4.0 ..................................................................... 35 Clusters ........................................................................................................................................... 36 Cluster Concepts ...................................................................................................................... 36 Creating a Cluster .................................................................................................................... 37 Capacity providers .................................................................................................................... 39 Capacity provider concepts ................................................................................................ 40 Capacity provider considerations ........................................................................................ 40 Auto Scaling group capacity providers ................................................................................ 41 AWS Fargate capacity providers ......................................................................................... 45 Cluster Auto Scaling ................................................................................................................. 49 Cluster auto scaling considerations ..................................................................................... 49 Updating Cluster Settings .......................................................................................................... 50 Deleting a Cluster .................................................................................................................... 50 Task Definitions ................................................................................................................................ 52 Application Architecture ............................................................................................................ 52 Using the Fargate Launch Type .......................................................................................... 53 Using the EC2 Launch Type ............................................................................................... 53 Creating a Task Definition ......................................................................................................... 54 Task Definition Template ................................................................................................... 59 Task definition parameters ........................................................................................................ 63 Family ............................................................................................................................. 63 Task role ......................................................................................................................... 63 Task execution role ........................................................................................................... 63 Network mode ................................................................................................................. 64 Container Definitions ........................................................................................................ 64 Volumes .......................................................................................................................... 89 Task placement constraints ................................................................................................ 92 Launch types ................................................................................................................... 93 Task size ......................................................................................................................... 93 Proxy configuration .......................................................................................................... 95 Other task definition parameters ........................................................................................ 96 Launch Types ........................................................................................................................... 98 Fargate Launch Type ......................................................................................................... 98 EC2 Launch Type .............................................................................................................. 99 Working with GPUs on Amazon ECS ......................................................................................... 100 Considerations for Working with GPUs .............................................................................. 101 Specifying GPUs in Your Task Definition ............................................................................ 102 Using Data Volumes in Tasks ................................................................................................... 103 Fargate Task Storage ...................................................................................................... 104 Docker Volumes ............................................................................................................. 105 Bind Mounts .................................................................................................................. 110 Amazon EFS Volumes ...................................................................................................... 117 Task Networking ..................................................................................................................... 120 Task Networking Considerations ....................................................................................... 120 Enabling Task Networking ............................................................................................... 122 Using the awslogs Log Driver ................................................................................................... 122 Enabling the awslogs Log Driver for Your Containers ........................................................... 123 Creating a Log Group ...................................................................................................... 123 Available awslogs Log Driver Options ................................................................................ 124 Specifying a Log Configuration in your Task Definition ........................................................ 125 Viewing awslogs Container Logs in CloudWatch Logs .......................................................... 127 Custom Log Routing ............................................................................................................... 129 Considerations ................................................................................................................ 129 Required IAM Permissions ................................................................................................ 130 API Version 2014-11-13 iv Amazon Elastic Container Service Developer Guide Using the AWS for Fluent Bit Image .................................................................................. Creating a Task Definition that Uses a FireLens Configuration ............................................... Using Fluent Logger Libraries ........................................................................................... Filtering Logs Using Regular Expressions ........................................................................... Example Task Definitions ................................................................................................. Private Registry Authentication for Tasks ................................................................................... Required IAM Permissions for Private Registry Authentication .............................................. Enabling Private Registry Authentication ........................................................................... Specifying Sensitive Data ........................................................................................................ Using Secrets Manager .................................................................................................... Using Systems Manager Parameter Store ........................................................................... Specifying environment variables ............................................................................................. Considerations for specifying environment variable files ...................................................... Required IAM permissions ................................................................................................ Example Task Definitions ......................................................................................................... Example: Webserver ........................................................................................................ Example: splunk Log Driver ............................................................................................ Example: fluentd Log Driver .......................................................................................... Example: gelf Log Driver ............................................................................................... Example: Amazon ECR Image and Task Definition IAM Role .................................................. Example: Entrypoint with Command ................................................................................. Example: Container Dependency ....................................................................................... Updating a Task Definition ...................................................................................................... Deregistering Task Definition Revisions ...................................................................................... Account Settings ............................................................................................................................ Amazon Resource Names (ARNs) and IDs ................................................................................... Viewing Account Settings ........................................................................................................ Modifying Account Settings ..................................................................................................... Container instances ......................................................................................................................... Container instance concepts ..................................................................................................... Container instance lifecycle ...................................................................................................... Check the instance IAM role for your account ............................................................................. Amazon ECS-optimized AMIs ................................................................................................... Amazon ECS-optimized AMI variants ................................................................................. Linux Amazon ECS-optimized AMIs ................................................................................... Windows Amazon ECS-optimized AMIs .............................................................................. AMI versions .................................................................................................................. AMI storage configuratio...
View Full Document

  • Summer '20
  • Amazon Web Services, Amazon Elastic Compute Cloud

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes