• How to use the FUSE-based file system backed by Amazon S3

    Wowza media server software Amazon Machine Images (AMIs) include a preinstalled s3fs package. s3fs is a Filesytem in Userspace (FUSE) virtual file system that enables you to mount an Amazon Simple Storage Service (Amazon S3) bucket as a local file system on a Wowza media server for Amazon EC2 instance. You can copy videos recorded by the Wowza media server to the directory so that they can be streamed immediately by on demand players using the vods3 application. This article describes how to use s3fs.

    Notes:

    To mount an Amazon S3 bucket using s3fs


    1. Open a secure Telnet session to your Wowza media server for Amazon EC2 instance using Secure Shell (SSH) and then create a new directory in the Telnet window:
      mkdir /mnt/s3
      For more information about how to use Telnet, see the Wowza Streaming Engine for Amazon EC2 User's Guide.

    2. Specify your security credentials (access key ID and secret access key) in a .passwd-s3fs file in your home directory:

      1. Create the s3fs password file:
        vi /etc/passwd-s3fs
      2. In the s3fs password file, insert the security credentials (access key ID and secret access key) using the following format:
        [accessKeyId]:[secretAccessKey]
      3. Save the file and then run the following command:
        chmod 640 /etc/passwd-s3fs
    3. Mount the Amazon S3 bucket:
      /usr/local/bin/s3fs your.S3.Bucket -o default_acl=public-read /mnt/s3
      Notes:
      • Earlier AMIs had the s3fs command located at /usr/bin/s3fs.

      • To ensure that the bucket is remounted when the instance is rebooted, add the above command to your /etc/rc.local file.
    4. Add the ModuleMediaWriterFileMover module definition to the configuration file for your application that records video ([install-dir]/conf/[application]/Application.xml). This module enables files that have been written/recorded to disk to be copied or moved.
      <Module>
      	<Name>ModuleMediaWriterFileMover</Name>
      	<Description>ModuleMediaWriterFileMover</Description>
      	<Class>com.wowza.wms.module.ModuleMediaWriterFileMover</Class>
      </Module>
    5. Add the following application level properties to the <Properties> container at the bottom of [install-dir]/conf/[application]/Application.xml to control where to copy the file after recording is complete:
      <Property>
      	<Name>fileMoverDestinationPath</Name>
      	<Value>/mnt/s3</Value>
      </Property>
      <Property>
      	<Name>fileMoverDeleteOriginal</Name>
      	<Value>false</Value>
      	<Type>Boolean</Type>
      </Property>
      <Property>
      	<Name>fileMoverVersionFile</Name>
      	<Value>true</Value>
      	<Type>Boolean</Type>
      </Property>
      For property details, see How to move recordings from live streams (ModuleMediaWriterFileMover)

    Note: If you need finer control of the move, you can use the IMediaWriterActionNotify interface.

    Originally Published: 10-01-2010.
    Updated: 11-02-2014.

    If you're having problems or want to discuss this article, post in our forum.