You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
I am using Localstack S3 in order to test that a link correctly expires after a given TimeToLive.
Here is a short scala snippet of what I am doing:
def createTemporaryLink(s3: AmazonS3, s3ObjectPath: String, temporaryLinkTtl: FiniteDuration): String = {
val createdAt = ZonedDateTime.now(ZoneOffset.UTC)
val expiresAt = Date.from(createdAt.plus(temporaryLinkTtl.asJava).toInstant)
val amazonS3Uri = new AmazonS3URI(s3ObjectPath)
val generatePresignedUrlRequest: GeneratePresignedUrlRequest =
new GeneratePresignedUrlRequest(amazonS3Uri.getBucket, amazonS3Uri.getKey)
.withMethod(HttpMethod.GET)
.withExpiration(expiresAt)
s3.generatePresignedUrl(generatePresignedUrlRequest).toString
}
The code works and I get a valid link and I can even run an HTTP request and get the content of the file. However, the issue is that I can access the content of the s3 object even when the expirationTime has passed