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

322
Vistas
How to upload files into localstack s3 bucket

I have installed localstack into my Linux machine, and also configured AWS CLI, and created a bucket using awslocal as docs suggested. here is the link to create an s3 bucket in localstack. https://docs.localstack.cloud/aws/s3/

And, now I'm trying to upload a file into the bucket, it was throwing an error

InvalidBucketName: The specified bucket is not valid

here is the **bucket name**
{
    "Buckets": [
        {
            "Name": "suresh",
            "CreationDate": "2022-04-20T07:07:59+00:00"
        }
    ],
    "Owner": {
        "DisplayName": "webfile",
        "ID": "bcaf1ffd86f41161ca5fb16fd081034f"
    }
}

here is my code using node js

import fs from 'fs';
import S3 from 'aws-sdk/clients/s3';

const localstack = new S3({
 region: 'eu-west-1', // The value here doesn't matter.
 endpoint: 'http://localhost:4566', // This is the localstack EDGE_PORT
});

export const localstackFileUpload = async () => {
  const fileName = './suresh.txt';
  return localstack
    .upload({
      Bucket: 'suresh',
      Key: fileName,
      Body: fs.readFileSync(fileName),
    })
    .promise()
    .then((res) => {
      console.log(' res ', res);
    })
    .catch((err) => {
      console.log(' err ', err);
    });
};
about 4 years ago · Juan Pablo Isaza
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