Tuesday, February 17, 2009

Amazon EC2 Server Setup

Assuming you already created account on AWS ans S3 so you will be having:
EC2 Private Key
EC2 Certificate Key
User ID
S3 access key
S3 secret key

Download Amazon EC2 API Tools from here:

The command line tools used here require Java version 5 or later to run. Either a JRE or JDK installation is acceptable.

Unzip it at some location.
Let say on /root/amazon
Also assuming you have your EC2 Private Key & EC2 Certificate Key at /root/amazon/ec2

Set these in your environment. Open .bash_profile file and add these entries as below:


export PATH

export JAVA_HOME

export EC2_HOME


export EC2_CERT

After closing the .bash_profile file run the following command:
source .bash_profile

Finding a Suitable AMI:
ec2-describe-images -o self -o amazon | grep machine
ec2-describe-images | grep public

Generating a Keypair:
ec2-add-keypair gsg-keypair
Save the output content in a file (ex: id_rsa-gsg-keypair)

chmod 600 id_rsa_gsg-keypair

ec2-run-instances ami-86e90eef -k id_rsa_gsg-keypair
Note down the instance id (i-56a32e3f). This may be different for you.

ec2-describe-instances i-56a32e3f

(Note the Public URL ec2-174-129-185-64.compute-1.amazonaws.com, this may be different for you)

Authorizing Network Access to Your Instances:
ec2-authorize default -p 22
ec2-authorize default -p 80

Connecting to your Instance:

ssh -i id_rsa_gsg-keypair root@ec2-174-129-107-244.compute-1.amazonaws.com

root@my-instance #
After login to the ec2 server start the services
Start the Apache Web Server:
[root@ip-xx-xxx-xx-xxx:~] /etc/init.d/httpd start
Start the MySQl Server
[root@ip-xx-xxx-xx-xxx:~] /etc/init.d/mysqld start
Start the Asterisk Server
[root@ip-xx-xxx-xx-xxx:~] amportal start

Point the browser at:

Congratulations !! you have running Asterisk server with FreePBX and latest sugar.
To Access sugar:
(User/Pass: admin/admin)

No comments:

Whats new in Ajuby 0.5