Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

330
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda