L.Kong
L.Kong

Reputation: 41

How to create session token for my file on AWS S3 if it connected to other CDN provider?

I have some video file stored on AWS S3 and I want to secure these files by adding session token with specific expiry time on the video URLs for preventing unauthorized access.

I know the s3 SDK can generate temporary credentials with Cloudfront to achieve this.

However, if I connected S3 to other CDN provider such as cloudflare. Will these temporary credentials work perfectly?

For example, my video file is stored on s3 -> http://files.video.com.s3.amazonaws.com/video.mp4

The cloudflare cdn url is -> http://files.video.com/video.mp4

If i generated temporary credentials for the file and access the url -> http://files.video.com/video.mp4?token=4180da90a6973bc8bd801bfe49f04a&expirey=1526231040535

Will it work?

Upvotes: 1

Views: 1112

Answers (1)

Justin Howard
Justin Howard

Reputation: 5643

It sounds like you're referring to S3 Presigned URLs. No, if your S3 bucket is private, CloudFlare will not be able to generate presigned URLs to access your files. AWS CloudFront uses an Origin Access Identity to resolve this issue. However with 3rd party CDNs, this is not possible.

There are 2 ways you could achieve better security (source).

Upvotes: 1

Related Questions