Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
Programatically set AWS region with a profile

I have multiple profiles defined both in .aws/credentials and .aws/config

[profile dev]
region = us-east-1

[profile staging]
region = eu-west-1

Using the NodeJS AWS SDKv3 I can load credentials from my local config:

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

new S3Client({
    credentials: fromIni({
        profile: 'dev'
    })
});

How can I do the same for region? (something akin to the following)

const {S3Client} = require('@aws-sdk/client-s3');
const {fromIni} = require('@aws-sdk/credential-providers');
const {fromIni: regionFromIni} = require('@aws-sdk/region-providers');

new S3Client({
    credentials: fromIni({
        profile: 'dev'
    }),
    region: regionFromIni({
        profile: 'dev'
    })
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

@fedonev pointed me to a solution that works:

const {loadSharedConfigFiles} = require('@aws-sdk/shared-ini-file-loader');

const sharedConfig = await loadSharedConfigFiles();
console.log(sharedConfig.configFile.dev?.region);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!