The following page guides the user through deployment and configuration of the SPEKE Reference Server.
- An AWS account with administrator rights and access to the AWS console
- Note that this solution can be deployed to any region that supports API Gateway, Lambda, and S3. You need to consider the packager or encoder's location relative to the API Gateway endpoint used to create encryption keys. The encoder, packager and SPEKE services should be in the same region or as geographically close as possible to reduce the request/response latency in key generation.
For ease of deployment, please use the pre-built template and Lambda binaries hosted by the project sponsors. The CloudFormation template located in the src/ folder cannot be deployed to a stack without modification. Review the build_and_host.sh to understand how to prepare the template for deployment with dependencies.
- Create a virtual environment for this project using python3.
- Install dependencies within the virtual environment using
pip3 install -r requirements.txt. - In
zappa_settings.jsonundersrc, replaceaws_regionwith the region this lambda will be deployed. - Create a
buildfolder if it doesn't exist and then runlocal_build.sh. - The script will generate required artifacts under
buildfolder. - Create a new bucket in S3 (For example:
speke-us-east-1). Create a folder calledspekeand upload the generatedspeke-referencelambda zip file. - In the generated
speke_reference.json, replacerodeolabzwith the name of your created bucket (spekeis used in this example). - Use the
speke_reference.jsontemplate in CloudFormation to deploy the speke reference server following the instructions give below.
On platforms other than AmazonLinux, one of the required dependencies: cffi is generated differently and so running the reference server might result in an error: No module named '_cffi_backend'. To resolve this, create a requirements.txt file with cffi==<version>, replacing version with the desired version number and follow the steps outlined here to create a layer and update the speke reference lambda function.
The hosted template is supported in regions: ap-northeast-1 ap-northeast-2 ap-south-1 ap-southeast-1 ap-southeast-2 eu-central-1 eu-west-1 eu-west-3 sa-east-1 us-east-1 us-west-1 us-west-2
- Sign in to the AWS console.
- Choose a region such as us-east-1 or us-west-2 to start.
- Navigate to the AWS CloudFormation console.
- Create a new stack.
- On the
Select Templatepage, provide the hosted copy of the CloudFormation template. The prepared CloudFormation template is hosted here by the project sponsors:https://s3.amazonaws.com/rodeolabz-us-east-1/speke/speke_reference.jsonand and can be launched in several AWS regions. - At the
Specify Detailspages, provide a stack name, likeSPEKE. - Provide a value for the
KeyRetentionDaysparameter. This is the amount of time to retain a key in the S3 bucket for client playback. Keys older than this amount will be automatically removed by S3. The default is 2 days, which is usually enough for live content across multiple time zones. - The
Optionspage does not require any input, although you can choose to be notified after the template completes.
When the template is complete you will have an operational reference SPEKE server that can be used for HLS encryption. You can review the Resources tab of the template to see what was created or updated, and the Outputs tab for the URL of the SPEKE server and the role ARN that permits MediaPackage access.