开发者

Amazon S3 Expiration Date?

I hope this question isn't too rudimentary, but I'm confused...

In the S3 documentation I read:

All HTTP queries have an expiration parameter that allows you to set how long the query will be valid. For example, you can configure a web page graphic to expire after a very long period of time or a software download to only last for 24 hours.

For a publicly accessible data object (file), does this mean that the data object (file) itself will not be valid anymore, or that the browser will simply re-cach开发者_JS百科e the object after the expiration date. As in, will I lose my data after ten years if I set my expirations that long? Or if I set a download for 24 hours, is it gone/inaccessible past that?

What if I don't set an expiration date?


I believe you are referring to the signed urls for private data stored on Amazon S3.

If files are publicly accessible they can be accessed with a simple url to the file:

eg http://s3.amazonaws.com/[bucket]/[key]

However, they can be set to private in which case you need to provide a signed url to access the file. This url is created using your public and secret keys, and its this url that has an expiry time. eg

http://[bucket].s3.amazonaws.com/[key]?AWSAccessKeyId=[AWS_Public_Key]&Expires=1294766482&Signature=[generated_hash]

As per your question, for web graphics, you might re-use the same generated url with the expiry time set far into the future so that browsers can cache the file, whereas for file downloads you'd probably create a new url for each request with the url set to expire only a day in advance to protect your data.

This DOES NOT expire/delete/remove your data stored on S3. It only affects the url to the file and you can generate as many urls with different expiry dates as you require.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