Tags Posts tagged with "aws"



Kebetulan lagi nangani soal cloud service. Jadi langsung aja basic knowlegde tentang ini. First off you will need to create an account with Amazon AWS http://aws.amazon.com I will assume you have done that successfully and navigated your way to the AWS Management Console.

I will also assume that you are running in windows on your local machine but that will only affect which program you use for SSH.

AWS Management Console

AWS Managment Console

You will see on the above screen shot that I am running in region EU West, this tutorial will work in any region but that one is closest to me, so select the one closest to you.


Fist you will need to create a security Key pair so under the Navigation group (on the left) Network & Security select Key Pairs and click create a key pair, I called mine businessPhonebook (for reasons that I wont go into here) but call yours what you like.

Click instances under the Navigation menu.

Click the Launch Instance Button

Launch Instance AWS

Select the top one “Amazon Linux includes the EC2 AMI tools” and continue.

Create AWS Instance

You can edit the details here to change security groups etc but I will assume this is your first time so just click Launch. Note that the key pair has selected the only existing one, in my case businessPhonebook.

Return to the Instances menu and you will see your new Server/Instance running there. It’s not actually of much use at the moment, we need to create our LAMP stack (Linux Apache MySQL PHP)

If you highlight your instance and scroll down in the window below you will see that it has a Private IP Address but this is of little practical use to you at this stage. It also has a Public DNS and a Private DNS, you can use the Public DNS to access your server from the net but it is best to associate an Elastic IP with your instance, this will allow you to switch server very quickly a key part of running in the cloud, so we will do that now.

in the Navigation/Network & Security menu select Elastic IP and click allocate New Address (“EIP used in” should be EC2) you will then see that an IP address that has been allocated to your account (note if you leave one of these ip’s vacant ie not attached to a running instance they charge you, not huge but it adds up)

Highlight the new IP address and click associate address, select the instance you want to associate this ip to. We then return to the IP menu and you will see that it has been attached to your running instance. If you stop your instance you will probably need to re associate your ip once again on restart.

Go back to instances page and note the name of the security group your instance has been assigned to, this was very likely newly created when you launched your instance.

Lets just check that you have the necessary settings in your security group select Navigation/Network & Security/Security Groups. Select the group and click Inbound.

AWS security Group

If it does not appear like that make the necessary changes, by adding new rules you must click the Apply Rule Changes to invoke them after you are done adding.



Download PuTTY & PuTTYgen from the net http://www.chiark.greenend.org.uk/~sgtatham/putty/, putty will allow you to SSH to your remote sever and do the necessary set up for your LAMP stack, now this bit can be tricky so pay attention.

You are going to need Puttygen as this will allow you to convert you key file (.PEM) as created when you saved it to a secure location via AWS to a (.PPK) file as used by Putty

Run Puttygen do file/Load Private Key and locate the security key created via AWS, follow the instructions and then export using the save Private key option.

Now close PuttyGen and open Putty.

Enter in your elastic ip address into the IP address box set the port to 22 and make sure the SSH connection type radio button is checked, then under the category menu select SSH/Auth, browse to your private key select it then click open, it should then load SSH on your instance.

At login enter “ec2-user” and any password security key if you set one (not explained here).

Kalau dengan Mac OS X contoh:

ssh -i CustomerDashboard.pem ec2-user@ec2-xxx-xxx-xxx-xxx.ap-southeast-1.compute.amazonaws.com

Dimana  CustomerDashboard.pem didapat dari installing Instance pada tahap awal.

Now the Fun Bit we need to create MySQL and PHP

set your privileges to root using

sudo -i

install MySQL

yum install mysql mysql-server mysql-libs

Start MySQL

/sbin/service mysqld start

then set MySQL it to auto start at boot time

chkconfig –levels 235 mysqld on

Now set a MySQL root password

mysqladmin -u root password ‘my-password’

Then we install PHP and Apache

yum install httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

