

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 10
click for more info
Not enough gems
Cost: 6 gems
1: Security
incomplete
2: Application vs. Developer
incomplete
3: Scoping Permission
incomplete
4: Roles
incomplete
5: Private Bucket
incomplete
6: Signed URLs
incomplete
7: Encryption
incomplete
This lesson's interactive features are locked, please to keep using them
Presigned URLs are a way to give temporary access to a private object in S3. S3 will generate a URL (by attaching a cryptographic signature) that allows access to the object for a limited time. To be clear, it doesn't require the user to be logged in - it's just a URL that expires.
The idea is that we'll generate these URLs with very short life spans, and then only give them to users who have already been authenticated by your application.
Okay, so now that we've switched to a private bucket, we have a problem. Our code in that app's current state will generate URLs that simply put, won't work. Let's try it!
<Message>Access Denied</Message>
Let's use presigned URLs to fix it! Now, we're gonna do something a bit... hacky. There's no point in storing pre-signed URLs in the database, because they expire quickly. Instead, we'll use the video_url column to store the bucket and key of the video, then we'll use that to generate the presigned URL on the fly and respond with it on the API.
Run and submit the CLI tests.