Introduction
WSO2 now their all SOA products exposed in to the cloud computing technology.As a reducing cost and improving flexibility as well as a stability WSO2 SOA products now available as a private and public cloud deployments.Currently WSO2 cloud products support "Amazon EC2" as a public cloud platform and VMware,Linux KVM as a private cloud platform.In this tutorial i am going to explain how you setup and operate WSO2 EC2 cloud products within a few minutes.These are the steps need to be taken for operate WSO2 AMI instances from your command line.Setup JDK
As a prerequisites you have to setup JDK in your machine.
Step 1 : Download JDK .
Step 2: Install JDK and set JAVA_HOME environment variable.
If you are in Linux open a terminal or .bashrc and insert JAVA_HOME,
Syntax -
export JAVA_HOME=JDK file path
Example -
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.15
If you are in Windows set JAVA_HOME as a enviroment variable.
Syntax -
set JAVA_HOME=JDK file path
Example -
set JAVA_HOME=c:\\chamara\JDK1.6
Step 3: Open a terminal/command prompt and type "java -version". if you are configured JAVA_HOME correctly you will see the output like this.
Getting Private Key Files from Amazon
Step 4: Now you need amazon EC2 account for operate amazon instances.to create your own amazon account and follow the steps given there to create account.
Step 5: Once you create amazon account you will get couple of PEM-endosed x509 certificate and private key files as
cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem (A PEM encoded signed X.509 certificate)
pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem (An unencrypted, PEM encoded RSA private key that corresponds to the X.509 certificate above)
Step 6: Now download that .pem files.
Setup Amazon API Tools
Amazon API Tools package serves as the client interface of the amazon EC2 web services.to control our web servics we are using this interface.Following steps need to be follow for setup Amazon API Tools package.
Step 7: download Amazon-API tools package.
Step 8: Create a folder called "ami" in your machine,copy that "ec2-api-tools.zip" and extract it.
Step 9: Set "EC2_HOME"environment variable by locating ec2-api-tools folder.
If you are in Linux open a terminal or .bashrc and insert EC2_HOME,
Syntax -
export EC2_HOME=directorypath/ami/ec2-api-tools
Example -
export EC2_HOME=/home/chamara/ami/ec2-api-tools>
If you are in Windows set EC2_HOME as a enviroment variable.
Syntax -
set EC2_HOME=folderpath/ami/ec2-api-tools
Example -
set EC2_HOME=c://chamara/ami/ec2-api-tools
Step 10: now add ec2-api-tools/bin folder path to your path variable.(See screenshot above)
Step 11: Then create folder called ".ec2" and copy cert and PK .pem files in to that.(earlier we downloaded that)
Step 12: Now you have to create couple of invirenment variables by locating .pem files.
If you are in Linux open a terminal or .bashrc and insert EC2_PRIVATE_KEY & EC2_CERT,
Syntax -
export EC2_PRIVATE_KEY=folderpath/.ec2/pk-********.pem
export EC2_CERT=folderpath/.ec2/cert-*******.pem
Example -
export EC2_PRIVATE_KEY=/home/chamara/.ec2/pk-********.pem
export EC2_CERT=/home/chamara/.ec2/cert-*******.pem
If you are in Windows set EC2_PRIVATE_KEY & EC2_CERT as a enviroment variables.
Syntax -
set EC2_PRIVATE_KEY=folderpath/.ec2/pk-********.pem
set EC2_CERT=folderpath/.ec2/cert-*******.pem
Example -
set EC2_PRIVATE_KEY=c//chamara/.ec2/pk-********.pem
set EC2_CERT=c://chamara/.ec2/cert-*******.pem
Step 13: Now you have completed 95% of the confugarions.to check this open terminal or command prompt traverce to .ec2 folder and type "ec2-describe-images".you will see all the available AMI images in your terminal if you are configured successfuly.
Creating Keypair
Step 14: Now you have to create or own key pair.to create that key pair in command prompt/terminal goto the .ec2 folder and type "ec2-add-keypair yourname-keypair"
Example
chamara@chamara-laptop:~$ ec2-add-keypair chamara-keypair
now you can see your private key in your terminal.
Step 15: Then create a file called "id_rsa-yourname-keypair" in ec2 directory.(yourname what you put here should be same with the key pare name what you add in 11.)
Step 16: Copy private key list in your terminal (point 11) from " -----BEGIN RSA PRIVATE KEY-----" to "-----END RSA PRIVATE KEY-----" in to the "id_rsa-yourname-keypair" file.
Step 17: If you are in linux give permission to that file.
in terminal, type
chmod 600 id_rsa-yourname-keypair
Step 18: now you finish all the configuration and you should be able to run any ami instances from command line.
Start AMI Instance
Step 19: If you want to run 32 bit ami instance,
in terminal, go to the .ec2 folder and type
ec2-run-instance ami-ID -k yourname-keypair
Step 20: If you want to run 64 bit instance you need to type,
ec2-run-instances ami-ID -k yourname-keypair --instance-type m1.large
Step 21: If you want to see status of the running instance you need to type this command in terminal.
"ec2-describe-instance instance-id" (instance id you can see when you are start instance using ami-id.instance id start with i-1212 etc.)
for a example if you want to run 32 bit WSAS instance you have to get AMI-ID from the wso2.com Page
WSAS ID = ami-80bd5fe9
start WSAS instance like,
ec2-run-instance ami-80bd5fe9 -k chamara-keypair
Step 22: After few second type "ec2-describe-instance instance-id" in terminal. you will see ec2 domain name like "ec2-174-129-171-196.compute-1.amazonaws.com".this is the unique url for your running instance.
Step 23: In browser type "https://ec2-174-129-171-196.compute-1.amazonaws.com/carbon" url and you will see WSAS management console finally.
1 comment:
Thanks for providing it's very useful to the users keep updating AWS Online Course
Post a Comment