Amazon S3 Expiration Date?

浪子不回头ぞ 提交于 2020-01-19 21:34:04

问题


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-cache 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?


回答1:


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.



来源:https://stackoverflow.com/questions/4643328/amazon-s3-expiration-date

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!