Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

639
Vistas
Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1

When I am trying to load AWS credentials in my project it gives back an error.

When using credentials in plain text everything works good but when I am trying to use environment variables it's not working.

Error message. :

Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1

Here is my tried code :

const AWS = require('aws-sdk');


const SESConfig = {
    apiVersion: "2010-12-01",
    accessKeyId: process.env.AWS_SECRET_KEY,
    accessSecretKey: process.env.AWS_SECRET_KEY,
    region: "us-east-1"
}
AWS.config.update(SESConfig);
var sns = new AWS.SNS()
var sns = new AWS.SNS();

function sendSMS(to_number, message, cb) {

    sns.publish({
        Message: message,
        Subject: 'Admin',
        PhoneNumber:to_number
    }, cb);
  
  }
  
  // Example
  const PhoneNumberArray = ['any mobile number']
  PhoneNumberArray.forEach(number => {
    sendSMS(number, "Lorem Ipsum is simply dummy text of the printing and typesetting industry.", (err, result)=>{
        console.log("RESULTS: ",err,result)
      })
  })
 
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

By default, the SDK detects AWS credentials set in your environment and uses them to sign requests to AWS. That way you don’t need to manage credentials in your applications.

Unix:

$ export AWS_ACCESS_KEY_ID="your_key_id"
$ export AWS_SECRET_ACCESS_KEY="your_secret_key"

Windows:

> set AWS_ACCESS_KEY_ID="your_key_id"
> set AWS_SECRET_ACCESS_KEY="your_secret_key"

you can also add $ export AWS_SESSION_TOKEN='your_token' (optional)

See aws-sdk for more details.

or create a ~/.aws/credentials file and add:

[default]
aws_access_key_id = <YOUR_ACCESS_KEY_ID>
aws_secret_access_key = <YOUR_SECRET_ACCESS_KEY>

See aws for more details.

over 4 years ago · Santiago Trujillo Denunciar

0

I noticed that you are setting your accessKeyId and secretAccessKey to the same environment variable.

const SESConfig = {
    apiVersion: "2010-12-01",
    accessKeyId: process.env.AWS_SECRET_KEY,      // should be:  process.env.AWS_ACCESS_ID
    secretAccessKey: process.env.AWS_SECRET_KEY,  
    region: "us-east-1"
}

These are supplied as separate values by aws and should be represented by two separate environment variables. Maybe this is your issue?

over 4 years ago · Santiago Trujillo Denunciar

0

You can try create an AWS_PROFILE with the credentials if you have the AWS CLI installed.

$ aws configure --profile testuser
  AWS Access Key ID [None]: 1234
  AWS Secret Access Key [None]: 1234
  Default region name [None]: us-east-1
  Default output format [None]: text

After that you can set the AWS_PROFILE as environment variable.

Linux / Mac

export AWS_PROFILE=testuser

Windows

setx AWS_PROFILE testuser

After that you should be able to run your program and AWS will get the credentials from your profile. This way you don't have to save your credentials in .ENV. If you do, remember to add it in .gitignore.

https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html

https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda