solve the cross-cloud conundrum with jclouds

63
with jclouds Solve the Cross- Cloud Conundrum Everett Toews Developer Advocate @everett_toews You need: JDK 1.6+ Ant 1.8+ || Ivy 2+ Rackspace and/or HP cloud accounts Austin Java Users Group March 26, 2013 at 7:00 pm

Upload: everett-toews

Post on 08-May-2015

599 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Solve the Cross-Cloud Conundrum with jclouds

with jclouds

Solve the Cross-Cloud Conundrum

Everett Toews

Developer Advocate

@everett_toews

You need:

JDK 1.6+

Ant 1.8+ || Ivy 2+

Rackspace and/or

HP cloud accounts

Austin Java Users GroupMarch 26, 2013 at 7:00 pm

Page 2: Solve the Cross-Cloud Conundrum with jclouds

2RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Intro

Developer

Page 3: Solve the Cross-Cloud Conundrum with jclouds

3RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Committer on jclouds

Page 4: Solve the Cross-Cloud Conundrum with jclouds

4RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Intro

Advocate

Page 5: Solve the Cross-Cloud Conundrum with jclouds

5RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Intro

Page 6: Solve the Cross-Cloud Conundrum with jclouds

6RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Intro

Operations

Page 7: Solve the Cross-Cloud Conundrum with jclouds

7RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Co-author of The OpenStack Operation Guide

Page 8: Solve the Cross-Cloud Conundrum with jclouds

8RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Intro

In startup we are not allow dev team for talk to ops team except by API.

@DevOps_Borat

Page 9: Solve the Cross-Cloud Conundrum with jclouds

9RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Agenda

Page 10: Solve the Cross-Cloud Conundrum with jclouds

10RACKSPACE® HOSTING | WWW.RACKSPACE.COM

The Workshop

•Introduction•jclouds Overview•Cloud Accounts•Installation•Compute Example•Next Steps•Wrap Up

Page 11: Solve the Cross-Cloud Conundrum with jclouds

11RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Introduction to Rackspaceand the cloud

Page 12: Solve the Cross-Cloud Conundrum with jclouds

12RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Rackspace

Page 13: Solve the Cross-Cloud Conundrum with jclouds

13RACKSPACE® HOSTING | WWW.RACKSPACE.COM

The Cloud

Infrastructure

with an API

Page 14: Solve the Cross-Cloud Conundrum with jclouds

14RACKSPACE® HOSTING | WWW.RACKSPACE.COM

The Cloud

YourSystem

SDK

CloudAP I

VMVM

VM

UserSystem

Page 15: Solve the Cross-Cloud Conundrum with jclouds

15RACKSPACE® HOSTING | WWW.RACKSPACE.COM

The Cloud

API

Cloud

YourSystem

SDK

UserSystem

VMVM

VMVM

Page 16: Solve the Cross-Cloud Conundrum with jclouds

16RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Introduction to jclouds

Page 17: Solve the Cross-Cloud Conundrum with jclouds

17RACKSPACE® HOSTING | WWW.RACKSPACE.COM

jclouds

• Cross-cloud toolkit

• Open Source (Apache v2)

• Community

• Portable APIs

• Ecosystem Specific APIs

• Provider Specific APIs

• Java

Page 18: Solve the Cross-Cloud Conundrum with jclouds

18RACKSPACE® HOSTING | WWW.RACKSPACE.COM

jclouds Providers

•ComputeService• Rackspace Cloud Servers

• HP Cloud Compute• AWS EC2• GCE (soon)• ElasticHosts• GoGrid• All Providers

•BlobStore• Rackspace Cloud Files

• HP Cloud Storage• AWS S3• GCS (soon)• Azure• CloudOne• All Providers

Page 19: Solve the Cross-Cloud Conundrum with jclouds

19RACKSPACE® HOSTING | WWW.RACKSPACE.COM

jclouds Community

Page 20: Solve the Cross-Cloud Conundrum with jclouds

20RACKSPACE® HOSTING | WWW.RACKSPACE.COM

jclouds Layers (APIs)

•ComputeService• Rackspace• OpenStack• HP, AWS, GCE, etc.

•NovaApi (*Api)• Rackspace• OpenStack• HP

