node for ec2 dynamodb deploy aws node.js amazon-web-services amazon-s3

for - AWS Faltan credenciales cuando intento enviar algo a mi S3 Bucket(Node.js)



dynamodb aws sdk javascript (6)

Estaba teniendo el mismo error. Pero encontré el problema. Estaba usando un nombre de variable de entorno erróneo. Desde NodeJS hasta S3, necesito usar los siguientes nombres de variable:

process.env.AWS_ACCESS_KEY_ID = ''XXXXXXXXXXXXXXXXXXX''; process.env.AWS_SECRET_ACCESS_KEY = ''XXXXXXXXXXXXXXXXXXXXXXXXXX''; process.env.AWS_REGION = ''us-east-1'';

Una vez que corregí los nombres de las variables, funcionó bien. saludos, Dipankar

Hei!

Tengo este problema desde ayer y estoy teniendo problemas para encontrar una solución.

Estoy intentando enviar algo a mi bucket S3, pero este mensaje aparece en mi consola cuando intento:

{ [CredentialsError: Missing credentials in config] message: ''Missing credentials in config'', code: ''CredentialsError'', errno: ''Unknown system errno 64'', syscall: ''connect'', time: Thu Oct 09 2014 14:03:56 GMT-0300 (BRT), originalError: { message: ''Could not load credentials from any providers'', code: ''CredentialsError'', errno: ''Unknown system errno 64'', syscall: ''connect'', time: Thu Oct 09 2014 14:03:56 GMT-0300 (BRT), originalError: { code: ''Unknown system errno 64'', errno: ''Unknown system errno 64'', syscall: ''connect'', message: ''connect Unknown system errno 64'' } } }

Y este es mi código:

var s3 = new AWS.S3(); AWS.config.loadFromPath(''./AwsConfig.json''); s3.putObject(params, function(err) { if(err) { console.log(err); } else { console.log("Succes"); } });

Las credenciales son correctas. ¿Alguien sabe lo que puede ser? He buscado pero no encuentro la solución en ningún lado.

Mis credenciales (falsas):

{ "accessKeyId": "BLALBLALBLALLBLALB", "secretAccessKey": "BLABLALBLALBLALBLLALBLALLBLALB", "region": "sa-east-1", "apiVersions": { "s3": "2006-03-01", "ses": "2010-12-01" } }

EDITAR:

Para ayuda, todo el código:

var fs = require(''fs''); var AWS = require(''aws-sdk''); var s3 = new AWS.S3(); AWS.config.loadFromPath(''./MYPATH.json''); //this is my path to the aws credentials. var params = { Bucket: ''testing-dev-2222'', Key: file, Body: fs.createReadStream(file) }; s3.putObject(params, function(err) { if(err) { console.log(err); } else { console.log("Success"); } });

Nuevo error:

Error uploading data: { [PermanentRedirect: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.] message: ''The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.'', code: ''PermanentRedirect'', time: Thu Oct 09 2014 14:50:02 GMT-0300 (BRT), statusCode: 301, retryable: false }


Intente cambiar el usuario en mi archivo de configuración Aws de un usuario específico a [predeterminado].

$nano .aws/credentials [default] aws_access_key_id = xyz aws_secret_access_key = xyz

Si no tiene este archivo, créelo y obtenga sus claves o genere uno nuevo de las teclas de usuario de aws iam.


Intente codificar de manera forzada sus parámetros y vea si obtiene el error nuevamente:

AWS.config.update({ accessKeyId: "YOURKEY", secretAccessKey: "YOURSECRET", "region": "sa-east-1" <- If you want send something to your bucket, you need take off this settings, because the S3 are global. }); var s3 = new AWS.S3(); var params = { Bucket: ''makersquest'', Key: ''mykey.txt'', Body: "HelloWorld" }; s3.putObject(params, function (err, res) { if (perr) { console.log("Error uploading data: ", err); } else { console.log("Successfully uploaded data to myBucket/myKey"); } });

Buen recurso aquí


Probé la opción anterior e incluso eso no funcionó, así que creé un nuevo objeto de configuración y este código a continuación funcionó

AWS.config = new AWS.Config(); AWS.config.accessKeyId = "AccessKey"; AWS.config.secretAccessKey = "SecretAccessKey";


Tuve el mismo problema hasta que revirtí las dos líneas:

var s3 = new AWS.S3(); AWS.config.loadFromPath(''./AwsConfig.json'');

a esto:

AWS.config.loadFromPath(''./AwsConfig.json''); var s3 = new AWS.S3();


Tuve un problema similar al intentar cargar el archivo de configuración desde cualquier lugar que no sea el directorio raíz.

Pude cargar el archivo json de forma nativa en el nodo, y luego pasar el objeto que se analizó a AWS.config.update()

import AWS from ''aws-sdk'' import config from ''../aws.json'' AWS.config.update(config);