Send objects larger than 5Gb using SDK Amazon S3

1

I have been using the Amazon S3 SDK for communications on a cloud server, called DreamHost or DreamObjects.

My application upa files to my buckets. However, I started having problems because my files exceeded 5GB, so I had to change the way to send the file. I followed the documentation provided on the Amazon website ( Documentation here ).

However, using this way, I get the following error in the console:

  

Dec 26, 2016 1:28:22 PM com.amazonaws.services.s3.transfer.internal.UploadCallable performAbortMultipartUpload   If you do not want to be a part of a multipart uploader, you may need to manually remove the uploaded parts.   com.amazonaws.services.s3.model.AmazonS3Exception: null (Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: tx0000000000000000f1f16-0058613740-12165497-default), S3 Extended Request ID: 12165497- default

But I do not know what this "Signature" would be. My information for server access is ok, I check for third party programs and even the site itself, so it would not be login / password / authentication.

I do not know how to proceed. Anyone with any ideas who could help me? Below is the code I'm using.

    try {
         AWSCredentials credentials = new BasicAWSCredentials(UploadBigFile.LOGIN_KEY, UploadBigFile.SECRET_KEY);             
         AmazonS3 conn = new AmazonS3Client(credentials);
         conn.setEndpoint("objects-us-west-1.dream.io");

         final File f = new File("C:\backup\packages.rar");             
         ObjectMetadata      metadata    = new ObjectMetadata();                          
         metadata.setContentLength(f.length());
         PutObjectRequest request = new PutObjectRequest(BUCKET_NAME, "FOLDER NAME/cristiano - teste.zip", f);
         request.setGeneralProgressListener(new ProgressListener() {
            long transferidos         = 0L;                
            long transferidosParcial  = 0L;                
            long megaBytes            = 5000000L;
            long timeInicial          = System.currentTimeMillis();
            @Override
            public void progressChanged(ProgressEvent pe) {
                transferidosParcial += pe.getBytesTransferred();
                transferidos        += pe.getBytesTransferred();                                        

                if (transferidosParcial >= megaBytes){
                    long timeFinal            = System.currentTimeMillis() - timeInicial;                                                 
                    int seconds = (int) (timeFinal / 1000) % 60 ;                                                                        

                    double transf       = transferidos/1024/1024;
                    double transParcial = transferidosParcial/1024/1024;
                    double arquivo = f.length()/1024/1024;
                    String tempo = calculeTotalTimeToUpload(seconds, transParcial, arquivo-transf);
                    System.out.println("Transferidos: "+transf+"(MB) de "+arquivo+". "+tempo);
                    transferidosParcial  = 0L;
                    timeInicial          = System.currentTimeMillis();

                }                  
            }
        }); 
        System.out.println("Enviando arquivo. Por favor, aguarde.");
        TransferManager tm = new TransferManager(conn);
        Upload upload = tm.upload(request);
        upload.upload.waitForCompletion();();
        System.out.println("Arquivo enviado com sucesso!");
    } catch (AmazonS3Exception ex) {
        System.out.println("Erro 1");
        ex.printStackTrace();
    } catch (AmazonClientException ex) {
        System.out.println("Erro 2");
        ex.printStackTrace();
    } catch (InterruptedException ex) {
        System.out.println("Erro 3");
        ex.printStackTrace();
    }
    
asked by anonymous 26.12.2016 / 17:03

0 answers