How to Deploy Applications Using CI/CD with CircleCI on AWS and Vercel
May 10, 2025
With the growing need for efficient and reliable software delivery, setting up an automated deployment pipeline has become a fundamental practice. In this article, we’ll integrate CircleCI to automate deployments to both Vercel and AWS EC2, so that every change pushed to your repository is automatically built and deployed with minimal manual intervention. You'll learn how to:
- Select and configure a pipeline tool
- Create and customize your own deployment pipeline
- Automatically trigger deployments upon commits to the main branch
Let's get started!
1. Cirlce CI
For this automation, we will use Circleci, a robust continuous integration tool and easily integrated with Github repositories.
Requirements
- Github Account
- A project ready to deploy
- CircleCI Account (to configure the pipeline)
- Vercel Account (for deployment to Vercel)
- AWS Account with EC2 instance (for deployment to AWS)
- SSH Key to authenticate with AWS EC2 (for SSH access)
- Basic knowledge of YAML (for CircleCI configuration)
Connecting Github to Circleci
- Visit Circle CI and log in with your Github account.
Circle CI log-in

After logging in, you will be redirected to the CircleCI dashboard. There, you will need to create an 'Organization,' and once that's done, you can proceed to create a project. Follow the steps below to complete the process:
Setting up a project
- Click on the Set up a project tab in the right top.
Circle CI Dashboard

After clicking on the Set up a project tab, you will be redirected to a page where you can select the repository you want to connect to CircleCI. Choose the desired repository and click on the Set Up Project
Circle CI configuration

- Select the option Faster: Commit a starter CI pipeline to a new branch to create a new branch with the CircleCI configuration file.
After selecting the option, you will be redirected to a page where you can view the pipeline that has been created. This pipeline represents a basic configuration for building and deploying your application. You can customize it to suit your specific needs.
Circle CI All pipelines

Creating your own pipeline
To create your own pipeline, go to the project settings and navigate to the pipeline tab.
Circle CI add new pipelines

- Click on the Add new pipeline button to create a new pipeline. You can name it whatever you want.
- If your account is not connected to Github, you will need to authorize CircleCI to access your Github account. This is necessary for CircleCI to be able to access your repositories and perform deployments.
- Then select your repository.
- Select your config file path.
- And finally, save the pipeline.
Circle CI adding a pipeline

Creating your trigger
To create your trigger, go to the project settings and navigate to the triggers tab.
Circle CI add new trigger

Here you can select many types of triggers, but for this tutorial we will select the Github App to create a trigger that will be executed when a pull request is created in to the main branch.
Circle CI adding a Trigger

- You can name your trigger whatever you want, but I recommend using a name that describes the purpose of the trigger.
- Then select your repository.
- Select your pipeline to run.
- Select when you want to run your pipeline, I recommend selecting the "Pushes to default branch" option.
- And finally, save the trigger.
Creating environment variables
To create environment variables, go to the project settings and navigate to the environment variables tab.
Circle CI environment variables

Here you can create environment variables that will be used in your pipeline. You can create as many environment variables as you want.
To add an environment variable, click on the Add Environment Variable button and enter the name and value of the variable.
Circle CI add environment variables

Creating SSH keys
To create SSH keys, go to the project settings and navigate to the SSH keys tab.
Circle CI SSH keys

Here you can create SSH keys that will be used in your pipeline. You can create as many SSH keys as you want.
To add an SSH key, click on the Add SSH Key button and enter the name and value of the key.
Circle CI add SSH keys

2. Vercel
To deploy your application to Vercel, you will need to create a Vercel account and connect it to your Github account. Once you have done this, you can generate a token that will be used to authenticate your application with Vercel. Follow the steps below to complete the process:
Requirements
- Create a Vercel account
- Connect your Vercel account to your Github account
- Generate a Vercel token
Generating a vercel token
To generate a Vercel token, go to the Vercel dashboard and navigate to the account settings. There, you will find an option to generate a new token. Click on it and follow the instructions to create a new token. Once you have generated the token, copy it and save it in a secure place.
Vercel Account Settings

