Expiry and Storage Strategy for Download / View URLs for Files

It’s my understanding that when you upload a file or image to a Tape record, if you get the record after the fact, the JSON will include two CDN links for the file/image, one for downloading and one for viewing. I must say, I love this feature because it gives easy access to files from outside Tape when building integrations.

It seems that this link is set to expire after 6 days. I wanted to ask a couple of questions, if anyone can help me out:

  1. Do I have the expiry time right?

  2. Will the link regenerate itself every time the image/file is fetched via the API or do we have to wait until after the expiry date/time to regenerate?

Thanks!

@andrew.cranston

Yes you are correct on the time well I think it I actually 6 days 23hrs 59 mins etc.

This from my understanding is an S3 limit.

Yes every time you get a link the time is reset :slight_smile:

So as an example, if you embed the link in a calc field it will expire.

If you embed the link in a Tape webpage and then embed that page in a Calc field it will work (not sure this is a recommended thing to do)

1 Like

To try and be clearer for anyone else who is interested if you run this automation:


the final console log looks like this:

[13:14:11.900] https://s3.eu-central-1.amazonaws.com/tape-attachments/e179c1c596d8f701ab532dc615c492?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVNOAIV5JPIBLTKIM%2F20241219%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20241219T131311Z&X-Amz-Expires=518400&X-Amz-Signature=25e1781cb64ace01a6bc1d9d0fda9b4ac93b6d830f250163de2a4acebb8189dc&X-Amz-SignedHeaders=host&response-content-type=image%2Fpng%3B%20charset%3Dutf-8,https://s3.eu-central-1.amazonaws.com/tape-attachments/7617bf683940814a795abe0f54cf93?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVNOAIV5JPIBLTKIM%2F20241219%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20241219T131311Z&X-Amz-Expires=518400&X-Amz-Signature=74d5886a0c637b770c2dce6880a932599b31bccd52ee996c12e8f8357ddb6407&X-Amz-SignedHeaders=host&response-content-type=image%2Fpng%3B%20charset%3Dutf-8
https://s3.eu-central-1.amazonaws.com/tape-attachments/e179c1c596d8f701ab532dc615c492?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVNOAIV5JPIBLTKIM%2F20241219%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20241219T131411Z&X-Amz-Expires=518400&X-Amz-Signature=54c8b1e514da7168e3c8af40314c770f67bd85482efb3bd430cdb53d60035529&X-Amz-SignedHeaders=host&response-content-type=image%2Fpng%3B%20charset%3Dutf-8,https://s3.eu-central-1.amazonaws.com/tape-attachments/7617bf683940814a795abe0f54cf93?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVNOAIV5JPIBLTKIM%2F20241219%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20241219T131411Z&X-Amz-Expires=518400&X-Amz-Signature=b7493f2eee2b2cf26ad099bee6c01286e1cbf350e50d6cdb36fb974fa8554162&X-Amz-SignedHeaders=host&response-content-type=image%2Fpng%3B%20charset%3Dutf-8

The important parts of these are:
Date=20241219T131311Z&X-Amz-Expires=518400 from the first
Date=20241219T131411Z&X-Amz-Expires=518400 from the second

this is saying that the link will expire 518400 seconds after the date/time which if you look really carefully the second is exactly one minute later than the first.

This is why you can’t really host images directly on S3 storage and you need to use things like Cloudinary or twicpics I use Cloudinary.

1 Like

Great suggestions @Jason ! I also suggest DigitalOcean Spaces for hosting media and images, as an S3 bucket only costs $5 a month, it’s VERY affordable.

1 Like