backup AWS script using rsync and ssh

#
rsync -av -e ssh directory_name [email protected]:/Volumes/disk/BK-svr-london
# 
rsync -avz -e 'ssh -i 遠端的KEY' 遠端帳號@遠端IP:遠端目錄 近端目錄
#

——
——
example:

cat RUN_backup_aws.sh 
#/bin/sh
/usr/bin/rsync -avz -e 'ssh -i /home/xxx/_AWS/key_xxx.pem' [email protected]:/etc /home/xxx/_AWS/BACKUP
/usr/bin/rsync -avz -e 'ssh -i /home/xxx/_AWS/key_xxx.pem' [email protected]:/var/www /home/xxx/_AWS/BACKUP
/usr/bin/rsync -avz -e 'ssh -i /home/xxx/_AWS/key_xxx.pem' [email protected]:/home/ec2-user /home/xxx/_AWS/BACKUP

Amazon / AWS / EC2 linux version

cat /proc/version

Linux version 2.6.35.11-83.9.amzn1.x86_64 ([email protected]) (gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC) ) #1 SMP Sat Feb 19 23:42:04 UTC 2011

 

file /bin/bash

/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

 

cat /proc/cpuinfo

 

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Xeon(R) CPU           E5430  @ 2.66GHz
stepping	: 10
cpu MHz		: 2659.998
cache size	: 6144 KB
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu tsc msr pae cx8 cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht pbe syscall nx lm constant_tsc up arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm tpr_shadow vnmi flexpriority
bogomips	: 5319.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 38 bits physical, 48 bits virtual
power management:

 

amazon aws ami LAMP / NGINX / PHP / memcache steps

// —–




Using NGINX + PHP5-FPM
sudo apt-get install nginx php5-fpm php5-mysql
cd /etc/init.d/
sudo service apache2 stop
sudo update-rc.d -f apache2 remove

http://yoodey.com/how-install-configure-nginx-php-fpm-memcached-work-drupal-7-ubuntu-1010-maverick



Install Memcached
sudo apt-get install memcached libmemcached-dev php5-memcached php5-memcache


// ====================

Getting a new virtual machine up and running from the default AMI is easy.  Here’s my cookbook:
Install basic services

    yum install mysql mysql-server mysql-devel
    yum install httpd httpd-devel
    yum install php php-devel php-mysql php-gd php-dom php-pear php-json
    yum install svn

Configure those services to start at boot

    chkconfig –level 345 httpd on
    chkconfig –level 345 mysqld on
    chkconfig –list

Install APC

I couldn’t find a package, and this bug report explains why we have to use the beta.

    yum install gcc pcre-devel
    pecl install apc-beta
    echo extension=apc.so > /etc/php.d/apc.ini

Install memcached

    yum install libevent libevent-devel
    curl -O http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
    cd memcached-1.4.5
    ./configure
    make ; make install
    /usr/local/bin/memcached -u nobody -d -m 30 -l 127.0.0.1 -p 11211



// ----
<pre>
[root@ip-10-130-9-23 log]# cat /etc/fstab 
#
LABEL=/     /           ext4    defaults,noatime  1   1
tmpfs       /dev/shm    tmpfs   defaults        0   0
devpts      /dev/pts    devpts  gid=5,mode=620  0   0
sysfs       /sys        sysfs   defaults        0   0
proc        /proc       proc    defaults        0   0
[root@ip-10-130-9-23 log]# cat /etc/mtab 
/dev/xvda1 / ext4 rw,noatime 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0

</pre>

Amazon AWS EC2 service / cloud / 雲端

Dear EC2 Customer,
You recently reached a limit on the volume of email you were able to send out of SMTP port 25 on your instance:

Instance ID: i-9b8924ce
* IP Address: 1.2.3.4
* Start date: 2011-06-01 22:47 +0000

In order to maintain the quality of EC2 addresses for sending email, we enforce default limits on the amount of email that can be sent from EC2 accounts. If you wish to send larger amounts of email from EC2, you can apply to have these limits removed from your account by filling out our online request form.

If you are unaware of your instance having sent emails, we advise checking your instance application(s) to confirm that this activity was intended. It is your responsibility to ensure that your instances and all applications are secured against unauthorized use. For suggestions on securing your instances, visit aws.amazon.com/security.

Regards,
Your Amazon Web Services EC2 team

—–

5/20
amzn-ami-2011.02.1.x86_64-ebs (ami-6ef08e3c)
Description: Amazon Linux AMI x86_64 EBS
Status: available
Platform: Amazon Linux
Image size: 8 GB
Visibility: Public
Owner: amazon (137112412989)

processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 23
model name    : Intel(R) Xeon(R) CPU           E5430  @ 2.66GHz
stepping    : 10
cpu MHz        : 2666.760
cache size    : 6144 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu tsc msr pae cx8 cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht pbe syscall nx lm constant_tsc up arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 lahf_lm tpr_shadow vnmi flexpriority
bogomips    : 5333.52
clflush size    : 64
cache_alignment    : 64
address sizes    : 38 bits physical, 48 bits virtual
power management:

5/14
Install MySQL

# yum install mysql mysql-server mysql-libs

Start the service and configure it to start automatically at boot time

# /sbin/service mysqld start

# chkconfig –levels 235 mysqld on

# yum install httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
# /etc/init.d/httpd restart
# chkconfig –levels 235 httpd on

5/13

/etc/ssh/sshd_config and set “PasswordAuthentication” to YES

5/12

Amazon Linux AMI : http://aws.amazon.com/amazon-linux-ami/

 

2011.0512:

Amazon Machine Images = AMI

http://aws.amazon.com/articles/4261?_encoding=UTF8&jiveRedirect=1

Linux

Depending on your distribution, you can likely install everything you need via yum or apt-get; Apache Friends XAMPP, BitNami LAMPStack, BitNami LAPPStack

 

Amazon EC2 AMIs

BitNami LAMPStack

 

 

參考設定: ADSL / DDWRT 動態 IP 用 DynDNS 設定 DNS 及 Google Apps

—–

/home/ec2-user/inadyn/bin/linux/inadyn –username userid –password userpassword –alias demo.monster.tw &

 

amazon linux AMI : install LAMP command :

yum install httpd php php-mysql php-gd  php-pear php-xml php-xmlrpc

 

 

 

 

2010. Nov 26, : 原來這就是 Amazon Elastic Compute Cloud (Amazon EC2) 呀…..

 

URL : Amazon 送的網站 http://amazon.monster.tw/ , 申請很簡單, 一下子就有 free 的 VM 可用囉.

Read more