This blog is the first of the 2-part series on AWS Copilot. This blog edition focuses on the AWS Copilot service in general, wherein the next one will mainly be about its use case and a demo. This blog is primarily for developers, DevOps engineers, Kubernetes administrators, and Cloud administrators. Prior knowledge of Container Services offered on AWS, AWS CLI Docker, and Kubernetes is required to understand this blog’s contents.
Businesses are moving from Monolithic to Microservices architecture by adopting the DevOps framework to make application release quicker, easier, and more scalable. This move is facilitated by containers that bundle the application code, libraries, and dependencies into a compact single unit that can be deployed and scaled on any environment/platform with minimal effort from developers and the operations team. Among the available option for hosting applications for organizations,
AWS offers many such container hosting services, which can be run on a Server (EKS-EC2 Instance) or as a Serverless service (ECS-Fargate). Although there are running container services, the challenge is provisioning the required infrastructure like VPCs, subnets, master/worker nodes, load balancers, monitoring tools, dashboards, certificate/key management services, etc. It is where Infrastructure as Code (IaC) tools like Terraform, AWS CloudFormation, and AWS Copilot come into purview, automating the infrastructure creation task.
2. Introduction to AWS Copilot
A copilot is an open-source tool available on AWS. It allows developers to control their application’s build, release, and management using a set of declarative commands executed through the command line interface(CLI).
The multiple steps involved in application deployment on AWS include creating a container image or Dockerfile, pushing it to a container registry, creating an Elastic Container Service (ECS) task definition file (like YAML manifest in Kubernetes), creating an ECS cluster with worker nodes running on an EC2 instance or on AWS Fargate (serverless container service). A copilot is a CLI tool that can be installed on the developer’s local machine with Linux, windows, or MAC OS.
3. Top Features & Benefits of AWS Copilot
- AWS Services: Copilot is well integrated into other AWS Services, especially the DevOps tools like the Code Suite, Cloud Formation, AWS CLI, SNS, SQS, ECS, Fargate, S3, DynamoDB, Aurora DB, KMS, etc.,
- AWS Copilot builds the required infrastructure for deploying applications with just a Dockerfile and AWS account with just a few commands.
- Application deployment lifecycle goes through different stages like Dev, Staging, UAT, and Prod. There is a considerable difference in the application code and the infrastructure needed to run these applications at each stage. With Copilot, building these infrastructure prerequisites become very easy.
- 1 microservice or a bunch of microservices deployed across multi-account or multi-region, Copilot makes it happen with just a few commands.
- Kubernetes container security-related objects like secrets can be injected into a cluster.
- Databases like DynamoDB, Aurora DB, and Object storage like S3 can be added to ECS/Fargate as a data store for persistence.
- CI/CD Pipelines automate the process of application release to an environment. With AWS Copilot, whenever a new feature is released or a new code is pushed to the source control, a trigger the Copilot tool to build and release the new app to a deployment environment on ECS/Fargate.
- The AWS Open Telemetry Collector (Open Telemetry Protocol) is deployed as a sidecar to the containers running on ECS/Fargate to collect using a manifest file. AWS CloudWatch can view the traces being sent by the services deployed using AWS Copilot. Language-specific SDKs allow sending Telemetric data for applications written in different language stacks.
4. Prerequisites before using AWS Copilot
- AWS Account with Administrator access
- AWS CLI installed on the development machine
- AWS Copilot installed on the development machine
- Connect to AWS using AWS Configure
- Install Docker
- Docker Image
- Access to the source code repository
- Access/link to container registry
5. Command list for using AWS Copilot
The below commands can be used to manage services, and environments, create/run/delete jobs & tasks, pipelines, storage resources, manage secrets, and see the details of the deployed apps. Multiple flags can be combined with the below commands to control the resource, application, and services through copilot.
6. Guide to Install AWS Copilot
AWS Copilot can be installed on multiple operating systems, including Windows, Linux, and Mac. The steps to install
- Install using Homebrew:
1brew install aws/tap/copilot-cli
Note: if homebrew is not installed, use this link to install it first: https://brew.sh/
- Windows Installation:
12PS C:\> New-Item -Path 'C:\copilot' -ItemType directory; `Invoke-WebRequest -OutFile 'C:\copilot\copilot.exe' https://github.com/aws/copilot-cli/releases/latest/download/copilot-windows.exe
- Linux Installation:
123sudo curl -Lo /usr/local/bin/copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux \&& sudo chmod +x /usr/local/bin/copilot \&& copilot –help
- macOS Installation:
123sudo curl -Lo /usr/local/bin/copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-darwin \&& sudo chmod +x /usr/local/bin/copilot \&& copilot --help
7. Comparing AWS Copilot with Terraform
8. Final Thoughts
In conclusion, we have learned about the AWS Copilot CLI tool, its features and benefits, installation, and commands. We have also seen how Copilot is different from Terraform. Hopefully, this has given a brief insight into the AWS Copilot CLI tool and set a precursor to the next part of the blog, where we will deploy a sample app on AWS ECS/Fargate and create various inject secrets and trace logs for the services.
9. About CloudThat
CloudThat is the official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft gold partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. Our blogs, webinars, and case studies enable all the stakeholders in the cloud computing sphere.
Drop a query if you have any questions regarding the Ansible tool or other consulting opportunities, and I will get back to you quickly. To get started, go through our Expertise Page and CloudThat’s offerings.
1. Will AWS Copilot help in managing existing ECS and Fargate resources?
Ans: No, AWS Copilot can be used only with new AWS resources created using this tool.
2. How much does it cost to use the AWS Copilot service?
Ans: AWS Copilot CLI tool is an open-source tool distributed by AWS under an Open-source license and Apache 2.0 license model. Customers only pay for the AWS resources where the application will run and all other dependencies.