Creating environment variables in your Circle CI project
Next, let's define the environment variables required to deploy to Vercel, we need to create some environment variables in our Circle CI project to be able to deploy our application to Vercel and AWS EC2.
To this project, we will need to create the following environment variables:
- VERCEL_PROJECT_NAME
- VERCEL_TOKEN
The VERCEL_PROJECT_NAME variable is the name of your project in Vercel. You can find it in the Vercel dashboard. The VERCEL_TOKEN variable is the token that you generated in the previous step. You can find it in the Vercel dashboard as well.
Seting up your config file
To set up your config file, you can use the following example:
.cirlceci/config.yml
version: 2.1
jobs:
deploy-vercel:
docker:
- image: cimg/node:lts
steps:
- checkout
- run:
name: Install dependencies
command: npm install --force
- run:
name: Install Vercel CLI
command: npm install -g vercel
- run:
name: Link Vercel project
command: vercel link --project $VERCEL_PROJECT_NAME --token $VERCEL_TOKEN --yes
- run:
name: Deploy to Vercel
command: vercel --prod --token $VERCEL_TOKEN --yes --no-wait
workflows:
build-and-deploy:
jobs:
- deploy-vercel
3. AWS EC2
To deploy your application to AWS EC2, you will need to create an AWS account and launch an EC2 instance. Once you have done this, you can generate a key pair that will be used to authenticate your application with AWS. Follow the steps below to complete the process:
Requirements
- Create an AWS account
- Launch an EC2 instance
- Generate a key pair
Creating an SSH key in your Cirlce CI project
As we could see in the previous steps, we need to create an SSH key in our Circle CI project to be able to deploy our application to AWS EC2.
Creating an Github Token
To create a Github token, go to the Github account settings and navigate to the developer settings. There, you will find an option to generate a new token. Click on it and follow the instructions to create a new token. Once you have generated the token, copy it and save it in a secure place because we are going to use it later on the project.
Github Token

Creating environment variables in your Circle CI project
As we could see in the previous steps, we need to create some environment variables in our Circle CI project to be able to deploy our application to AWS EC2.
To this project, we will need to create the following environment variables:
- SSH_USER
- SSH_IP
- GITHUB_USER
- GITHUB_TOKEN
The SSH_USER variable is the user that you will use to connect to your EC2 instance. The SSH_IP variable is the IP address of your EC2 instance. The GITHUB_USER variable is your Github username. The GITHUB_TOKEN variable is the token that you generated in the previous step. You can find it in the Github dashboard as well.
Seting up your config file
To set up your config file, you can use the following example:
.cirlceci/config.yml
version: 2.1
jobs:
deploy:
docker:
- image: cimg/base:stable
steps:
- add_ssh_keys:
fingerprints:
- "SHA256...." # Replace with your SSH key fingerprint
- run:
name: Deploy to EC2 via SSH
command: |
ssh -o StrictHostKeyChecking=no $SSH_USER@$SSH_IP "
cd flyup-api &&
git remote set-url origin https://$GITHUB_USER:$GITHUB_TOKEN@github.com/....git && # Replace with your repository URL
git pull &&
sudo docker compose down &&
sudo docker compose up -d --build
"
workflows:
deploy_workflow:
jobs:
- deploy
- Replace your SSH key fingerprint
- Replace your repository URL
It's important to note that the code after you connect your Github Account in the following line:
.cirlceci/config.yml
git remote set-url origin https://$GITHUB_USER:$GITHUB_TOKEN@github.com/....git && # Replace with your repository URL
git pull &&
Is the code that will be executed in your EC2 instance. In this example, we are using docker compose to deploy our application. You can replace this code with the code that you use to deploy your application.
Closing Thoughts
Setting up a CI/CD pipeline using CircleCI to deploy on both Vercel and AWS EC2 may seem complex at first, but once the foundation is in place, it significantly enhances your development workflow.
Automating deployments reduces human error, saves time, and ensures consistent delivery. Whether you're deploying a static site on Vercel or scaling applications with AWS EC2, this approach gives you flexibility and control.
If you found this guide helpful, feel free to share it and if you have any questions or comments just
contact me. Your journey to streamlining your development and deployment workflow has just begun! 🚀