Home > front end >  How to generate a public amazon-s3 link to a file with infinite TTL?
How to generate a public amazon-s3 link to a file with infinite TTL?

Time:10-29

According to this piece of official doc, if I generate a presigned link it will expire sooner or later and I want to have unchangeable links that I could store in a DB. The reason for doing so is that it would make those links cacheable thereby avoiding loading them over and over again.

https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html

CodePudding user response:

If the avatar/photo objects are publicly readable, then you don't need to create pre-signed URLs. Simply share each public URL, which is of the form:

https://mybucket.s3.amazonaws.com/myavatars/shark.png

More generally, see here.

If the objects are private, then the standard way to make them available to non-AWS users is to share pre-signed URLs. For more on the duration of pre-signed URLs, see here.

  • Related