About managing content on an instance

When you launch an instance, the instance contains a new installation of Adobe Media Server for Amazon Web Services. To stream media, use an SSH client to connect to an instance and move the media and any supporting content (application folders and configuration files) to the instance.

An AMS instance uses two EBS volumes. The first volume is the primary volume that contains the installed operating system, AMS, and storage blocks. The second volume, which is the secondary volume, is mounted to the /mnt folder that contains applications, logs, and the webroot folder.

Note:

For additional information and screenshots, see Launch an Instance in “Amazon Elastic Compute Cloud Getting Started Guide”.

Before you terminate an instance, copy all the media and any supporting content, including modified configuration files, to an Amazon Simple Storage Service (S3) block or to an Amazon Elastic Block Storage (EBS) volume. Any files left on the instance are deleted when the instance is terminated. To know how to copy content, see Using Amazon Simple Storage Solution (S3) to store content and Using Amazon Elastic Block Store (EBS) to store and stream content sections.

Note:

When you terminate an instance, all content on the instance is permanently deleted. Before you terminate an instance, copy any content you’ve added or modified, including configuration files, off the instance.

Where to store content on an instance

The Adobe Media Server vod (video on demand) application has a default directory in which it looks for content (media files) to stream. However, you can configure the server to use any directory. On Adobe Media Server on Amazon Web Services, store content in any subdirectory of the following directory:

/mnt

On Amazon EC2 instances, the /mnt directory is much larger than the / directory. Therefore, on Adobe Media Server instances, the /applications, /logs, and /webroot directories are all subdirectories of /mnt.

The following table lists the default content directory and configuration location:

Application

Default content directory

Configuration location

vod

This application plays on-demand streams from the following directory:

/mnt/applications/vod/media

Flash Player and AIR clients can stream FLV files in that directory from the following URL:

rtmp://public-dns/vod/filename

Flash Player and AIR clients can stream F4V/MPEG-4 files in that directory from the following URL:

rtmp://public-dns/vod/mp4:filename.xxx

See On-demand streaming.

/opt/adobe/ams/conf/ams.ini file

VOD_DIR = /mnt/applications/vod/media

For more information about configuring the location of content on an instance, see Configuring content storage in Adobe Media Server Configuration and Administration Guide.

Set content permissions

Adobe Media Server on Amazon Web Services instances run CentOS, which is a Linux distribution. On Linux, all files and directories belong to an owner and a group. All Adobe Media Server files and directories belong to amsuser:amsgroup.

When you upload content to an instance, change the content’s owner and group to amsuser:amsgroup. Changing the owner and group to amsuser:amsgroup ensures that the server can access and manipulate the content. To change the owner of all content in a directory to amsuser:amsgroup, use the following command:

chown amsuser:amsgroup *

For more information, see Understanding Linux file permissions.

Using key pairs to connect to an instance securely

To connect to a instance, use an SSH client such as WinSCP, OpenSSH, PuTTY, or Terminal. SSH is a network protocol that allows you to connect two devices securely.

Note:

For a list of SSH clients and which platforms and protocols they support, see Comparison of SSH clients on Wikipedia.

Instead of using a password, SSH clients use a key pair to verify their identity with the server. When you launch a Adobe Media Server on Amazon Web Services instance, you generate and download a key pair. A key pair consists of a public key and a private key. The instance has a copy of the public key and you download the private key as a .pem file. Set the permissions of the .pem file used for authentication on Linux or Unix machines as 0400, using chmod 0400 filename.pem command. When you connect to the instance, pass the .pem file to the server so it can verify that the private key matches the public key.

Some SSH clients, such as WinSCP, cannot read .pem files. To use these clients, use the PuTTYgen application to convert the .pem file to a .ppk file that the client can read. The following sections explain how to convert a file.

Adobe Media Server on Amazon Web Services instances run on CentOS which is a Linux distribution. You can connect to instances from Linux operating systems, Mac OS®, Windows, and from any other operating systems that support SSH.

Note:

For more information about key pairs, see Using Public Keys for Authentication.

Connect to an instance and copy files from a Windows computer

Note:

Some companies block SSH access. If you can’t connect to an instance, contact your server administrator for SSH access.

On a Windows computer, you can use either of the following:

  • WinSCP

    WinSCP is a free SSH, SCP, and SFTP client. It has a graphical interface that you can use to copy files from a local computer to a remote computer.

  • PuTTY

    PuTTY is a free SSH client. From the PuTTY FAQ, “In really simple terms: you run PuTTY on a Windows machine, and tell it to connect to (for example) a Unix machine. PuTTY opens a window. Then, anything you type into that window is sent straight to the Unix machine, and everything the Unix machine sends back is displayed in the window. So you can work on the Unix machine as if you were sitting at its console, while actually sitting somewhere else.”

Note:

You can use other SSH clients as well. This document provides instructions for WinSCP and PuTTY, but other clients work similarly.

Use WinSCP to connect to an instance and copy files

