Atlas Vercel API Integration
This guide will walk you through how to configure Atlas to authenticate and proxy requests to the Vercel API.
Vercel is a cloud platform that specializes in static site hosting and serverless functions.
The Vercel API provides developers with programmatic access to the Vercel platform. This includes APIs for deployments, teams and users, certificates, and build artifacts.
Results at the end of this guide
At the end of this guide, your running instance of Atlas will be configured to:
Proxy HTTP requests to the Vercel API.
Authenticate these requests using one or more Vercel Access Tokens.
Availability
Public beta. This integration is available to all Atlas users, but the API may change.
Prerequisites
A running instance of Atlas. See installation guides for more details.
Provision a Vercel Access token
Step 1: [Optional] Create a dedicated Vercel user for Atlas
It is recommended but not required to create a dedicated Vercel account for generating the Vercel Access Tokens Atlas needs to authenticate against the Vercel API.
The alternative is for a specific employee to generate Vercel Access Tokens from their personal account, for Atlas to use. Having a dedicated Vercel account for this purpose has several advantages over this approach:
Employee-provisioned Vercel Access Tokens will stop working if the employee is offboarded. For example, when a Vercel administrator removes the user from a Vercel Team, any access tokens provisioned to access that Vercel Team will stop working.
Dedicated Vercel accounts can be managed by a team using tools like 1Password. For example, storing the account password in 1Password allows administrators and ops teams to log in and perform routine operations like rotating secrets.
Step 2: Generate a Vercel Access Token
Click your profile picture in the upper right-hand side of the Vercel UI. Choose the Settings button in the dropdown menu.
Click the Tokens tab in the left-hand side of the page.
Fill out the form to generate a new token.
Provide a descriptive name for the token.
Set role to be the Vercel Team you want to access.
Set an expiration date for the token. Note that when the token expires, everything using it will break.
Click the create button.
Click the copy button to copy the token to your clipboard. Store this token in a secure location, as you will need it in the next step.
Add Vercel Integration to Atlas
Once the Vercel Access Token is provisioned, we will need to make it available to your running Atlas instance. We will do this by:
Adding the Vercel Access Token to the Atlas configuration as an environment variable, e.g.,
VERCEL_ACCESS_TOKEN
.Configuring the Atlas deployment to use an HTTP adapter that adds the Vercel Access Token to the
Authorization
header.
Step 1: Add Vercel Access Token to Atlas Deployment as an Environment Variable
Choose an environment variable name for the Vercel Access Token. Generally this is something like
VERCEL_ACCESS_TOKEN
.Add the Vercel Access Token you provisioned as an environment variables to your Atlas deployment. The install guides have instructions for how to do this for each deployment method. For example, if you deployed Atlas using ECS, you might add an environment variable
VERCEL_ACCESS_TOKEN
to the Pulumi configuration. If you deployed using Kubernetes, you might add theVERCEL_ACCESS_TOKEN
environment variable to a.env
file.Note the name of the environment variable you chose. We will use this in the next step to configure the HTTP adapter.
Step 2: Add Vercel Access Token to Atlas Configuration
We can use the mom
CLI to add the Vercel Access Token to the Atlas configuration. Run this command, changing
YOUR_ATLAS_CONFIG.yml
with the path to your Atlas configuration fileVERCEL_ACCESS_TOKEN
to the name of the environment variable you chose in the previous stepYOUR_ADAPTER_NAME
to the name you want to use for the HTTP adapter in Atlas, e.g.,vercel
The diff in your version control system should look something like this:
Step 3: Deploy the Updated Atlas Config
The install guides have instructions for how to deploy Atlas into a variety of environments, including Kubernetes and ECS.
Step 4: Test the Integration
Once deployed, we can use the mom curl
command to test the integration. Be sure to replace vercel
with the name you chose in the previous step if it is different.
Using the integration in a canvas
This integration can be used in Moment by creating a new cell in a Moment canvas, and pasting the following code. Note that you will need to assign httpAdapterName
to the name you chose for the HTTP adapter in the previous step, e.g., vercel
.
If the integration is working, you should see a JSON object representing your Vercel user account.
Last updated