That will give you a basic installation of PHP with mySQL support you can add more components later if required.

Restart Apache

/etc/init.d/httpd restart

Set Apache to auto load on restart

chkconfig –levels 235 httpd on

then open a browser to http://<your IP>/

and the Apache test page should load.

Apache Default

you now have a Lamp stack your publicly accessible internet root directory (where you put your webpage) is at /var/www/html

You can configure an FTP application that supports SSH to upload files, something like Core-FTP LE will do the trick, you will need to set it up to use your security keys etc



PHPMyAdmin is useful, so to install that do the following

Run Putty again as above

set root privileges

sudo -i

download phpmyadmin

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Install phpmyadmin

yum install phpmyadmin

now using nano we set the configuration file I am going to allow access to this instance of MySQL from anywhere but it is not really best practice so I suggest you modify this when you do a release of your site, but for test purposes this will be fine.

nano /etc/httpd/conf.d/phpmyadmin.conf

where it says “Deny from All” change it to “Allow from All” close nano using <control> X and follow the instructions to save the file.

then edit the config file using

nano /usr/share/phpmyadmin/config.inc.php

where it says $cfg[‘Servers’][$i][‘auth_type’] = ‘cookies’; change ‘cookies’ to ‘http’ and close nano again using <control> X

Restart apache

/etc/init.d/httpd restart

load phpmyadmin with

http://<your IP>/phpmyadmin

And you are now at home on your new LAMP server with phpmyadmin support.


Hope that helped


Sumber: http://www.courtrade.com/blog/aws-basic.html


Install rubygems:
$ yum install -y rubygems

Install the backup gem:
$ gem install backup

Install dependencies for backup gem:
$ yum install ruby-devel
$ yum install -y rubygem-nokogiri
$ yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
$ gem install fog -v ‘~> 1.4.0’
$ gem install parallel -v ‘~> 0.5.12’
$ gem install mail -v ‘~> 2.4.0’

Generate a backup model:
$ backup generate:model –trigger <server hostname> –storages=’s3′

Edit the systems backup model to configure settings:
$ vim /root/Backup/system_hostname.rb

Modify backup model:
Change split_into_chunks_of value from “250” to “4000”.
(This specifies the upper single entity file size limit)

Remove default store_with S3 DSL block and replace with the following:

sync_with Cloud::S3 do |s3| s3.access_key_id = "my_access_key_id" s3.secret_access_key = "my_secret_access_key" s3.bucket = "my-bucket" s3.path = "/backups" s3.mirror = true s3.directories do |directory| directory.add "/var/apps/my_app/public/videos" directory.add "/var/apps/my_app/public/music" end end
(Modify accordingly to match the S3 URI details and the directories you want to add)

Add email notification options to the backup model:

notify_by Mail do |mail|
mail.from = '-@-'
mail.address = 'smtp.gmail.com'
mail.port = 587
mail.user_name = ''
mail.password = ''
mail.authentication = 'plain'
mail.enable_starttls_auto = true
mail.to = ''
mail.on_success = false
mail.on_warning = false
mail.on_failure = true

Install “whenever” ruby cron gem:
$ gem install whenever

Schedule “whenever” job to execute backup model:
$ touch /tmp/schedule.rb

Add the following to the schedule.rb file:

every 15.minutes do
command "backup perform --trigger <backup model name>"

Install the “whenever” cronjob:
$ whenever –update-crontab <backup model name>


To allow traffic to pass in and out of an instance with two elastic network interfaces, manual routes need to be added inside the instance to control TCP/IP traffic:

The following commands can be run to enable routing for a secondary interface:

– Assuming a VPC network of
– Assuming a VPC subnet of
– Assuming a secondary ENI of

# echo “200 admin” >> /etc/iproute2/rt_tables
# ip route add default via dev eth0 table admin
# ip rule add from table admin
# ip rule add to table admin
# ip route flush cache
# ip route show