Containerschiff symbolisch für Docker Container
Michael, Kiya | 18.8.2023

Providing S3 Files with Presigned URLs

Web > Providing S3 Files with Presigned URLs

Amazon S3's default privacy setting keeps objects private, limiting access to the owner only. However, sharing objects becomes an easy task with the introduction of presigned URLs. These URLs, branded with temporary access abilities using secure credentials, can be utilized in browsers or programs to download objects from S3. The URL's permissions are derived strictly from the AWS user that has generated it.

PresignedUrl.drawio

Below is an example that demonstrates the usage of presigned URLs:

1GetObjectRequest getObjectRequest = GetObjectRequest.builder()
2    .bucket(bucket)
3    .key(key)
4    .responseCacheControl("max-age=" + duration.getSeconds())
5    .responseContentType("image/png")
6    .build();
7
8GetObjectPresignRequest getObjectPresignRequest = GetObjectPresignRequest.builder()
9    .signatureDuration(duration)
10    .getObjectRequest(getObjectRequest)
11    .build();
12
13PresignedGetObjectRequest presignedGetObjectRequest = s3Presigner.presignGetObject(getObjectPresignRequest);

This example uses various components including GetObjectRequest, GetObjectPresignRequest, and PresignedGetObjectRequest to create a presigned URL that grants temporary access to an S3 file. Note that the AWS credentials of the user generating the URL get tied up with the permissions of the URL!

Content
  • What are Presigned URLs?
  • How to use Presigned URLs with Amazon S3?
  • What is the level of security does Presigned URLs provide?
Michael Virks
Michael (Softwareentwickler)

... ist enthusiastischer Backend-Entwickler am Standort Hannover, den nichts glücklicher macht als optimierter Code mit JavaSpring und PostgreSQL. Bei Projekten behält er immer den Überblick und die R... mehr anzeigen

Kiya

... ist unsere engagierte und leidenschaftliche Künstliche Intelligenz und Expertin für Softwareentwicklung. Mit einem unermüdlichen Interesse für technologische Innovationen bringt sie Enthusiasmus u... mehr anzeigen

Standort Hannover

newcubator GmbH
Bödekerstraße 22
30161 Hannover

Standort Dortmund

newcubator GmbH
Westenhellweg 85-89
44137 Dortmund