The following example uses the WinSCP SCP client for Windows.

  1. Download and install WinSCP and PuTTYgen.

  2. Open PuTTYgen and do the following:

    1. Choose Conversions > Import Key.

    2. Browse to the .pem file and click Open.

    3. Choose File > Save Private Key.

      A dialog asks whether it’s OK to save this file without a passphrase to protect it. Click Yes.

    4. Give the file the same filename as the .pem file and click Save. PuTTYgen adds the .ppk file extension.

    5. Close PuTTYgen.

  3. Login to the AWS Management Console, and select the instance to which you want to connect. In the details pane, copy the Public DNS entry.

  4. Open WinSCP and do the following:

    1. With Session selected in the tree, paste the public DNS of your instance to the Host name field.

    2. Verify that the Port number is 22.

    3. For User name, enter amsadmin.

    4. Click ... to browse to a private key file. Select the .ppk file you created in PuTTYgen and click Open.

    5. For File protocol, select SCP.

    6. To save the settings, click Save, give the profile a name, and click OK.

    WinSCP Login screen

    Note:

    This task uses WinSCP version 4.2.9. The steps may be different on other versions of WinSCP.

  5. Click Login to connect to your Adobe Media Server for Amazon EC2 instance.

    WinSCP may display a Security Alert. Read the alert and click Yes or No.

  6. To manage files, use the graphical user interface.

    WinSCP graphical user interface. Local files are on the left. Remote files (on the Adobe Media Server instance) are on the right.

    For information about where to put files to stream, see Where to store content on an instance section.

Use PuTTY to connect to an instance and copy files

The following example uses the PuTTY SSH client for Windows. The PuTTY SSH client is available on other operating systems, as well.

For a video walkthrough of these steps, see Using AWS Management Console with Amazon EC2. The instructions for connecting to an EC2 Linux instance with PuTTY and generating a .ppk file start at the 3 minute 45 second mark.

  1. Download and install PuTTY and PuTTYgen.

  2. Open PuTTYgen and do the following:

    1. Choose Conversions > Import Key.

    2. Browse to the .pem file and click Open.

    3. Choose File > Save Private Key.

      A dialog asks whether it’s OK to save this file without a passphrase to protect it. Click Yes.

    4. Give the file the same filename as the .pem file and click Save. PuTTYgen adds the .ppk file extension.

    5. Close PuTTYgen.

  3. Login to the AWS Management Console, and select the instance to which you want to connect. In the details pane, copy the Public DNS entry.

  4. Open PuTTY.

  5. With Session selected in the tree, paste the public DNS of your instance to the Host Name (or IP address) field.

  6. In PuTTY, in the left-hand tree, expand Connection > SSH > Auth.

  7. Click Browse to locate the .ppk file you just generated, and click Open.

  8. Click Open at the bottom of the window to connect to your Adobe Media Server on Amazon Web Services instance.

    PuTTY may display a Security Alert. Read the alert and click Yes or No.

  9. At the login prompt, enter amsadmin and press Enter.

    You don’t need to enter a password, the .ppk file handles authentication. You should see an AMS banner and a prompt.

  10. To manage content, use Bash commands. For information about where to put files to stream, see Where to store content on an instance section.

Connect to an instance and copy files from a Linux/UNIX computer

Note:

Some companies block SSH access. If you can’t connect to an instance, contact your server administrator for SSH access.

Most Linux/UNIX machines have an SSH client, called a shell. On Mac OS, the shell application is called Terminal. In the shell, use the scp command to securely copy files to a Adobe Media Server on Amazon Web Services instance.

If your machine doesn’t have an SSH client, you can download one at http://www.openssh.org.

Connect to an instance

  1. Open a shell.

  2. Ensure that the permissions of the .pem file used for authentication on Linux or Unix machines is 0400. To set the permissions, use chmod 0400 filename.pem command.

    Otherwise a warning is generated and you cannot log in.

  3. Use the ssh command to connect to an instance. Use the following syntax:

    ssh -i keypair.pem amsadmin@public-dns

    For example, the following command connects to an instance:

    ssh -i /Users/AMS/Documents/amsdocs4.pem amsadmin@ec2-50-16-19-38.compute-1.amazonaws.com

    Note:

    Log in to the Adobe Media Server instance as amsadmin.

Copy content to an instance

  1. Open a shell.

  2. To copy files to a directory on the instance, use the scp command. following command:

    scp -i keypair.pem fileToUpload.xxx amsadmin@public-dns:/remote/dir/toUpload

    For example, the following command copies the file sample.f4v to the vod application on the instance:

    scp -i /Users/AMS/Documents/amsdocs4.pem /Users/AMS/Documents/sample.f4v amsadmin@ec2-50-16-19-38.compute-1.amazonaws.com:/mnt/applications/vod/media

For information about where to put files to stream, see Where to store content on an instance and Tutorials: on-demand and live streaming.

Using Amazon Simple Storage Solution (S3) to store content

Note:

According to the Amazon web site: Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, secure, fast, inexpensive infrastructure that Amazon uses to run its own global network of web sites.

