Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

368
Views
How to get object key for amazon s3 service

I'm trying to get a file stored in Amazon S3 with Java (http://docs.aws.amazon.com/AmazonS3/latest/dev/RetrievingObjectUsingJava.html), but I have problem with the object key as I don't know what it is.

The bucket name is testbucket and I have a folder with the name files in this bucket. If I have a file with the name image.jpeg; what is the object key?

private static String bucketName = "testbucket"; 
private static String key="files/image.jpeg";      


public static void main(String[] args) throws IOException {
    AmazonS3 s3Client = new AmazonS3Client(new ProfileCredentialsProvider());
    S3Object s3object = s3Client.getObject(new GetObjectRequest(
                bucketName, key));
     } 

I get this output:

  21:43:54.054 [main] DEBUG com.amazonaws.request - Sending Request: GET https://adap-demo.s3.amazonaws.com /report_templates/Testreport_1.jrxml
Headers: (User-Agent: aws-sdk-java/1.10.30 Linux/4.4.0-70-generic
OpenJDK_64-Bit_Server_VM/25.121-b13/1.8.0_121, Content-Type:
application/x-www-form-urlencoded; charset=utf-8, ) 
21:43:54.164 [main] DEBUG c.a.services.s3.internal.S3Signer - Calculated
string to sign:
"GET
application/x-www-form-urlencoded; charset=utf-8
Sun, 02 Apr 2017 19:43:54 GMT
/adap-demo/report_templates/Testreport_1.jrxml"
Caught an AmazonClientException, which means the client encountered an
internal error while trying to communicate with S3, such as not being able
to access the network.
Error Message: Unable to calculate a request signature: Unable to   
calculate a request signature: Empty key 
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!