Instalé localstack en mi máquina Linux, también configuré AWS CLI y creé un depósito usando awslocal como lo sugieren los documentos. aquí está el enlace para crear un depósito s3 en localstack. https://docs.localstack.cloud/aws/s3/
Y, ahora estoy tratando de cargar un archivo en el cubo, arrojaba un 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" } }aquí está mi código usando el nodo 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); }); };