Credit to these two articles for providing much of the source material (thanks guys!):
http://www.powercram.com/2009/12/instal ... ls-on.html
http://overstimulate.com/articles/amazon-does-it-again
Set Up an EC2 Account: http://aws.amazon.com/ec2/
You will have to provide a credit card (you won't be charged unless you begin setting up servers and putting them live). For testing purposes, you can put them online and then take them down (only $.085 per hour of use for the smallest option") whenever you want.
Once you have set up your account:
- Browse to Home > Resources > AWS Management Console > Amazon EC2
- Browse to "Launch Instance" -> Community AMI's and search -> ami-296e8a40 (this is the smart fox pro AMI you can use to get started)
- Hit "Select" -> Launch Instances -> Create Key Pair (whatever you want, be sure to download it to c:\ec2\) -> Configure Firewall ("default") then Review and create the instance. It will go live after a few minutes and appear in the "instances" section.
IMPORTANT:
- When you create your key pair, you will get ONE chance to download it. Make SURE to download it or else you will have to go through this again. I don't know why but there doesn't seem to be a second chance to download it.
- Download it to C:\ec2\ for now (rename it to a .ppk file (will explain more later)
ALSO VERY IMPORTANT:
- for some reason this will not work with Putty / PuttyGen (later on in the article) unless you add a "/n" to the end of it.
open up the file in notepad and do this: (note the "/n" at the end of the file (it will look like the below):
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAoYkTqi/qETo3QH4dzTMf7UE7KncoUCT+veohz4QK98FAfEpCbracnEqdOpO/
Ep5iBmg384e++ETbVU270+CRBKpurKrQ2j7Jyj/7MQMitRJLhzYgmJeHpf9Peyetn26EzG6r4Y0q
1YHH80+fyyAAiyMC+UaL7PFSChXAaocGeTfVI+eowH7J2PyCEwcUoD4ifBFLajMM0vanJbWgJA3f
O0MCDC4WdFq/FfjaTjiTh4K1YXtGZpgpQ5ROyIXomDKCO1IphVvvz0uWkojjpDbA6hsSbpKDVCAN
l0hCYfBH6S3Py99X+ptqscT/nt8sVPRlsTAXAB9AvfNSD85IvgH91wIDAQABAoIBADXZM0P9ewLJ
LFgEcrzP+SmnICaefaf5uK3omeLKermCo5OLUcAEggqb2PQJAp4bTEQkg9pb+y5aDd/O7PlBmDY8
9m3692p5md0hH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sG8KdUHDkzJcBhIsaHwcF402mstTdNl0UVs5y/7OMw=
-----END RSA PRIVATE KEY-----
/n
NOTE THAT I ADDED A /N I am not kidding! Save it and close it as a .ppk file. You have to do this or you wont be able to get shell access later on with PuTTY.
Now you need to set up the ability to SSH into your Amazon EC2 account from windows (this gets really ugly)
First, make sure you have created a security certificate:
- aws.amazon.com -> your Account -> Security Credentials -> x.509 Certificates
- Download your certificate and key pair by clicking the "download" button and copy them to c:\ec2\ (or create a new one if you haven't already got one)
- you should have two files that look like this when you download:
cert-[wholebunchofrandomlettersandnumbers].pem
pk-[wholebunchofrandomlettersandnumbers].pem
Next, download the following packages and unzip them into c:\ec2\
- http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
http://ec2-downloads.s3.amazonaws.com/E ... -05-15.zip
http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.zip
Now download BOTH puTTY and puTTYGEN (you will need them to start the server via shell commands)
- http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Might as well download them both into c:\ec2\
Next, Create the following file: startEC2.bat
REM Path should contain bin\java.exe
set JAVA_HOME="C:\Program Files\java\jre6"
REM Path to Primary Key and Certificate retrieved from AWS
set EC2_PRIVATE_KEY=C:\ec2\pk-wholebunchofrandomlettersandnumbers.pem [CHANGE TO BE YOUR PK-file
set EC2_CERT=C:\ec2\cert-wholebunchofrandomlettersandnumbers.pem {CHANGE TO BE YOUR cert-file
REM Path to EC2 API, subfolders of bin and lib
set EC2_HOME=C:\ec2\ec2-api-tools-1.3-46266
set PATH=%PATH%;%EC2_HOME%\bin
REM Path to ELB API, subfolders of bin and lib
set AWS_ELB_HOME=C:\ec2\ElasticLoadBalancing-1.0.3.4
set PATH=%PATH%;%AWS_ELB_HOME%\bin
REM Path to EC2 AMI, subfolders of bin and lib
set AWS_AMI_HOME=C:\ec2\ec2-ami-tools-1.3-45758
set PATH=%PATH%;%AWS_AMI_HOME%\bin
cls
cmd
Now, open a command prompt (Start -> Run -> CMD)
Browse to c:\ec2\
Run: startEc2.bat
Nothing should happen (it will refresh and say "Microsoft windows blah blah blah" in the console")
Now run the following commands:
ec2-describe-regions
should show this if it is working properly. If it doesn't show this, something is broken - got back and try again.
REGION eu-west-1 ec2.eu-west-1.amazonaws.com
REGION us-east-1 ec2.us-east-1.amazonaws.com
REGION us-west-1 ec2.us-west-1.amazonaws.com
Ok, now we need to enable SSH so we can activate the server.
Run these two commands from the CMD prompt (will only work if you have successfully started the EC2 start.bat file as mentioned above.
ec2-authorize default -p 22 (ssh)
ec2-authorize default -p 80 (and http)
you should get something like this for each:
GROUP DEFAULT
PERMISSION 0.0.0.0.0.0
default ALLOWS tcp 22 22 FROM CIDR
Open PuttyGEN (you have to use PuttyGen to reshape the RSA key so that PuttY will accept it)
go to "Load" -> your .ppk file you downloaded earlier (you know, the key pair that you created when you crearted your first server instance)
You should get "successfully imported blah de blah blah"
now save that back into your EC2 folder (leave the default SSH-2 RSA as is). Save it as a .ppk. Did you remember to add the "/n" I mentioned before? Good.
Now open Putty
Go to -> Connection -> SSH -> Auth
now click "browse" and go get the key file that PuttyGen just outputted
now go to Session
Enter your Amazon EC2 DB DNS location into the "Host" box (should look like:)
xx-xxxx-xxxx-xxxx.compute-1.amazonaws.com
(you can get this from the AWS Console when you click the Instance name in the details that show down below (DNS of your instance)
Now hit "open"
It will prompt you asking for a username. Use: sfsdemo
Password:sfsdemopass
Now you can do this stuff:
You are now successfully logged into the virtual box. Now move to the SmartFoxServer installation:
cd SFS_PRO_1.6.2/Server/and start/stop the server with any of the following commands:
./sfs start (to start the daemon)
./sfs stop (to stop the daemon)
./sfs status (to check the daemon status)
./sfs console (to check launch in the console)