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

355
Visualizações
unable to upload files to S3 through jmeter

I am trying to upload files to S3 through PUT http request from jmeter. I am specifying the URL in the 'Path' and 'file path and mime type in the 'Files upload' section.

I get 'Access Denied' response from S3. The same URL works fine through Postman and the upload succeeds.

Any help on this??

about 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Given you are able to successfully upload the file using Postman you can just record the associated request using JMeter.

  1. Prepare JMeter for recording. The fastest and the easiest way is using JMeter Templates feature. From JMeter's main menu choose File - Templates - Recording and click "Create

    JMeter Proxy Template

  2. Expand Workbench - HTTP(S) Test Script Recorder and click "Start" button

    JMeter Start Proxy

  3. Run Postman using JMeter as proxy server like:

    C:\Users\Jayashree\AppData\Local\Postman\app-4.9.3\Postman.exe --proxy-server=localhost:8888
    
  4. Put the file you need to upload to the "bin" folder of your JMeter installation
  5. Run the request in Postman - JMeter should record it under Test Plan - Thread Group - Recording Controller

See HTTP(S) Test Script Recorder documentation for more information.

about 4 years ago · Santiago Trujillo Relatório

0

Have you properly specified the AWS credentials in the JMeter PUT request ? You need to specify AWS Access Key and secret key.

Another solution would be to use the AWS Java SDK from a JSR223 sampler, and make the call using Java code.

about 4 years ago · Santiago Trujillo Relatório

0

I have mentioned the steps to upload an image to s3 bucket using JMeter below:

Requirements:

  • Java 9
  • aws-java-sdk-s3 JAR 1.11.313 dependencies link

Steps:

  • Copy the jar files to JMeterHome/lib/ext/ of Jmeter.

  • Create a Test Plan and click on Thread Group.

  • Set Number of Threads, Ramp-up period and Loop Count to 1.

  • Right click on thread groups and add a JSR233 sampler.

  • Select Java as the language in the JSR233 sampler.

  • Add the following code in the script section of the sampler.

     import java.io.IOException;
     import java.io.InputStream;
     import java.util.Properties;
     import java.util.ArrayList;
     import java.util.List;
     import java.util.Scanner;
     import com.amazonaws.auth.AWSSessionCredentials;
     import com.amazonaws.auth.AWSStaticCredentialsProvider;
     import com.amazonaws.auth.BasicAWSCredentials;
     import com.amazonaws.services.s3.AmazonS3;
     import com.amazonaws.services.s3.AmazonS3ClientBuilder;
     import com.amazonaws.services.s3.model.AmazonS3Exception;
     import com.amazonaws.services.s3.model.GetObjectRequest;
     import com.amazonaws.services.s3.model.PutObjectRequest;
     import com.amazonaws.services.s3.model.PutObjectResult;
     import com.amazonaws.services.s3.model.S3Object;
     import com.amazonaws.services.s3.model.S3ObjectInputStream;
     import com.amazonaws.regions.Regions;
     import com.amazonaws.regions.Region;
     import com.amazonaws.services.s3.model.ObjectMetadata;
     import com.amazonaws.services.s3.transfer.Download;
     import com.amazonaws.services.s3.transfer.TransferManager;
     import com.amazonaws.services.s3.transfer.TransferManagerBuilder;
     import com.amazonaws.services.s3.transfer.Upload;
    
     String accessKey = "xxxxxxx";
     String secretKey = "xxxxxxxxx";               
     String bucketName = "bucketname"; //specify bucketname
     String region = "region"; //specify region
    
     BasicAWSCredentials sessionCredentials = new BasicAWSCredentials(accessKey, secretKey);
    
     AmazonS3 s3 = AmazonS3ClientBuilder.standard()
    .withRegion(region)
    .withCredentials(new AWSStaticCredentialsProvider(sessionCredentials))
    .build();
    
     TransferManager xfer_mgr = TransferManagerBuilder.standard()
    .withS3Client(s3)
                .withDisableParallelDownloads(false)
                .build();
    
     File f = new File("xxx/image.jpg"); //specify path to your image 
     String objectName = "newimage.jpg"; //provide a name for the image how you want your image to be shown i
     Upload xfer = xfer_mgr.upload(bucketName, objectName, f);   
     xfer.waitForCompletion();  
     xfer_mgr.shutdownNow();
    

For more reference you may check this link

about 4 years ago · Santiago Trujillo Relatório
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