0

I have started migration of AWS SDK from v2 to v3. Can`t figure out what to use to create endpoint for S3.

In v2 I have: const aws = require('aws-sdk'); const ep = new aws.Endpoint(s3.region.amazonaws.com); What package need to use in V3 for this ?

2 Answers2

0

You should be able to set the endpoint when creating the S3 client, something like this:

const { AWS } = require('aws-sdk')

const s3 = new AWS.S3({
  endpoint: 'yourendpoint'
})
rlhagerm
  • 334
  • 6
0

did you try this?

const { S3Client } = require('@aws-sdk/client-s3');

const s3 = new S3Client({ region: 'region' });

for custom endpoint, try this:

const s3 = new S3Client({ endpoint: 'https://s3.region.yourendpoint', region: 'region' });

  • Hello. Yes use endpoint option. In our code we use STS service to get credentials and full Endpoint object, that is why I was trying to find how to create full Endpoint object, but I didn`t find it. In finale result I skipped the endpoint and pass only credentials and all work. – Vadim Khismatov Apr 27 '23 at 19:22