•BlobStore• Rackspace• OpenStack• HP, AWS, GCS, etc.

•SwiftApi• Rackspace• OpenStack• HP

•CloudFilesClient• Rackspace

Page 21: Solve the Cross-Cloud Conundrum with jclouds

21RACKSPACE® HOSTING | WWW.RACKSPACE.COM

jclouds Community

After 3 beer I can able use any of cloud API.

@DevOps_Borat

Page 22: Solve the Cross-Cloud Conundrum with jclouds

22RACKSPACE® HOSTING | WWW.RACKSPACE.COM

What Can jclouds Do For You Today?

Page 23: Solve the Cross-Cloud Conundrum with jclouds

23RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Plumbing

Page 24: Solve the Cross-Cloud Conundrum with jclouds

24RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

(RE)Authentication

Page 25: Solve the Cross-Cloud Conundrum with jclouds

25RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Pagination

Page 26: Solve the Cross-Cloud Conundrum with jclouds

26RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

State Polling

Page 27: Solve the Cross-Cloud Conundrum with jclouds

27RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Rate Limiting

Page 28: Solve the Cross-Cloud Conundrum with jclouds

28RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Retry

Page 29: Solve the Cross-Cloud Conundrum with jclouds

29RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Smoothing

Rough Edges

Page 30: Solve the Cross-Cloud Conundrum with jclouds

30RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Open Source

Page 31: Solve the Cross-Cloud Conundrum with jclouds

31RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

In devops nobody is get fire for buy open source.

@DevOps_Borat

Page 32: Solve the Cross-Cloud Conundrum with jclouds

32RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Community

Page 33: Solve the Cross-Cloud Conundrum with jclouds

33RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Support

Page 34: Solve the Cross-Cloud Conundrum with jclouds

34RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Packaged

Page 35: Solve the Cross-Cloud Conundrum with jclouds

35RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

All-in-one

Page 36: Solve the Cross-Cloud Conundrum with jclouds

36RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

No lock-in

Page 37: Solve the Cross-Cloud Conundrum with jclouds

37RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Page 38: Solve the Cross-Cloud Conundrum with jclouds

38RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Page 39: Solve the Cross-Cloud Conundrum with jclouds

39RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Battle Tested Code

Page 40: Solve the Cross-Cloud Conundrum with jclouds

40RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Sample Code

Page 41: Solve the Cross-Cloud Conundrum with jclouds

41RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Documentation

Page 42: Solve the Cross-Cloud Conundrum with jclouds

42RACKSPACE® HOSTING | WWW.RACKSPACE.COM

SDKs

Survey is show junior devops are still believe in Tooth Fairy, Santa Claus and documentation. @DevOps_Borat

Page 43: Solve the Cross-Cloud Conundrum with jclouds

43RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Cloud Accounts

Page 44: Solve the Cross-Cloud Conundrum with jclouds

44RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Rackspace j.mp/jcldsajug

•BYOB?

•rackspace.com/cloud/public/•mycloud.rackspace.com•Note: Username, Password

Page 45: Solve the Cross-Cloud Conundrum with jclouds

45RACKSPACE® HOSTING | WWW.RACKSPACE.COM

HP j.mp/jcldsajug

•hpcloud.com/sign_up•console.hpcloud.com/compute•Activate AZ1 and AZ2•Top right > View API Keys•Note: Tenant Name, Username, Password

Page 46: Solve the Cross-Cloud Conundrum with jclouds

46RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Terminology

Page 47: Solve the Cross-Cloud Conundrum with jclouds

47RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Terminology j.mp/jcldsajug

jclouds Rackspace/OpenStack

Compute Cloud Servers/Nova

Node Server

Location Region

Hardware Flavor

NodeMetadata Server details

User Metadata Metadata

BlobStore Cloud Files/Swift

Blob File/Object

Page 48: Solve the Cross-Cloud Conundrum with jclouds

48RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Installation

Page 49: Solve the Cross-Cloud Conundrum with jclouds

49RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Ant j.mp/jcldsajug

•mkdir jclouds-workshop•cd jclouds-workshop•Create build.xml• gist.github.com/everett-toews/3861545

•ant

