Skip to content

Getting Started

David Killmon edited this page Nov 28, 2019 · 21 revisions

The ECS CLI is a tool to help you create, develop and manage your containerized apps on ECS. To get started, all you need is an AWS account, a Dockerfile, and the AWS CLI and ECS CLI v2 installed.

Deploying in one command

Make sure you have the AWS command line tool installed and have already run aws configure before you start.

To deploy your app in one command, just run:

git clone [email protected]:kohidave/demo-dockerapp.git demo-app &&\ 
cd demo-app &&                       \ 
ecs-preview init --project demo      \
  --app api                          \
  --app-type 'Load Balanced Web App' \
  --dockerfile './Dockerfile'        \ 
  --deploy

Deploying, step by step

To get started with a sample app, you can follow the instructions below:

Step 1: Configure your credentials

The ECS CLI uses profiles to connect with your AWS account, so before you get started make sure to run aws configure. This will set up a default profile, which the ECS CLI will use to manage your project and applications.

aws configure

Step 2: Get some code

With the ECS CLI, you can easily deploy your containerized apps. To get you up and up and started, you can clone our simple demo app. It's just a simple Flask app and a Dockerfile that describes how to deploy it. Feel free to poke around, update things, or just play around.

git clone [email protected]:kohidave/demo-dockerapp.git demo-app && cd demo-app

Step 3: Set up your ECS Project

Now that you've got some awesome code, what better to do next than deploy it? We know that most interesting containerized apps consist of more than just one single app, so the ECS CLI organizes related apps into a project. Running the init command will walk you through setting up a project.

ecs-preview init

You'll be prompted to enter the name of a project—demo is a good choice. Your project is a collection of all your related apps and the environments you run those apps in. We'll talk more about that later.

Step 4: Set up your app

Rather than require you to manually configure exactly which resources you need, what type of LoadBalancer or which VPC configuration to choose, you can tell us the kind of app you're building. In our case, we're building a simple Flask app which serves a small API—so let's select a Load Balanced Web App.

After that, you'll be prompted to enter an app name and select a Dockerfile. Let's call your app api.

Once you press "Enter," the ECS CLI will spin up some resources that it needs to be able to create ECR repositories, S3 buckets and KMS keys. Once that's completed, you'll be asked if you'd like to deploy to a test environment. If you select "yes," the ECS CLI will create a test environment and deploy your container to it.

Step By Step Setup

A sped up view of setting up a hello-world project and a front-end app

Clone this wiki locally