This presentation shows how to setup the environment for Google Glass GDK using Amazon Web Services instead of Google App Engine. It describes all the process from beginning to end on how to create, upload, and manage a GDK application from AWS. The project used was the Java version of the Glass Starter Project.
3. AWS
• … allows you to use a free-tier for a year
(micro instance)
• … comes with a public IP and a unique DNS name for
each instance running.
• … offers more OS images to boot from than GCE.
4. YOU NEED A VALID CREDIT CARD
BUT WON’T BE CHARGED IF YOU
ONLY RUN ONE FREE TIER
INSTANCE AT A TIME FOR A YEAR.
7. THINGS YOU NEED TO HAVE DONE
BEFORE STARTING
• Install JDK & Maven and set up environment variables
• Download the quick start project from Github
• Prep the quick start project and package it as a war file
to ready to upload
• Set up a Google Developers Console project (we will
modify this)
8. STEP 1
GET AN AWS ACCOUNT
Go to https://console.aws.amazon.com
and create an account.
!
If you have an amazon account, you still have to
go through the process. They are separate services.
Submit payment information.
9. STEP 2
LOGIN TO YOUR NEW AWS ACCOUNT
https://console.aws.amazon.com
10. YOU WILL BE GREETED BY:
Click on EC2 (Elastic Computing Cloud)
11. On the dashboard at the left,
1
Click either of the
“Launch Instance”
buttons.
2
2
12. The first thing you’ll be asked to do, is to define the OS image you
want for your instance. Make sure the image you are working with says
“FREE TIER ELEGIBLE”. If it doesn’t say, select it and you should see
a micro-option that says “Free tier elegible”
13. We will be working with an Ubuntu Image on this tutorial, but you are more than
welcome to try the other “free tier elegible” images. Just make sure you know
how to configure everything.
1
Search for “AMI-864d84ee” and select it
2
14. 1
2
Pick the “General Purpose Free Tier Elegible” micro
instance
Click “Next”. Don’t click review and Launch, we have more
settings to go over.
15. All settings are fine, but check the “Protect Against Accidental Termination”
box, so you don’t delete the instance by accident.
1
Click “Next” 2
16. Since it’s a micro-instance, your hard drive will only be 8GB. I’m not
sure if you add more, you will be charged. 8GB is enough for now.
Click “Next” 1
17. Give a name to your instance.
If you need to add more tag value pairs, click create;
for now, we will only add Name.
1
Click “Next”. 2
18. 1 Select “Create a new
2
security group”
and Change Name &
Description
Add the following network rules:
SSH will let us connect to our server through a terminal
or command prompt.
Custom TCP rule will let the server have HTTP traffic.
20. What is a key pair?
A key pair is a small (.pem) file that allows you to SSH
to EC2 servers. This connects you securely to your
instance from your machine.
A PEM KEY CAN ONLY BE DOWNLOADED ONCE.
So, make a copy and keep it safe.
21. 1
2
3
1. Select “Create a new key pair”
2. Give the key a name
3. Click download key pair
Once downloaded, click “Launch Instances”
4
23. Once your instance is running, you’ll see it reflected in your instance view in
the EC2 Console. If you select the instance and click “Actions” on top, you can
start/stop/reboot/terminate your instance.
24. If you try to terminate your instance, you’ll get an error that you can’t
terminate it unless you allow it. This is good to not delete it accidentally.
We will cover how to delete an instance later.
25. If you select the instance name, you can see all of the info of the instance.
What’s important right now, is that you copy the Public DNS of the instance.
26. MACINTOSH
CONNECTING TO THE SERVER
**Make sure Mac didn’t change
the extension of your .pem key to .txt**
Open a terminal and CD to where your pem key is stored
and apply the following command:
chmod 400 <keyname>.pem
Example:
27. MACINTOSH
Once the chmod is done, use the following command to SSH to your server
ssh -i <keyname>.pem ubuntu@<public-dns>
If you get a prompt to continue connecting, answer “yes”.
Example:
28. WINDOWS
1. Find your putty suite
and open PuttyGen.exe
1
2
2. Click Load and browse for
the pem key we got from Amazon
29. 1 Click “OK”
Make sure 3
SSH-2 RSA
is checked
2
Save private
key with new
extension
(.ppk)
34. When prompted what user to login as, type “ubuntu” and
hit enter. You will then be connected to the server.
1
35. INSTALL ON THE SERVER
//Run the following
commands on the SSH
terminal:
sudo su
apt-get update
apt-get install openjdk-7-jdk
apt-get install tomcat7
apt-get install tomcat7-admin
36. In order to upload your project to the server, you will
need to setup credentials so that only you have
permission to upload the war file.
In the next slide replace the “user” and “admin” for a
username and password to can remember and use later.
37. nano /etc/tomcat7/tomcat-users.xml
<user username=“user” password=“admin” roles=“manager-gui,admin-gui”/>
when done, “ctrl+O” to write and “ctrl+X” to quit.
MAC USERS:
don’t use ⌘,
use control key
39. Get your public dns from the aws console and go to a browser and enter
the following address:
http://<public dns>:8080
Example:
40. You should see the Apache Tomcat welcome page:
*
* If you click on the
“manager-webapp” link,
you’ll be prompted for
username/password.
It’s the same usr/pwd we
set in the nano editor
before. Don’t get used to
clicking this link because
we will delete this page
from our server.
41. Go back to the SSH terminal and CD to /var/lib/tomcat7/webapps
then run the following command to delete the ROOT application:
!
sudo rm -rf ROOT
!
Example:
42. Go to the Google Developers Console and open your project.
1
2
43. Add the public dns of your AWS instance to the Authorized
JavaScript Origins and Authorized Redirect URI
44. UPLOADING TO AWS
Open a local terminal/command prompt and CD to where
the pom.xml file in your project is. Then run:
!
mvn clean install
!
mvn war:war
!
Search for the “target” folder inside your project and find the
war file that was generated. Rename it to “ROOT.war”
(case-sensitive)
45. Head over to the tomcat manager in your server. The address is
<public-dns>:8080/manager/html
!
Example:
Use the credentials
we set on the server
a few slides ago
using the nano editor
remember?
46. Choose the ROOT.war
file and click Deploy
Click the
“/“ in the Path
Column to be
Redirected to
your application.
53. TO GIVE THE
APPLICATION TO
YOUR USERS
You simply have to give them
the URL of your project, and
have them login with their
credentials and configure the
settings on the browser, not
glass!
It’s that easy!