Sunday 1 January 2017

Generating signed cookies for Amazon CloudFront in Python

Generating signed urls or cookies for CloudFront is not straightforward to do using Boto3; you're responsible for generating the signature and stitching everything together. For those needing signed urls, the Boto3 crew have given a nice, succinct example in their docs.

While Amazon's doc give a good tutorial of how to do it by hand, I couldn't find a decent Python sample, so I wrote one.

It's written for Python3, but should be easy to modify it to work on 2 and the only dependency is the cryptography library.

Check out the script on GitHub.