Skip to content

How can I use AWS SDK Environment Variables on Vercel?

Vercel has reserved Environment Variable names that cannot be used for your deployments. For example, AWS_REGION. You will need to choose a different Environment Variable name when using the AWS SDK.

Ensure the access key and secret key are added as Environment Variables inside your Vercel project.

import { S3Client } from '@aws-sdk/client-s3';

const s3Client = new S3Client({
  region: process.env.REGION,
  credentials: {
    accessKeyId: process.env.ACCESS_KEY,
    secretAccessKey: process.env.SECRET_KEY,
  },
});

Example code to connect to the AWS SDK.

Learn more about using AWS S3 on Vercel.

Couldn't find the guide you need?