In the following article, I explain what AWS Copilot is, how to use this project, and the ease of implementing it.
In this article, I explain the use of the AWS Copilot service. However, to carry it out, it’s necessary to start by analyzing what the AWS Elastic Container Service (ECS) is and how it works, along with its deployment methods. This is necessary because AWS Copilot performs the implementation and deployment of an application using ECS
Elastic Container Service ( ECS ) is a scalable container orchestration platform proprietary to AWS. It is designed to run, stop, and manage containers in a cluster.
Therefore, ECS is AWS’s Docker container service that handles the orchestration and provisioning of Docker containers.
This service includes the following concepts:
In this model, containers are deployed on EC2 instances (VMs) created for the cluster. ECS manages them along with the tasks that are part of the task definition
✅ Advantages | ❌ Disadvantages |
---|---|
- Complete control over the type of EC2 instance used is provided. | - When working with EC2, it’s necessary for the administrator of this architecture to handle all security updates and scaling of instances. |
- It allows the use of instances that can be optimized depending on what you want to execute. | - The cost is based on the type of EC2 instance running within the cluster and the VPC networks. |
In this serverless configuration, the reliance on EC2 instances is eliminated, simplifying the deployment process. Instead, you only need to specify the required CPU and memory combination. AWS Fargate allows for a fully managed and serverless container deployment experience.
✅ Advantages | ❌ Disadvantages |
---|---|
- There are no servers to manage. | - ECS + Fargate supports only one network mode, and this limits control over the network layer. |
- AWS is in charge of the availability and scalability of the containers. | - Cost is based on the CPU and memory you select. The number of CPU cores and GB determines the cost of running the cluster. |
- Fargate Spot is a new capability that can run ECS tasks that are interruption-tolerant at up to a 70% discount compared to the Fargate price. |
AWS Copilot is a tool used through the AWS command line that simplifies the creation, deployment, monitoring, and operation of containers in ECS using a local development environment
This tool manages the components required for the deployment and operation of an application, such as VPC, load balancers, deployment pipelines, and storage. Therefore, it’s only necessary to provide an application container and minimal configurations, resulting in a faster deployment and focusing on application development.
The services will communicate with each other, so it is necessary to consider the following scenarios:
Activities | Without AWS-copilot | With AWS-copilot |
---|---|---|
Application developmen | 📗 Development team | 📗 Development team |
Container generation | 📗 Development team | 📗 Development team |
Virtual Private Cloud (VPC) Subnets | 📗 Development team | 📙 AWS-Copilot |
Load balancers | 📗Development team | 📙 AWS-Copilot |
Deployment flows (ci/cd) | 📗 Development team | 📙 AWS-Copilot |
Persistent storage of your application | 📗 Development team | 📙 AWS-Copilot |
Synchronize deployment across environments | 📗 Development team | 📙 AWS-Copilot |
The following table contains the components that are configured when using the AWS Copilot service.
Component | Description |
---|---|
Application | An application is a grouping mechanism for the pieces of your system. |
Enviroment | An environment is a stage in the deployment of an application. |
Service | A service is a single process of long-running code within a container. |
In just 5 steps we can deploy an application using aws-copilot, as shown in the following image. This allows the development team to only focus on development and not so much on the deployment of the infrastructure.
The first application that is deployed in copilot will make a default configuration and the same will be with a serverless container in fargate.
As seen in the following image, with only 5 steps we can deploy an application.
The steps in the flow are as follows:
copilot init
in a terminal to initialize.init
, some questions will appear to answer, such as the application name, service type, service name, and Dockerfile location.To obtain the logs of the deployed containers, it is necessary to execute the following command:
$ copilot svc logs- follow |
---|
To deploy in production it is necessary to be able to generate different environments, so to generate them it is necessary to execute the following command.
$ copilot env init |
---|
Subsequently, it is important to be able to modify the manifest file that contains all the application configurations and is located in nombredeaplicacion/manifest.yml
Once the environment configuration is complete, it is necessary to deploy it to production (or another environment, but the following example is in production).
$ copilot svc deploy —env production |
---|
In order to test the deployed application, you can use ApacheBench which allows you to generate traffic to the web application.
For this it is necessary to be able to execute the following command in which you want to generate a number of 5000 transactions to my service with a concurrency of 25 requests at a time.
ab -n 5000 -c 25<http://app12345.us-east-1.elb.amazonaws.com> |
---|
If I do not have the expected response, I can modify my manifest file and horizontally scale the application based on the different environments.
AWS Copilot is distributed by Amazon under an Apache 2.0 license, making it an open-source application.
As an open-source tool, AWS Copilot incurs no additional costs. The pricing is solely determined by the usage of the configured services. This cost-efficient model allows users to leverage the full capabilities of AWS Copilot without incurring any licensing fees.
In conclusion, AWS Copilot stands out for the following features:
AWS Copilot emerges as a robust, open-source AWS tool that streamlines the deployment of production-ready containers in a mere 5 steps, allowing development teams to concentrate on coding rather than grappling with infrastructure intricacies.
Configuration is effortless, demanding only the execution of a few commands and adjustments to the manifest file based on the application’s resource requirements.
Addressing horizontal scaling needs is a breeze – a simple modification to the manifest file followed by a deployment is all it takes.
AWS Copilot facilitates the establishment of a CI/CD pipeline for seamless, automatic deployments across various environments.
Effortlessly generate KPIs, set up alarms, and collect metrics with just a few commands through the user-friendly AWS Copilot service.
Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Mendez (2023, Nov. 14). Romina Mendez: AWS Copilot. Retrieved from https://r0mymendez.github.io/posts_en/2023-11-18-aws-copilot/
BibTeX citation
@misc{mendez2023aws, author = {Mendez, Romina}, title = {Romina Mendez: AWS Copilot}, url = {https://r0mymendez.github.io/posts_en/2023-11-18-aws-copilot/}, year = {2023} }