简体   繁体   中英

Amazon S3 signed urls accessible from outside world

So we have a use case where we need to be able to download the S3 files from the outside world on the inte.net. For this we are creating s3 pre signed url as below. My doubt is how can we access this on the inte.net? Are these urls accessible by default on the inte.net. Or do we need to create a proxy.

https://<bucket-name>.s3.amazonaws.com/<filename><some other parameters>

The URL you are showing is not a Pre-signed URL. A Pre-signed URL look like this:

https://bucketxxxxxx.s3.amazonaws.com/note.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230117T153509Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3599&X-Amz-Credential=AKIA33JWY3BX2TYWxxxxxxxxxxx%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=e55142af548e46fc2870bb03331d0e9aa9ffbd21xxxxxxxxxxxxxxxxxx

Once you generate a valid Pre-signed URL, you do not need a proxy. A user can download the object in the given time window - which you define when you create GetObjectPresignRequest .

GetObjectPresignRequest getObjectPresignRequest = GetObjectPresignRequest.builder()
                   .signatureDuration(Duration.ofMinutes(60))
                   .getObjectRequest(getObjectRequest)
                   .build();

You can see the proper way to create a pre-signed URL using AWS SDK for Java v2 in the AWS Code Github here:

https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/s3/src/main/java/com/example/s3/GetObjectPresignedUrl.java

TO read more about using the AWS SDK for Java v2 to create them, see this topic in the AWS Java V2 Developer Guide .

Working with Amazon S3 presigned URLs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM