google glass gdk on amazon web services

55
AMAZON WEB SERVICES UPLOADING MIRROR API PROJECT ON

Upload: diana-michelle

Post on 26-May-2015

240 views

Category:

Mobile


5 download

DESCRIPTION

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.

TRANSCRIPT

Page 1: 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

Page 2: Google Glass GDK on Amazon Web Services

W H Y W O U L D Y O U U S E A W S ?

Page 3: Google Glass GDK on Amazon Web Services

• … 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

Page 4: Google Glass GDK on Amazon Web Services

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 .

Page 5: Google Glass GDK on Amazon Web Services

Setting up

Page 6: Google Glass GDK on Amazon Web Services

Tutorial for Macintosh and PC

Page 7: Google Glass GDK on Amazon Web Services

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)

Page 8: Google Glass GDK on Amazon Web Services

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.

Page 9: Google Glass GDK on Amazon Web Services

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

Page 10: Google Glass GDK on Amazon Web Services

Y O U W I L L B E G R E E T E D B Y:

Click on EC2 (Elastic Computing Cloud)

Page 11: Google Glass GDK on Amazon Web Services

1

On the dashboard at the left,

Click either of the “Launch Instance”

buttons.

2

2

Page 12: Google Glass GDK on Amazon Web Services

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”

Page 13: Google Glass GDK on Amazon Web Services

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

Page 14: Google Glass GDK on Amazon Web Services

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.

Page 15: Google Glass GDK on Amazon Web Services

All settings are fine, but check the “Protect Against Accidental Termination” box, so you don’t delete the instance by accident.

1

2Click “Next”

Page 16: Google Glass GDK on Amazon Web Services

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”

Page 17: Google Glass GDK on Amazon Web Services

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

Page 18: Google Glass GDK on Amazon Web Services

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.

Page 19: Google Glass GDK on Amazon Web Services

1

Check all the settings and click Launch.

2

Page 20: Google Glass GDK on Amazon Web Services

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.

Page 21: Google Glass GDK on Amazon Web Services

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

Page 22: Google Glass GDK on Amazon Web Services

SUCCESS

1

Click “View Instances”

Page 23: Google Glass GDK on Amazon Web Services

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.

Page 24: Google Glass GDK on Amazon Web Services

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.

Page 25: Google Glass GDK on Amazon Web Services

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.

Page 26: Google Glass GDK on Amazon Web Services

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:

Page 27: Google Glass GDK on Amazon Web Services

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:

Page 28: Google Glass GDK on Amazon Web Services

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

Page 29: Google Glass GDK on Amazon Web Services

1 Click “OK”

2

3Make sure SSH-2 RSA is checked

Save private key with new extension (.ppk)

Page 30: Google Glass GDK on Amazon Web Services

1Click “Yes”

2

Page 31: Google Glass GDK on Amazon Web Services

Open Putty.exe

Change the host name for the public dns of your instance. Change port to 22 and mark connection type as SSH.

Page 32: Google Glass GDK on Amazon Web Services

Go to Connection/SSH/Auth and browse for the new .ppk key, then click Open

12

3

Page 33: Google Glass GDK on Amazon Web Services

If you get this alert, click yes.

Page 34: Google Glass GDK on Amazon Web Services

1

When prompted what user to login as, type “ubuntu” and hit enter. You will then be connected to the server.

Page 35: Google Glass GDK on Amazon Web Services

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

Page 36: Google Glass GDK on Amazon Web Services

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.

Page 37: Google Glass GDK on Amazon Web Services

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

Page 38: Google Glass GDK on Amazon Web Services

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

Page 39: Google Glass GDK on Amazon Web Services

Get your public dns from the aws console and go to a browser and enter the following address:

http://<public dns>:8080

Example:

Page 40: Google Glass GDK on Amazon Web Services

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.

Page 41: Google Glass GDK on Amazon Web Services

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:

Page 42: Google Glass GDK on Amazon Web Services

Go to the Google Developers Console and open your project.

1

2

Page 43: Google Glass GDK on Amazon Web Services

Add the public dns of your AWS instance to the Authorized JavaScript Origins and Authorized Redirect URI

Page 44: Google Glass GDK on Amazon Web Services

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)

Page 45: Google Glass GDK on Amazon Web Services

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?

Page 46: Google Glass GDK on Amazon Web Services

Choose the ROOT.war file and click Deploy

Click the “/“ in the Path Column to be Redirected to your application.

Page 47: Google Glass GDK on Amazon Web Services
Page 48: Google Glass GDK on Amazon Web Services
Page 49: Google Glass GDK on Amazon Web Services

T E R M I N AT I N G A N I N S TA N C E

Page 50: Google Glass GDK on Amazon Web Services

Select the instance to be deleted and Click on Actions.

2

1

Page 51: Google Glass GDK on Amazon Web Services

1

2

3

4

5

Page 52: Google Glass GDK on Amazon Web Services

O K , W H AT N O W ?

Page 53: Google Glass GDK on Amazon Web Services

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!

Page 54: Google Glass GDK on Amazon Web Services

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

Page 55: Google Glass GDK on Amazon Web Services

And so we’ve come to the end of the presentation!

My contact information: Diana Melara

[email protected]