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

354
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
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