While experimenting with Amazons interpretation of cloud computing, here is what I did to create persistent storage, create an instance and attach the storage to the instance.
Go to Amazons developer section and download, unpack and install the files. Now edit ~/.bashrc (or any other file that is executed at login) and add this:
export EC2_PRIVATE_KEY=$(ls $EC2_HOME/pk-*.pem)
export EC2_CERT=$(ls $EC2_HOME/cert-*.pem)
Check out the wonderful section on Paul Stamatiou's website at "Getting Started". It describes how to create and use the keys.
You will have to authorize access from the internet to port 22 and 80, or any other. Here is how it's done:
ec2-authorize default -p 22
ec2-authorize default -p 80
defaultrefers to all machines unless specified differently.
An instance can be seen as an individual machine. It's virtual, but who cares about that? I use the image "ami-2a0f275e", but see other images can be used as well. Use
ec2-describe-images -o amazon to get a list of available images owned (-o) by amazon.
ec2-run-instances -z eu-west-1a -k ec2-keypair ami-2a0f275e
To allocate some space on the S3 infrastructure of Amazon, use this command:
ec2-create-volume -s 1 -z eu-west-1a
When the volume is created; assign it to an instance with this command:
ec2-attach-volume vol-38a24751 -i i-c2f2c5b6 -d sdb
ec2-describe-volumesto get a list of available volumes.
ec2-describe-instancesto get a list of available instances.
dmesgto see if attaching has worked. This is the ouput I got:
dmesg | tail -n 1
sdb: unknown partition table
Login to your machine using SSH:
ssh -i .ec2-keypair [email protected]
Now that you are ready, login and type:
Mount the volume (once) by issuing:
mount /dev/sdb /mnt
You can continue to use the instance with this "static" IP, but to associate one IP with this instance, follow these steps. First register an IP:
Now link the IP with an instance.
ec2-associate-address 126.96.36.199 -i i-0ca09678
The Amazon elastic compute cloud and S3 facilities work great, I'm not sure about the availability of EC2, not about S3, but Amazon states that S3 should be more "secure" then storing stuff in the local storage of the instance.