Page 50: Solve the Cross-Cloud Conundrum with jclouds

50RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Ivy j.mp/jcldsajug

•mkdir jclouds-workshop•cd jclouds-workshop•mkdir lib•gist.github.com/everett-toews/5242573

Page 51: Solve the Cross-Cloud Conundrum with jclouds

51RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Compute Example

Page 52: Solve the Cross-Cloud Conundrum with jclouds

52RACKSPACE® HOSTING | WWW.RACKSPACE.COM

JCloudsWorkshop.java j.mp/jcldsajug•Logging

• Create logback.xml• gist.github.com/everett-toews/3862553• Full logback.xml example

• Imports and Class definition• Create JCloudsWorkshop.java• gist.github.com/everett-toews/3861596• javac -cp ".:lib/*" JCloudsWorkshop.java• Note: Guice, Guava

Page 53: Solve the Cross-Cloud Conundrum with jclouds

53RACKSPACE® HOSTING | WWW.RACKSPACE.COM

JCloudsWorkshop.java j.mp/jcldsajug•main() and skeleton

• gist.github.com/everett-toews/3862453• javac -cp ".:lib/*" JCloudsWorkshop.java

• init()• gist.github.com/everett-toews/3862575• javac -cp ".:lib/*" JCloudsWorkshop.java• Note: Authentication

Page 54: Solve the Cross-Cloud Conundrum with jclouds

54RACKSPACE® HOSTING | WWW.RACKSPACE.COM

JCloudsWorkshop.java j.mp/jcldsajug•createNodes()

• gist.github.com/everett-toews/3862480• javac -cp ".:lib/*" JCloudsWorkshop.java

•configureAndStartWebservers()• gist.github.com/everett-toews/3862485• javac -cp ".:lib/*" JCloudsWorkshop.java• Note: Patterns

Page 55: Solve the Cross-Cloud Conundrum with jclouds

55RACKSPACE® HOSTING | WWW.RACKSPACE.COM

JCloudsWorkshop.java j.mp/jcldsajug

Number of cloud instance launch by ops team is direct proportional with LOC write by dev team.

@DevOps_Borat

Page 56: Solve the Cross-Cloud Conundrum with jclouds

56RACKSPACE® HOSTING | WWW.RACKSPACE.COM

JCloudsWorkshop.java j.mp/jcldsajug•waitForSsh()

• gist.github.com/everett-toews/3862516• javac -cp ".:lib/*" JCloudsWorkshop.java

•detectExtensions()• gist.github.com/everett-toews/3867123• javac -cp ".:lib/*" JCloudsWorkshop.java

Page 57: Solve the Cross-Cloud Conundrum with jclouds

57RACKSPACE® HOSTING | WWW.RACKSPACE.COM

JCloudsWorkshop.java j.mp/jcldsajug•printResults()

• gist.github.com/everett-toews/3862499• javac -cp ".:lib/*" JCloudsWorkshop.java

•close()• gist.github.com/everett-toews/3862504• javac -cp ".:lib/*" JCloudsWorkshop.java

Page 58: Solve the Cross-Cloud Conundrum with jclouds

58RACKSPACE® HOSTING | WWW.RACKSPACE.COM

JCloudsWorkshop.java j.mp/jcldsajug•Run!

• java -cp ".:lib/*" JCloudsWorkshop

Page 59: Solve the Cross-Cloud Conundrum with jclouds

59RACKSPACE® HOSTING | WWW.RACKSPACE.COM

JCloudsWorkshop.java j.mp/jcldsajug

Hello World in cloud is involve 1 load balancer, 3 web server and 2 database server.

@DevOps_Borat

Page 60: Solve the Cross-Cloud Conundrum with jclouds

60RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Other Topics j.mp/jcldsajug

•ServerApi/ServerAsyncApi•Concurrency•CLI•Jenkins•jclouds-chef•Pallet•Whirr

Page 61: Solve the Cross-Cloud Conundrum with jclouds

61RACKSPACE® HOSTING | WWW.RACKSPACE.COM

Next Steps

Page 63: Solve the Cross-Cloud Conundrum with jclouds

Thank You

Everett Toews

Developer Advocate

@everett_toews

And don’t forget to terminate your VMs

[email protected]