Adobe Media Server 5.0 offers media publishers some new ways to deliver on-demand video and music to iOS devices through Apple's HTTP Live Streaming. This means that using AMS 5.0, you can publish Adobe HDS live, Apple HLS live, Adobe HDS on-demand with just-in-time packaging, and Apple HLS on-demand.
These are the steps required to install Adobe Media Server 5.0 on AWS EC2. This is a self-managed solution. If you want a fully-managed solution, try Orbitera's package which will cost around $400/month.
Technology Stack
There's a lot going on here so let's first itemize the tools we'll be using beforehand:
- Adobe Media Sever with Apache 2.2
- AWS EC2
- 3.2GHz Intel® Pentium® 4 processor (dual Intel Xeon® or faster recommended)
- 8Gb RAM
- AWS S3
- AWS IAM
Here's a list of recommended EC2 machines for AMS.
Step 1 - Create an S3 Bucket
Visit the S3 Console to create a bucket for your private media.
I will call my bucket "my-media-bucket".
Step 2 - Create an IAM User w/ bucket permissions
You will need an IAM user to mount buckets to your server.
- Visit IAM Console
- Create a new user with "programmatic access only".
- Add this policy file to user.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*"
],
"Resource": "arn:aws:s3:::my-media-bucket*"
}
]
}
Step 3 - Managing Firewalls
AWS's Firewalls are managed through Security Groups. The security group Adobe recommends includes one unique port numbered 1935.
TYPE | Protocol | Port Range | Source
HTTP | TCP | 80 | 0.0.0.0/0
CUSTOM | TCP | 1935 | 0.0.0.0/0
CUSTOM | UDP | 1935 | 0.0.0.0/0
SSH | TCP | 22 | 0.0.0.0/0
HTTPS | TCP | 443 | 0.0.0.0/0
Port 1935 is specifically used for RTMP protocol and we won't be needing this but it's how Adobe delivers Flash video.
Step 4 - Launch an EC2 Instance
Note: Adobe Media Server on Amazon Web Services does not support Spot Instances or Virtual Private Clouds (VPC).
Find a CentOS package that is close to this:
- AWS Marketplace > CentOS 7 (x86_64) - with Updates HVM
- General Purpose + t2.large
- 8GB of RAM
While creating your new EC2 instance, you can create special scripts that will help you automate your computer's reboot.
Add this script to User Data.
#! /bin/sh
###########################################
# Objective:
# Mount a private S3 bucket full of media.
# This project will mount buckets from S3 into the FMS/AWS server and copy them over during a reboot.
###########################################
S3FS=/usr/local/bin/s3fs
FMS_DIRECTORY=/mnt/webroot/vod/audio
AMS_DIRECTORY=/opt/adobe/ams/webroot/vod/audio
PASSWORD_ENV_VAR=/etc/passwd-s3fs
#Get your public and private access keys and place them in a special passwords file
echo "USERNAME-IAM-ACCESS-KEY-A:PASSWORD-IAM-ACCESS-SECRET" >> ${PASSWORD_ENV_VAR}
#Set the permissions of the passwords file
chmod 640 ${PASSWORD_ENV_VAR}
#Create a new Audio Directory within the video on demand folder
rm -rf ${FMS_DIRECTORY}
mkdir ${FMS_DIRECTORY}
#Set the permisisons
chmod -R 667 ${FMS_DIRECTORY}
###########################################
# App Specific Info
###########################################
S3_BUCKET=my-media-bucket
MUSIC_S3_MOUNT=/mnt/s3-bucket-music
#Create a new directory where your s3bucket will mount
rf -rf ${MUSIC_S3_MOUNT}
mkdir ${MUSIC_S3_MOUNT}
#Mount the S3 bucket to your new directory. I like to name them the same thing to keep things organized
#The reason you put it in the /mnt directory is because it has the most alloted disk space
${S3FS} ${S3_BUCKET} -o use_cache=/tmp -o allow_other,uid=500,gid=500 ${MUSIC_S3_MOUNT}
#Run any special shell scripts. This is where I run my cp /* files Webroot directory
chmod 777 ${MUSIC_S3_MOUNT}/setup.sh
${MUSIC_S3_MOUNT}/setup.sh
#Copy files from the bucket
cp -v ${MUSIC_S3_MOUNT}/* ${FMS_DIRECTORY}
Step 5 - Configure CentOS
How to log into your EC2 instance.
ssh -i /path/to/file.pem centos@ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com
Once you've logged in, switch over to Super User.
sudo su
Install Fuse and Fuse Develop.
yum remove fuse s3fs
Before you can mount a bucket, you need to install these packages:
yum install gcc libstdc++-devel gcc-c++ curl-devel libxml2-devel mailcap openssl-devel fuse fuse-devel
Configure s3fs with your access key. Paste your access key from Step 1.
echo "USERNAME-IAM-ACCESS-KEY-A:PASSWORD-IAM-ACCESS-SECRET" >> /etc/passwd-s3fs
Make sure the password key has proper permissions:
chmod 600 /etc/passwd-s3fs
Step 6 - Install Fuse + S3FS
Before mounting the S3 bucket to an EC2 instance, you first need to install two tools: Fuse and S3Fs. You need Fuse before you can install s3fs.
Install Fuse 2.9.7. There may be a newer release but I can guarantee this one works. Please enter each command one by one.
cd /usr/local/src
wget https://github.com/libfuse/libfuse/releases/download/fuse-2.9.7/fuse-2.9.7.tar.gz
tar -xzvf fuse-2.9.7.tar.gz
rm -f fuse-2.9.7.tar.gz
mv fuse-2.9.7 fuse
cd fuse/
./configure --prefix=/usr
make
make install
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig/
ldconfig
Double check your Fuse install.
pkg-config --modversion fuse
S3FS is the actual tool that does the mounting.
yum install automake wget git
git automake
git clone https://github.com/s3fs-fuse/s3fs-fuse
cd s3fs-fuse/
./autogen.sh
./configure --prefix=/usr --with-openssl # See (*1)
make
sudo make install
Double check your s3fs:
s3fs --version
Step 7 - MOUNT S3 Bucket
Mount in Debug mode
s3fs my-bucket /path/to/mountpoint -o passwd_file=/etc/passwd-s3fs -o dbglevel=info -f -o curldbg
Step 8 - Install AMS 5.0
Go to the tmp directory.
cd /tmp
wget
tar -xzvf AdobeMediaServer_5_LS1_linux64.tar.gz
cd AMS_5_0_6_r6102
./installAMS
Step 9 - Recap
If you want to deliver files via HTTP (port 80), this is where you will want to store your media files.
cd /opt/adobe/ams/webroot/vod
Once you store the files there, you have three different ways to access the data.
Method 1 - HTTP Stream (Basic)
If you have an Mp3 file, this is the URL path.
http://xx.xx.xx.xx/vod/file.mp3
Method 2 - HTTP Dynamic Stream (Android)
If you want to unlock HTTP Dynamic streaming, then you'll first modify the directory path to /hds-vod
and append an extra extension of f4m
to the file.
http://xx.xx.xx.xx/hds-vod/file.f4v.f4m
Method 3 - HTTP Live Stream (iOS)
If you want to unlock HTTP Live streaming, then you'll want to modify the directory pat to /hls-vod
and append m3u8
.
http://xx.xx.xx.xx/hls-vod/file.mp4.m3u8
Step 9 - Visit Admin Console
If you want to see the Administrative console on Adobe Media Server, here's the URL.
http://localhost/ams_adminConsole.htm
File Structure
- AMS Config Files
/opt/adobe/ams/conf
- Logs
/mnt/logs
- Apache Configuration
/opt/adobe/ams/Apache2.2/
- Apache Webroot directory
/opt/adobe/ams/webroot/vod
- Flash Applications
/mnt/applications
Resources
Adobe Notes
Mounting an S3 Bucket
You'll need to learn how to install fuse and s3fs before you can mount an S3 bucket to the media server.
Preparing Media for iOS
- Configure HTTP Dynamic Streaming and HTTP Live Streaming using AMS
- URL Examples of Streaming On-Demand Media
- Preparing Media for Delivery to iOS-Based Devices
APACHE
Digital Rights Management
Flash Client Players
Deploying Rails 5.x on AWS ElasticBeanstalk using AWS CodeCommit
How to deploy your Rails app on ElasticBeanstalk (including S3 buckets, security groups, load balancers, auto-scalling groups and more) using CodeCommit.