Below is the simple code to create sql script of database on Amazon EC2 server using “mysqldump”…
then upload this sql script to Amazon S3 bucket using command line S3 tool “s3cmd”…
<?php
$sqlbackup=”/usr/bin/mysqldump -v -u root -h localhost -r /var/www/html/backup/”.date(”Y-m-d-H-i-s”).”_db.sql -pdbusername databasename 2>&1″;
exec($sqlbackup, $o);
echo implode(”<br /> “, $o);
$file = “/var/www/html/backup/”.date(”Y-m-d-H-i-s”).”_db.sql”;
$bucket = “s3bucketname”;
exec(”/usr/bin/s3cmd put –acl-public –guess-mime-type –config=/var/www/html/.s3cfg “.$file.” s3://”.$bucket.” 2>&1″, $o);
echo implode(”<br /> “, $o);
?>

Amazon Elastic Block Storage (EBS)
We can use Amazon EBS just like as the CD/DVD/Pen Drives on our PC/Laptops Servers for backup or data transfer…
EBS can attach to an EC2 instance, we can use EBS to save work files in it.. for it we have to mount it in the instance after backup we can unmount it, and detach it.
We can use the volume afterward by mounting it in another instance but different instances at the same time can not use same EBS volume.
# ec2-describe-images -o self -o amazon | grep machine
# ec2-add-keypair gsg-keypair (save this keypair for connecting instance via SSH)
# chmod 600 id_rsa-gsg-keypair ; ls -l id_rsa-gsg-keypair
# ec2-run-instances ami-235fba4a -k gsg-keypair
# ec2-describe-instances i-ae0bf0c7
Authorize ports to connect remotely…
# ec2-authorize default -p 22
# ec2-authorize default -p 80
Connect to instance
# ssh -i id_rsa-gsg-keypair root@ec2-67-202-51-223.compute-1.amazonaws.com
Create the Volume
# ec2-create-volume –size 1 -z us-east-1c
Create this volume in same availability zone
# ec2-describe-volumes vol-4771e479
Attaching the Volume
# ec2-attach-volume vol-4771e479 -i i-ae0bf0c7 -d /dev/sda
Formatting the Volume
# ssh -i id_rsa-gsg-keypair root@ec2-67-202-51-223.compute-1.amazonaws.com
# ls /dev
# yes | mkfs -t ext3 /dev/sda
Mounting the Volume
# mkdir /mnt/svnlabs-data
# mount /dev/sdh /mnt/svnlabs-data
Put a file on the volume
# vi /mnt/svnlabs-data/svnlabs.txt (put content here)
Unmounting the Volume
# cd ~
# umount /mnt/svnlabs-data
Detach the Volume
# ec2-detach-volume vol-4771e479 -i i-ae0bf0c7 -d /dev/sda
As we attach this volume to other instance we will get our svnlabs-data folder to new instance…
svnlabs will post some new articles on “Amazon Web Services”
subscribe to svnlabs feeds
1.Boot 2 linux servers on EC2
2.Assign elastic IP to each of them
3.Register a domain (eg svnlabs.com)
4.On the domain settings – create 2 host records – ns1.svnlabs.com and ns2.svnlabs.com and point each record to each of the elastic IPs.
5.On your 2 nameserver instances – create dns zone for ns1. and ns2 respectively
6.Make ns2 a slave of ns1 – you can if you wish add ns3… ns4.. etc etc but its not necessary unless your site is getting millions of users.
7.Boot another EC instance and install the Scalr application.
8.Create a user on ns1. called “named” that has permissions to update the dns zone records on ns1.
9.The DNS settings of the scalr application will refer to the nameservers ns1. with user “named” and password as set on ns1.
10.Your application for example will have the domain svnlabs.com. Register this domain and set its nameservers to your ns1. and ns2 mentioned previously.
11.You need to first create a new zone file on ns1 for svnlabs.com
12.In Scalr when asked for the application domain name – simply enter svnlabs.com – and scalr will handle the rest.
****************************************************************
You will need to register a domain name with a domain registrar. After registering, you will need to enter your NS records for the domain name. The NS records should point to a Domain Name Server (DNS). Most registrars require at least two DNS servers to eliminate a single point of failure.
Some registrars provide free DNS services. If you choose such a registrar, you would need to add a CNAME record for your sub-domain and ask any DNS application support related questions to your registrar.
Alternatively, you can launch and configure your own DNS servers on Amazon EC2. A popular choice for Linux based DNS servers is BIND: http://en.wikipedia.org/wiki/BIND
Another option is to outsource your DNS servers using a third-party provider, for example http://www.dyndns.com/.
http://groups.google.com/group/scalr-discuss/web/how-to-host-your-mx-on-google
Cost: http://bhopu.com/Tags/Amazon-EC2