In order to create your own EC2 instance of the Aptana Jaxer Server, you will need to establish an account with Amazon Web Services. You can sign up for an account at Amazon Web Services.
The rest of this tutorial uses the Amazon EC2 Firefox Extension, version 1.3.16132 or higher. You can download and install that from the Amazon Web Services Developer Connection. Please note that the 1.3.16132 version of the extension does not appear to run correctly in the Firefox 3 beta.
Bring up the EC2 tool in Firefox by selecting the Tools->EC2 UI menu item. This will bring up the EC2 UI in your current window. Next, you will need to enter in the information for your account that you've established at Amazon Web Services. You do that by clicking the "Credentials" icon at the top left. Give your account a name, enter the AWS Access Key and Secret Access Key for your account. Click "Add" to add this account to your list and then close the dialog by clicking the "Close" button.
Now that EC2 UI knows about your account, we're ready to start up a Jaxer Server instance. EC2 images require that you start a new instance using a key/value pair. This allows you to connect to the running instance as root without sending your password in the clear. So, let's create our KeyPair in EC2 UI
Select the "KeyPairs" tab in the EC2 UI interface. If you've previously created keypairs, you may need to click the refresh button (two arrows) to display those. To create a new KeyPair, click the "Create a new keypair" button (key). Let's call this keypair aptana-jaxer. Enter the name and click the "OK" button. After a brief delay, you should be prompted to save the file on your local file system. The defaults should be fine, but be sure to remember where that file is located as you will need it later on in the tutorial when we log into the server from the command-line. We now have a key that we can use to start a new instance.
Return to the "AMIs and Instances" tab in the EC2 UI interface. Click the refresh button in the "Available AMIs" section. Once the panel is populated, scroll down to AMI ID ami-7a749113. This is the Jaxer Server image. Right-click this entry and select "Launch instance(s) of this AMI". A dialog will appear. All you should need to change is the KeyPair entry. Select that pop-up menu and select the aptana-jaxer keypair we created earlier. Now click the "Launch" button. The "Your Instances" panel should update showing that you have a new instance of this image "pending". You will need to select the new instance in the panel and then click the refresh button to update the display. After a few minutes "pending" should change to "running". At this point, you have a running Jaxer instance.
If this is the first time you've created an EC2 instance, then you will most likely need to open up network access to the Jaxer Server instance. Note that this step only needs to be performed once for each of your instance groups. Select the "Security Groups" tab in the EC2 UI interface. Click the refresh button to update the panels in this tab. Under the "Group Permissions" panel, we need to open up ports 22 and 80. You do that by clicking the "Grant Permission" button (greeen check mark). A dialog will appear. Simply set the "From port" and "to" values to 22 and click the "Add" button. Repeat this procedure for port 80. If you make a mistake, you can select the entry in the "Group Permissions" panel and click the "Remove Permissions" button (red hand). Now we can test the server.
Return to the "AMIs and Instances" panel. Right-click the running instance and select "Copy Public DNS Name to clipboard". This will save us some typing. Now open up your favorite browser and type "http://", then paste in the DNS name from the clipboard, and add "/aptana/" to the end of the URL. Press enter and you should see the Jaxer startup page. Feel free to run the Server Diagnostics or any of the sample apps.
Congratulations! You have a working Jaxer Server that anyone can access.At this point, we have everything running, but it will be a lot more interesting to start creating our own content. In order to do that, we need to change a few settings on the server. We should be able to open an SSH session with the instance from EC2 UI, but the version I'm running, 1.3.16132, appears to be missing a file. So, we'll have to jump to the command-line to access the server.
First of all, you will need a ssh client. Linux and Mac OS X come with this installed. On Windows, you may want to install Cygwin or PuTTY. The first thing we need to do is make sure the permissions are set properly on the keypair file we saved earlier. Move into the directory where you saved that file. Set the privileges so the file is read/write for the owner only. For example, on Mac OS X, you type "chmod 600 aptana-jaxer.pem". If you don't change these permissions, it is likely you will not be allowed to connect to the server since the file could have been compromised. Now let's log into the server.
We need to specify our keypair when we log onto the server. You can do that with the -i option in ssh. To connect, run "ssh -i aptana-jaxer.pem root@<hostname>" where <hostname> is the public DNS name you copied earlier. You should see a welcome banner. You're now logged in as root. Now, we'll configure SFTP.
Edit /etc/ssh/sshd_config. Look for the line that says "PasswordAuthentication no" and change "no" to "yes". Save and close the file. Next we need to restart the sshd service for the change to take effect. You do that by running "/etc/init.d/sshd restart". You should see two lines, one stopping the service and the other starting the service.
We've turned on SFTP with password authentication, so now we need a user/password we can use to add files to the server. There is a "jaxer" user setup on the server for which we need to set a password. Run "passwd jaxer" and enter the new password and confirm. You're now ready to SFTP into the server.
We can access our server via SFTP. We'll use Aptana Studio Professional as our SFTP client.
In Studio, make sure the Aptana perspective is active and bring the File View to the front. Right-click the SFTP icon and select "Add New SFTP Site...". Name this connection "Aptana Jaxer", set the server to the public DNS name you copied earlier, set the remote path to "/opt/AptanaJaxer/public", set the Username to jaxer, and fill in the password you created earlier. Turn on the "Save" checkbox if it is not already selected and click the "OK" button to close the dialog. You should now see an "Aptana Jaxer" node under SFTP. Expand the node to see the content of the server. You now can drag files onto the server or you can setup a sync site to upload your Aptana project.
If you no longer need the Jaxer Server instance, you can shut it down in two ways. If you're logged in as root, you can run "shutdown -h now". Otherwise, in the EC2 UI interface, you can right-click the running instance in the "Your Instances" tab and select "Terminate this instance". Note that your instance will become inaccessible after a short timeout period. Once that instance has disappeared from the list, you will no longer be able to run it. You will need to follow the above steps to create a new running instance. If you have a particular setup that you like, you can also generate your own image for private or public use. There are a number of helpful resources on the Amazon Web Service site that describe how to do that.
We covered a lot of ground. We setup Firefox so we could manage instances for our AWS account. We created a new instance of the Aptana Jaxer Server image. We configured network access for HTTP and SSH and setup an SFTP account ready for that next Jaxer project you've been working on. Congratulations and, most importantly, have fun and show off your work to the community.