Amazon EBS volumes are network-attached and persist independently from the instance lifespan. EBS storage volumes can be attached to a running Amazon EC2 instance and exposed as a device within the instance. You can mount multiple EBS volumes on one EC2 instance; however, you can't mount one EBS volume on multiple EC2 instances. You can create a snapshot of a volume (which is stored on Amazon S3) from which you can create as many identical volumes as needed.
Note: Amazon EC2 API Tools are required. You must have at least version 1.3-24159:
Code:
C:\cd %EC2_HOME%\bin C:\ec2tools\bin> ec2ver 1.3-24159 2008-05-05
To set up Amazon EBS
- Get the latest pre-built Wowza Media Server for Amazon EC2 Amazon Machine Image (AMI).
- Start a new instance:
Note the Instance ID (i-111111).Code:C:\ec2tools\bin> ec2-run-instances -z us-east-1a --key mykeypair ami-78f71311 RESERVATION r-5400d63d 857774236421 default INSTANCE i-111111 ami-78f71311 pending wowza_keypair 0 m1.small 2008-09-04T21:31:25+0000 us-east-1a aki-a71cf9ce ari-a51cf9cc
- Check to see if the new instance is running:
Note the external dns (ec2-75-101-203-182.compute-1.amazonaws.com).Code:C:\ec2tools\bin> ec2-describe-instances i-111111 RESERVATION r-5400d63d 857774236421 default INSTANCE i-111111 ami-78f71311 ec2-75-101-203-182.compute-1.amazonaws.com domU-12-31-39-00-88-C3.compute-1.internal running wowza_keypair 0 8ED157F9 m1.small 2008-09-04T21:31:25+0000
- Create a new EBS volume:
Note the new volume ID (vol-VOLAAA).Code:C:\ec2tools\bin> ec2-create-volume -z us-east-1a -s 10 VOLUME vol-VOLAAA 10 us-east-1a creating 2008-09- 04T21:43:45+0000
- Check the new volume:
Code:C:\ec2tools\bin> ec2-describe-volumes vol-VOLAAA VOLUME vol-VOLAAA 10 us-east-1a available 2008-09- 04T21:43:45+0000
- Attach the new volume to the new instance on device /dev/sdh:
The new EBS volume is prepared.Code:C:\ec2tools\bin> ec2-attach-volume -d /dev/sdh -i i-111111 vol-VOLAAA
- Now open a secure Telnet (SSH) connection to the instance to format and mount the new EBS volume.
xfs file system is recommend. You might have to install:
Code:[root@~]# yum install xfsprogs Installed: xfsprogs.i386 0:2.9.4-4.fc8 Complete!
- Format and mount the new volume:
Code:[root@~]# mkfs.xfs /dev/sdh [root@~]# echo "/dev/sdh /wmscontent xfs noatime 0 0" >> /etc/fstab [root@~]# mkdir /wmscontent [root@~]# mount /wmscontent
- The new EBS volume is ready to use. Copy your content to it via FTP, load from Amazon S3 (S3Sync), or copy from the instance storage.
- Now open the [install-dir]/conf/yourApp/Application.xml file in a text editor and update the StorageDir property with the location of the new EBS volume:
Code:<Streams> <StreamType>default</StreamType> <StorageDir>/wmscontent</StorageDir> </Streams>
- Restart Wowza Media Server. Your app should be able to play videos from the new volume.
When your EBS volume is full, you can make a snapshot of it and save it on Amazon S3. The snapshot can also be used to create identical new volumes.
To create a EBS volume snapshot
- Using Amazon EC2 tools, create a snapshot of the EBS volume:
Note the new snapshot ID (snap-111111).Code:C:\ec2tools\bin> ec2-create-snapshot vol-VOLAAA SNAPSHOT snap-111111 vol-VOLAAA pending 2008-09-05T11:42:06+0000
- Check progress of the snapshot creation:
Code:C:\ec2tools\bin> ec2-describe-snapshots snap-111111 SNAPSHOT snap-111111 vol-VOLAAA completed 2008-09-05T11:42:06+0000 100%
The snapshot is saved on Amazon S3 and can be used to create new volumes to be mounted on other EC2 instances.
You can use the above snapshot to create a new EBS volume that's already formatted and loaded with content.
To create a new EBS volume from a snapshot
- Create another EC2 instance:
Note the instance ID (i-IIII2222).Code:C:\ec2tools\bin> ec2-run-instances -z us-east-1a --key mykeypair ami-78f71311
- Create another EBS volume using the above snapshot (snapshot ID=snap-111111):
Code:C:\ec2tools\bin> ec2-create-volume -z us-east-1a --snapshot snap-111111 vol-VOLBBBB
- Attach the new EBS volume to the new EC2 instance:
Code:C:\ec2tools\bin> ec2-attach-volume -d /dev/sdh -i i-IIII2222 vol-VOLBBBB
- Mount the new volume on the new instance. This is the same as above except that new volume is already formatted and has the content saved from the first volume that you snapshotted.
Code:[root@~]# echo "/dev/sdh /wmscontent xfs noatime 0 0" >> /etc/fstab [root@~]# mkdir /wmscontent [root@~]# mount /wmscontent
- Clean up.
Unmount the EBS volume:
Using EC2Tools:Code:[root@~]# umount /wmscontent
Code:C:\ec2tools\bin> ec2-detach-volume vol-VOLAAA C:\ec2tools\bin> ec2-delete-volume vol-VOLBBB C:\ec2tools\bin> ec2-delete-snapshot snap-111111 C:\ec2tools\bin> ec2-terminate-instances i-111111 C:\ec2tools\bin> ec2-terminate-instances i-IIII2222
References
- Click here, if you are having problems or would like to discuss this article.
- Leave a comment below, if there is some aspect of this article you would like to see changed or improved.


Article List
Categories