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

131
Views
How to Change Amazon S3 file URL Like s3.amazonaws.com/bucket/key from bucket.s3.amazonaws.com/key in Java?

Working with AmazonS3 bucket - After uploading file to bucket, we can get uploaded file URL using below code :

String fileDownloadUrl = AmzonS3Client.getUrl(bucketName, fileName);

In Result it will give url like i.e : bucket.s3.amazonaws.com/key but I want s3.amazonaws.com/bucket/key. So Can anyone help me how can I solve this in java?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

By default pathstyleaccess is false so your uploaded file should be bucket.s3.amazonaws.com/key but when you explicitly add clientOptions -- pathStyleAccess to true then it will generate URL like s3.amazonaws.com/bucket/key. Please find below code snippet

S3ClientOptions clientOptions = new S3ClientOptions(); clientOptions.setPathStyleAccess(true);

And set this clientOptions to Amazons3client.

about 4 years ago · Santiago Trujillo Report

0

Another Solution:

Create AmazonS3Client object using AmazonS3ClientBuilder with enablePathStyleAccess().

AmazonS3 client = AmazonS3ClientBuilder.standard()
        .enablePathStyleAccess()
        .withRegion(regionName)
        .withCredentials(new AWSStaticCredentialsProvider(credentials))
        .build();
about 4 years ago · Santiago Trujillo Report
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!