Title: Storing Amazon S3 signed URLs in the database
Tags: python;amazon-web-services;amazon-s3
Question: My application generates a couple of signed URLs, so when the page is loaded, it takes lot of time.

I want to generate those signed URLs only once and store in database. So, I want to retrieve those URLs from the database to show to user.

Is this acceptable at all times or will there be cases where the signed URLs need to be generated freshly?

Comment: Not microseconds as it does for multiple urls and also does api calls with s3 for connection objects etc. As of now, taking around 20 seconds for 3 urls.

Comment: Ok, I will try to improve that. But can you please answer my quesion - whether it needs to generated freshly ?

Comment: And I am signing like this 
distro = boto.cloudfront.distribution.Distribution(connection=my_connection....
my_signed_url = my_distro.create_signed_url(url, settings.KEYPAIR_ID, .....

Comment: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/131858/discussion-between-user2349115-and-michael-sqlbot).

Comment: Define "a lot of time."  This shouldn't take should more than a millisecond or two.  Please advise.  There are a couple of problems with storing signed URLs.  Are your signed URLs V2 (`&Signature=` base64) or V4 (`&X-Amz-Signature=` hexadecimal)?

Comment: Signing URLs is all done locally.  There's no interaction with the S3 service when signing a URL, but there may be some overhead when instantiating the object doing the signing.  Show some code?  Perhaps you're not reusing objects where you could, or something along those lines?

Comment: You didn't answer my question, about signature version... but based on what you've just added, the answer is entirely different.  These are not S3 signed phillipsdavid@example.net.  You are signing CloudFront URLs, and that's completely different than S3.  The algorithm is different and the rules are different, even if you're using S3 behind CloudFront.  Consider editing the question to reflect what you are actually doing.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 7, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:12/30/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<python><amazon-web-services><amazon-s3>', 'Title': 'Storing Amazon S3 signed URLs in the database', 'ViewCount': 525, 'id': 41390151, 'user_AboutMe': None, 'user_AccountId': 2723382.0, 'user_DisplayName': 'user2349115', 'user_Reputation': 1268.0, 'user_Views': 200.0, 'user_id': 2349115.0}}