AWS just launched a fresh CLI recently - copilot. AWS says this CLI is for containerised applications. So the target audience seems to be people using ECS and Fargate. I decided to try this new stuff.
Installation
The installation for Mac is quite simple. You use homebrew like -
brew install aws/tap/copilot-cli
For windows and Linux refer - https://github.com/aws/copilot-cli/wiki/Installation#manually
Prerequisites
-
aws
cli. If you do not have that you might want to install and configure that. Steps here and here - docker
Initialisation
I am using a simple html file to deploy to in a container using a simple Dockerfile.
The first command you will have to run to initialise is
copilot init
This asks you a few questions and sets up the following things for you in the AWS account.
- Virtual Private Cloud (VPC) on 2 Availability Zones (AZs), which includes
- Internet Gateway
- Public Subnet
- Private Subnet
- Route Table
- ECS Cluster
- Application Load Balancer (ALB)
- Elastic Container Registry (ECR)
After running copilot init, creation of infrastructure ongoing
Deployment
Once this is complete, it will ask you whether you want to deploy this service to a test environment. If you say yes, it will deploy the service in a test environment and provide a URL where you can access the service (if it is a Web Service that you configured).
This does everything you need to deploy and access the Service through a Web URI.
Test your deployment
Finally when the deployment is complete, it will give you a URL that you can paste in your favourite browser and test.
Voila!
Other commands
The copilot CLI has three main command streams
- app - You can use this to perform operations on applications that you have deployed.
- env - To perform operations on the environments where your apps are deployed
-
copilot env init
- Initialise the env -
copilot env ls
- List all envs -
copilot env show
- Show Details of the env -
copilot env delete
- Delete the env
-
- svc
All these have a common set of commands, which are self explanatory -
-
copilot {app / env / svc} init
- Initialize -
copilot {app / env / svc} ls
- List -
copilot {app / env / svc} show
- Gives a more detailed view of the services in the application, the Environments and the URIs. In case of service, it will also display Routes, Service Discovery and other Configuration. -
copilot {app / env / svc} delete
- To delete the app / env / service
Apart from these, svc has some more commands for package
, deploy
, status
and logs
.
Use cases
I think copilot has a really wide range of command sets to cover a wide range of use cases. It can be easily used for CI/CD for most containerised apps. Just install in the pipeline of your choice and deploy from there.
Anyone using ECS or Fargate could make their deployment processes easier by these commands.
They also have plans to introduce provisioning of S3, Databases (SQL and NoSQL) from the command which would further widen the use cases to deploy not only services but also storage for your application using this command.
Also, its open source. Check it out here.
Top comments (0)