From the course: AWS for Developers: S3

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Presigning URLs

Presigning URLs

- [Narrator] There are many times when we need to create presigned urls for downloads and uploads. For this video, we're going to use the Python STK to create a download link that is signed, so that we can give public access to our private resources as needed. Let's go ahead and jump back into our Python file. And we'll create a new method called generate download link. We will need to know the bucket the title is in, the key for the file that we want to be able to download, and we need to have an expiration time and we're going to use it in seconds. And then of course our S3 resource. We will do a try, and we're going to get a response this time. We're going to use our meta client. And we will call generate presigned URL. Then we need to pass in the method of get underscore object. A Params dictionary. That Params dictionary will contain a bucket, which we will set it to our bucket. And it needs a key, which we will set…

Contents