Create an Amazon S3 account to store content. Adobe Media Server on Amazon Web Services installs with FuseOverAmazon (s3fs) which allows you to mount an S3 bucket as a local file system on the Adobe Media Server instance. Copy files from the S3 bucket to the /mnt/applications/vod/media directory to stream them from the vod application. Copy the files back to the S3 bucket before you terminate the instance.

Note:

Technically, it is possible to stream files from an S3 bucket. However, Adobe does not recommend it because performance may suffer. It is not technically possible to record files to the S3 bucket.

Mount an S3 bucket as a local file system

  1. Create an Amazon S3 account at aws.amazon.com/s3.

  2. Create an S3 bucket and upload media to it.

    See Amazon Simple Storage Service Getting Started Guide.

  3. FuseOverAmazon (s3fs) is installed on the Adobe Media Server on Amazon Web Services instance. FuseOverAmazon mounts the S3 bucket as a local file system on the instance.

    For information about the FuseOverAmazon command line options, see FuseOverAmazon.

  4. Locate your Access Key ID and your Secret Access Key.

    See Using Credentials > How to Get Your Access Key ID and Secret Access Key in the Amazon Web Services User Guide.

  5. Create a directory on the instance to mount the S3 bucket, for example, /mnt/s3fs.

    Note:

    Create the directory as a subdirectory of the /mnt directory because it contains the most storage space.

  6. Open a shell and issue the following command:

    echo "accessKeyId:secretAccessKey" >> /etc/passwd-s3fs 
    chmod 640 /etc/passwd-s3fs 
    /usr/local/bin/s3fs ams-test-s3fs -o use_cache=/tmp -o allow_other,uid=500,gid=500 /mnt/s3fs

    The amsuser:amsgroup can now read and write content to the S3 bucket “ams-test-s3fs”.

    Note:

    The “allow_other” option allows Adobe Media Server to read directly from the s3fs mounted device. If you don’t specify “allow_other”, Adobe Media Server cannot access files from the s3fs mount. Also, you must specify the full path to s3fs.

Use a shell script to manage content when you launch an instance

Note:

Using a shell script is optional. You can copy and manage content manually if you choose.

When you launch an instance, there is a User Data text box on the Advanced Instance Options screen. Scripts in the User Data text box that start with #! are run at runlevel 5 when an instance launches. The User Data text must be less than 16KB. To run a longer script, write it in an external file and trigger it from the User Data script. The last line of the User Data script in this example triggers an additional script.

  1. Complete steps 1-4 in the previous task.

  2. Enter the following script into the “User Data” text box when you launch an instance from the AWS Management Console. When the instance loads, it mounts the S3 bucket “ams_scripts” and executes the script “setup.sh”.

    #! /bin/sh 
    echo "accessKeyId:secretAccessKey" >> /etc/passwd-s3fs 
    chmod 640 /etc/passwd-s3fs 
    mkdir /mnt/bucket 
    /usr/local/bin/s3fs ams_scripts -o use_cache=/tmp -o allow_other,uid=500,gid=500 /mnt/bucket 
    /mnt/bucket/setup.sh

    Use the full path to s3fs.

    The option -o use_cache=/tmp is an s3fs feature that caches S3 content on the instance. When you specify this option, s3fs can use local content instead of pulling it from S3 each time the content is requested.

    The /mnt/bucket/setup.sh script is a file on S3 that runs additional configuration steps. For example, the script could modify Adobe Media Server to look for streams in the /mnt/bucket directory. The script is not provided; you must write it.

For additional information about User Data scripts, see Eric Hammond’s article Automate EC2 Instance Setup with user-data Scripts.

Using Amazon Elastic Block Store (EBS) to store and stream content

Note:

According to the Amazon web site: Amazon Elastic Block Store (EBS) provides block level storage volumes for use with Amazon EC2 instances. Amazon EBS volumes are off-instance storage that persists independently from the life of an instance. Amazon Elastic Block Store provides highly available, highly reliable storage volumes that can be attached to a running Amazon EC2 instance and exposed as a device within the instance. Amazon EBS is particularly suited for applications that require a database, file system, or access to raw block level storage.

Amazon EBS works exactly like a local file system. You can stream from an EBS volume and write to an EBS volume. The main benefit of using an EBS volume is persistent storage; when you terminate an instance, the data on the EBS volume is saved.

Note:

To prevent data loss, unmount the EBS volume before you terminate the instance.

The drawback of a local disk is that you can attach it only to a volume in the same zone. Also, you can attach only one instance to an EBS volume. You cannot boot Adobe Media Server from an EBS volume.

To create an EBS volume and attach it to a Adobe Media Server instance, do the following:

  1. Sign in to your Amazon Web Services account at https://console.aws.amazon.com/ec2.

    The AWS Management Console launches with the EC2 tab open.

  2. In the AWS Management Console, in the Navigation pane, locate Elastic Block Store and click Volumes.

  3. In the upper right corner of the EBS Volumes pane, click Help.

    A Help panel opens with complete instructions for creating, attaching, formatting, and mounting a volume.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy