AWS Copilot: Deploying an Amazon Elastic Container Service Infrastructure & Application

Varun Kumar Manik
4 min readJul 13, 2020

Step by step tutorial for Installation of Copilot and application deployment | DevOps CICD pipeline for AWS ECS with help of AWS Copilot

Hi Folks,

Today, I am going to explain AWS Copilot CLI, which was released by Amazon by last week July 09, 2020. It will be a new sky limit for DevOps Process in the ECS cluster.

Use Case: It will highly useful in microservices deployment, where, only developers are responsible for infra deployment and management. So the developer can easily manage the infra from their local machine & create the deployment pipeline. This way they will save a lot of time, as time is directly proportional to money. Also, a company can reduce the cost for system admin or cloud engineer as these positions are not required in this kind of infra management. Basic docker and Linux knowledge are required at the developer end.

What is AWS Copilot…?

The AWS Copilot command-line interface (CLI) provides application-first, high-level commands to simplify modeling, creating, releasing, and managing production-ready containerized applications on Amazon ECS from a local development environment.

Provisioned with application templates, infrastructure as code, and CI/CD pipeline options, the AWS Copilot CLI aligns with application workflows that support modern application best practices. Use the AWS Copilot CLI as part of your everyday development and testing cycle as an alternative to the AWS Management Console.

Design Architecture:

AWS Copilot Design Architecture

Prerequisites

Before you begin, complete the following prerequisites:

  1. Set up an AWS account.
  2. Install the AWS Copilot CLI.
  3. Install and configure the AWS CLI.
  4. Run aws configure to set up a default profile that the AWS Copilot CLI will use to manage your application and services.
  5. Install Docker, Git

Let’s Get started with Installation part

Copilot Installation on Linux Server:

sudo curl -Lo /usr/local/bin/copilot https://github.com/aws/copilot-cli/releases/download/v0.1.0/copilot-linux-v0.1.0  \
&& sudo chmod +x /usr/local/bin/copilot \
&& copilot --help

Install Docker & Git in Linux Server

yum install docker git  -yservice docker startchkconfig docker on

As I am using EC2 Linux server so that I need to create a soft link for Copilot binary file to “/usr/bin/copilot” location

ln -s /usr/local/bin/copilot /usr/bin/copilot

Go to Opt directory and clone your empty git repo.

https://github.com/manikcloud/copilot

cd /opt/git clone https://github.com/manikcloud/copilot-demo.gitllcd copilot-demo/

Please find the video with step by step tutorial for Installation of Copilot and application deployment

High-level steps or commands & its output:

copilot init 

Once copilot init command complete the entire setup, below resources has been created in your was accounts:

  • AWS VPC
  • Subnets
  • Security Group
  • ECS Cluster
  • ECS Service
  • Fargate task
  • Service Discovery
  • ECR Repositories
  • Application Load balancer
  • ACM Certs
copilot app 
copilot svc

History for all terminal command

    1  yum update -y
2 sudo curl -Lo /usr/local/bin/copilot https://github.com/aws/copilot-cli/releases/download/v0.1.0/copilot-linux-v0.1.0 && sudo chmod +x /usr/local/bin/copilot && copilot --help
3 ln -s /usr/local/bin/copilot /usr/bin/copilot
4 copilot --help
5 yum install docker git -yservice docker startchkconfig docker on
6 yum install docker git -y
7 service docker start
8 chkconfig docker on
9 service docker status
10 https://github.com/manikcloud/copilot.git
11 cd /opt/
12 git clone https://github.com/manikcloud/copilot.git
13 ll
14 cd copilot/
15 ll
16 vim Dockerfile
17 vim index.html
18 copilot init
19 aws configure
20 copilot init
21 aws s3 ls
22 copilot init
23 ll
24 copilot init
25 copilot
26 copilot app
27 copilot app ls
28 copilot app show
29 copilot app init
30 copilot app env
31 copilot env
32 copilot ls
33 copilot env ls
34 copilot
35 copilot svc
36 copilot svc ls
37 copilot svc package
38 copilot svc show
39 copilot svc
40 copilot svc status
41 copilot svc logs
42 copilot svc
43 copilot svc logs --follow

Conclusion:

I have successfully shown you all the steps for AWS Copilot installation and application deployment. All AWS infra {ECS, Tasks, Laodbalancer, IAM, VPC, and VPC related resources } has been created automatically in DevOps manner. In the end, we tested our Deployment ALB DNS to paste in a web browser, and our website is up and running.

Part1:

Part 2:

Part 3:

For more info please connect & Follow me:

LinkedIn: https://www.linkedin.com/in/vkmanik/

Email: varunmanik1@gmail.com

Facebook: https://www.facebook.com/cloudvirtualization/

YouTube:

Github: https://github.com/manikcloud/copilot

--

--

Varun Kumar Manik

AWS APN Ambassador | SME of DevOps DevSecOps | Cloud Architect & Trainer | Blogger | Youtuber |Chef