User guide
37
Using Adobe Media Server on Amazon Web Services
Last updated 8/28/2014
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.