How can I create a one time download link with Amazon S3?

后端 未结 2 1468
我寻月下人不归
我寻月下人不归 2020-12-14 08:40

I want to create a one time download link to an amazon s3 hosted file. This link expires once the file has been downloaded.

I want this file to still be hosted but a

2条回答
  •  爱一瞬间的悲伤
    2020-12-14 09:07

    You can write an "one time url generator" service (either in form of website or rest API) and make use of aws federated user feature to achieve this.

    Consider the following procedure:

    • When user wants a one time url, they send the request to your "one time url generator" service.
    • The your service generates a "one time url" and returns it to the user. The url is a one-to-one mapping to the S3 resource the user wants.
    • When the user makes a requests to the "one time url", the service creates a temporary user using the AWS federated user feature, and generates an S3 presigned url on behalf of the temporary user.
    • The service sends the response back to the user, redirecting to the presigned url.
    • The user follows the redirection, and starts downloading the file.
    • The service then deletes the temporary user. (Or lets it expire.)

提交回复
热议问题