Google Glass GDK on Amazon Web Services
-
Upload
diana-michelle -
Category
Mobile
-
view
240 -
download
5
description
Transcript of Google Glass GDK on Amazon Web Services
A M A Z O N W E B S E R V I C E SU P L O A D I N G M I R R O R A P I P R O J E C T O N
W H Y W O U L D Y O U U S E A W S ?
• … 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.
AWS
Y O U N E E D A VA L I D C R E D I T C A R D B U T W O N ’ T B E C H A R G E D I F Y O U
O N LY R U N O N E F R E E T I E R I N S TA N C E AT A T I M E F O R A Y E A R .
Setting up
Tutorial for Macintosh and PC
T H I N G S Y O U N E E D T O H AV E D O N E B E F O R E S TA R T I N G
• 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)
G E T A N A W S A C C O U N TS T E P 1
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.
L O G I N T O Y O U R N E W A W S A C C O U N TS T E P 2
https://console.aws.amazon.com
Y O U W I L L B E G R E E T E D B Y:
Click on EC2 (Elastic Computing Cloud)
1
On the dashboard at the left,
Click either of the “Launch Instance”
buttons.
2
2
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”
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
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.
All settings are fine, but check the “Protect Against Accidental Termination” box, so you don’t delete the instance by accident.
1
2Click “Next”
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.
1Click “Next”
Give a name to your instance. If you need to add more tag value pairs, click create;
for now, we will only add Name.
Click “Next”.2
1
2
1 Select “Create a new 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.
1
Check all the settings and click Launch.
2
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.
1
23
1. Select “Create a new key pair” 2. Give the key a name 3. Click download key pair Once downloaded, click “Launch Instances”
4
SUCCESS
1
Click “View Instances”
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.
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.
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.
C O N N E C T I N G T O T H E S E R V E RM A C I N T O S H
**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:
M A C I N T O S H
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:
W I N D O W S
1. Find your putty suite and open PuttyGen.exe
12
2. Click Load and browse for the pem key we got from Amazon
1 Click “OK”
2
3Make sure SSH-2 RSA is checked
Save private key with new extension (.ppk)
1Click “Yes”
2
Open Putty.exe
Change the host name for the public dns of your instance. Change port to 22 and mark connection type as SSH.
Go to Connection/SSH/Auth and browse for the new .ppk key, then click Open
12
3
If you get this alert, click yes.
1
When prompted what user to login as, type “ubuntu” and hit enter. You will then be connected to the server.
I N S TA L L O N T H E S E R V E R
//Run the following commands on the SSH terminal:
sudo suapt-get updateapt-get install openjdk-7-jdk apt-get install tomcat7apt-get install tomcat7-admin
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.
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
R E S TA RT T O M C AT S E R V E R
Commands to handle tomcat server:
• START:/etc/init.d/tomcat7 start
• STOP:/etc/init.d/tomcat7 stop
• RESTART:/etc/init.d/tomcat7 restart
Get your public dns from the aws console and go to a browser and enter the following address:
http://<public dns>:8080
Example:
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.
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:
Go to the Google Developers Console and open your project.
1
2
Add the public dns of your AWS instance to the Authorized JavaScript Origins and Authorized Redirect URI
U P L O A D I N G T O A W S
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)
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?
Choose the ROOT.war file and click Deploy
Click the “/“ in the Path Column to be Redirected to your application.
T E R M I N AT I N G A N I N S TA N C E
Select the instance to be deleted and Click on Actions.
2
1
1
2
3
4
5
O K , W H AT N O W ?
T O G I V E T H E A P P L I C AT I O N T O Y O U R U S E R S
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!
U S E F U L L I N K S / B O O K S• https://developers.google.com/glass/design/ui
• https://developers.google.com/glass/develop/overview
DESIGN
CODE
And so we’ve come to the end of the presentation!
My contact information: Diana Melara