Here is the process we are going to create:
- Edit the files in notepad++ and save.
- Alt-tab to putty ssh session. Run ./build.
- Go to a web browser, hit refresh on your output page and view the results.
Simple enough right?
Making a Build Script
Connect to your amazon EC2 machine with puttyCreate a folder for your projects:
$ mkdir projects
Create a folder for your new project
$ mkdir archery
Create a build script
$ nano build
Enter something similar to:
~/emscripten/emscripten/emcc main.cpp -o /var/www/test.html
The first is a path to where your emscripten is installed respective to the root.
The last path is a public web folder so you can see the output.
Use Crtl-X to exit out nano and save the file.
Now you can run:
$./build
and your program will build.
Editing your files
Nano is not really my tool of choice. I'm familiar with notepad++ and that's the tool I use. So here goes:Install notepad++ on your development machine (don't be a goof and try on the ec2 machine!)
Install the notepad++ plugin for NppFtp. Check out the notepad++ site for tips on doing this.
Once you have NppFtp installed it's time to connect!
Open notepad++ go to the menu plugins > nppftp > show nppftp window.
After you do this, you will now see the nppftp window.
Choose the option show
Setup a profile to connect - so you can connect easily each time!
1)
Click the add new button.Name it something good, emscripten maybe..
Enter your ami url in the hostname box and select sftp.
NOTE!! you must have enabled port 22 on your group policy when you setup your ami machine
Fill in ec2-user
Wait you're not done yet, go to step 2 below.
2)
Click the authentication tab, select the location to your pem file for the ami. At some point hopefully you've created the pem file and kept it in a safe place for things like this!Click the options shown in the picture below.
After you do this, hit the close button, it'll be saved don't worry!
3)
You're ready to connect!Hit that connect button, select your profile.
After connecting in notepad++ you will be able to browse your folders to get to projects/archery/main.cpp. Double click to open and edit that file. When you hit save it will go right to your ec2 machine.
Viewing results in a web browser
Get your AMI url from EC2 management console. If you are not there google it, and then login!Click on instances, to see the machine you are working on. The url is right there.
The combined url will be something like:
ec2-172-123-50-66.compute-1.amazonaws.com/test.html
Test it in your browser after you compile your program.
You must have apache installed on the ec2 machine for this to work!!
No comments:
Post a Comment