How to Implement AWS Copilot

May 16, 2023
/
Santosh Peddada
/
No items found.

As we wrote about in our previous blog, packaging services with their dependencies not only speeds up your CI/CD pipeline, but also cuts costs and helps to eliminate OS compatibility issues. 

In this blog post, we’ll take a look at how Ibexlabs deploys containerized services through AWS Copilot.

Where does Co-pilot fit in my development process?

By abstracting infra level complexity into easy-to-use CLI commands, AWS Copilot allows developers to provision ECS environments quickly and easily. This keeps their focus on application coding and management, while the rest of the deployment cycle is taken care of automatically. 

AWS Copilot automatically provisions the necessary infrastructure including VPC subnets, load balancers, deployment pipelines and durable storage for application data. This takes a ton of work off the developers, so they can focus on making the best applications possible.

Copilot will take care of provisioning the infrastructure necessary to handle large volumes of traffic, and makes scaling easy with a simple API. 

With flexible debug capabilities, it’s easy to find your application logs and see how everything is running. It can even create a deployment pipeline that will automatically redeploy the latest version of your application every time that you push a new commit to your code repository. 

CLI commands are a flexible, easy-to-use option, but aren’t the best way to use Copilot at scale. That’s why Ibexlabs integrates AWS Copilot with various CI/CD pipelines like Jenkins, Circle-CI and others. This helps developers test code in virtual environments, before integrating to the larger infrastructure. 

How can I use AWS Copilot CLI commands?

Copilot is built to get you from idea to execution as quickly as possible. If you’re already familiar with using the CLI for other AWS services, then Copilot’s commands will probably seem straightforward to you. Remember, however, that you’ll need to have Docker installed on your development machine to run Copilot. 

If you are a Mac user using Brew, then the following command will begin the Copilot installation:

brew install aws/tap/copilot-cli

If you don’t use Brew, or would prefer to install Copilot directly, you’ll be able to install from GitHub using the following command:

curl -Lo /usr/local/bin/copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-darwin && chmod +x /usr/local/bin/copilot && copilot --help

The first step to deploying containerized services is finding the Dockerfile for your web server. In the case included below we used a simple static NGINX web server with a Dockerfile that looked like this:

FROM nginx:alpine

EXPOSE 80

COPY . /usr/share/nginx/html

To start building our application, we’ll need to run Copilot in our application directory by using the following command:

copilot init

You can see that process below:

Now that the application is up and running, we can load in the URL and see our NGINX page:

We can now use Copilot to see the logs for my application by running the below command:

copilot svc logs -- follow

And here are the corresponding service logs in our ECS console:

If you would like to read about the Copilot implementation process in more detail, refer here!

Ibexlabs has been helping businesses and organizations optimize their CI/CD pipelines for years. If you would like to read more about this solution, you can read more here. 

Contact us today for a free consultation!

Santosh Peddada

Santosh Peddada is a Solution Architect with Ibexlabs. He has been in the IT industry for around 7 years, holding positions from Devops Engineer to Solution Architect. For the past two years, he has been an integral part of the design and development of AWS architecture for clients. He has served as the product owner for the Ibex Catalog, and provided solutions for a number of different industries.

Talk to an Ibexlabs Cloud Advisor