Slide 1

Slide 1 text

Introduction to Apache jclouds Ignasi Barrera

Slide 2

Slide 2 text

Agenda •  What is Apache jclouds? •  The community •  What does it do? •  Customization •  Code examples •  Roadmap: what’s next? 19/11/14   Introduc.on  to  Apache  jclouds   2  

Slide 3

Slide 3 text

What is Apache jclouds? An open source multi-cloud toolkit for the Java platform 19/11/14   Introduc.on  to  Apache  jclouds   3  

Slide 4

Slide 4 text

Why does multi-cloud matter? •  High availability •  Privacy •  Cost •  Performance •  Support One size does not fit all Avoid lock-in 19/11/14   Introduc.on  to  Apache  jclouds   4  

Slide 5

Slide 5 text

What does it do? Helps existing tools connect to cloud services •  Consistent integration pattern •  Pluggable components •  Addresses service quirks in a clean way •  Error/retry handling •  Pagination •  (Re)Authentication 19/11/14   Introduc.on  to  Apache  jclouds   5  

Slide 6

Slide 6 text

How does it keep quality? Supporting many providers is hard: •  APIs / Services change •  Providers can become obsolete •  Contributions have to be maintained •  … Unit + Live tests 19/11/14   Introduc.on  to  Apache  jclouds   6  

Slide 7

Slide 7 text

~" Community" ~

Slide 8

Slide 8 text

Community stats •  Started on April 2009 •  +12K total commits •  ~200 contributors (65 last year) •  +200 forks on GitHub 19/11/14   Introduc.on  to  Apache  jclouds   8  

Slide 9

Slide 9 text

Who uses Apache jclouds? 19/11/14   Introduc.on  to  Apache  jclouds   9  

Slide 10

Slide 10 text

~" Core concepts" ~

Slide 11

Slide 11 text

Locations 19/11/14   Introduc.on  to  Apache  jclouds   11   Locations help normalize placement across resource types All top-level resources have a location US-­‐CA   DE-­‐HE   BR-­‐SP   CH-­‐ZH   JP-­‐13  

Slide 12

Slide 12 text

APIs 19/11/14   Introduc.on  to  Apache  jclouds   12   API Custom endpoint Credentials … APIs are the Java translation of API docs. Abiquo, Nova, CloudStack, EC2

Slide 13

Slide 13 text

Providers 19/11/14   Introduc.on  to  Apache  jclouds   13   PROVIDER API LOCATION+DEFAULTS Configuration Providers represent concrete cloud services: API + location + defaults AWS, Google Compute Engine, DigitalOcean…

Slide 14

Slide 14 text

Pluggable strategies 19/11/14   Introduc.on  to  Apache  jclouds   14   PROVIDER Configuration Pluggable strategies, error & retry policies, pagination, drivers API LOCATION+DEFAULTS

Slide 15

Slide 15 text

Portable abstractions 19/11/14   Introduc.on  to  Apache  jclouds   15   API PROVIDER SERVICES MODEL Compute Blob Store Load Balancer

Slide 16

Slide 16 text

~" Show me the code!" ~

Slide 17

Slide 17 text

Connection to a Provider ContextBuilder.newBuilder(”google-compute-engine") .credentials(”account-email", ”private-key") .buildView(ComputeServiceContext.class); 19/11/14   Introduc.on  to  Apache  jclouds   17  

Slide 18

Slide 18 text

Connection to an API ContextBuilder.newBuilder(”google-compute-engine") .credentials(”account-email", ”private-key") .buildView(ComputeServiceContext.class); ComputeServiceContext ctx = ContextBuilder.newBuilder(”openstack-nova") .credentials(”tenant:user", ”password") .endpoint(“http://keystone.endpoint:5000/v2.0/”) .buildView(ComputeServiceContext.class); 19/11/14   Introduc.on  to  Apache  jclouds   18  

Slide 19

Slide 19 text

Getting the services ContextBuilder.newBuilder(”google-compute-engine") .credentials(”account-email", ”private-key") .buildView(ComputeServiceContext.class); ComputeServiceContext ctx = ContextBuilder.newBuilder(”openstack-nova") .credentials(”tenant:user", ”password") .endpoint(“http://keystone.endpoint:5000/v2.0/”) .buildView(ComputeServiceContext.class); ComputeService compute = ctx.getComputeService(); NovaApi nova = ctx.unwrapApi(NovaApi. class); 19/11/14   Introduc.on  to  Apache  jclouds   19  

Slide 20

Slide 20 text

Compute example ComputeService compute = ctx.getComputeService(); Template template = compute.templateBuilder() .osFamily(OsFamily.UBUNTU) .minRam(2048) .options(inboundPorts(22, 80)) .build(); compute.createNodesInGroup(”webfarm", 10, template); 19/11/14   Introduc.on  to  Apache  jclouds   20  

Slide 21

Slide 21 text

Configuring nodes compute.runScriptOnNode(“i-3142”, startTomcat, blockOnPort(8080, 300)) compute.runScriptOnNodesMatching(inGroup(“webfarm”), patchApache, blockOnComplete(false)) compute.submitScriptOnNode(“i-3142”, runChefSolo, RunScriptOptions.NONE) 19/11/14   Introduc.on  to  Apache  jclouds   21  

Slide 22

Slide 22 text

Accessing the nodes SshClient ssh = ctx.utils().sshForNode().apply(node); 19/11/14   Introduc.on  to  Apache  jclouds   22  

Slide 23

Slide 23 text

Accessing the nodes SshClient ssh = ctx.utils().sshForNode().apply(node); ssh.get(“/etc/passwd”); ssh.put(“/opt/conf.tar”, newFilePayload(new File(“conf.tar”))); ExecResponse result = ssh.exec(installJDK); ExecChannel channel = ssh.execChannel(runChefSolo); 19/11/14   Introduc.on  to  Apache  jclouds   23  

Slide 24

Slide 24 text

~" Customization" ~

Slide 25

Slide 25 text

Drivers Drivers configure specific strategies to perform concrete tasks 19/11/14   Introduc.on  to  Apache  jclouds   25   Logging slf4j, log4j, java logging SSH jsch, sshj HTTP ApacheHC, OkHttp, GAE I/O Netty Security Bouncycastle

Slide 26

Slide 26 text

Context properties Context properties can be used to override the default values Properties props = new Properties(); props.setProperty(PROPERTY_MAX_RETRIES, “5”); ContextBuilder.newBuilder(”google-compute-engine") .credentials(”account-email", ”private-key") .overrides(props) .buildView(ComputeServiceContext.class); 19/11/14   Introduc.on  to  Apache  jclouds   26  

Slide 27

Slide 27 text

Custom Guice modules Custom Guice modules can be configured to override the default behavior List modules = new ArrayList(); modules.add(new SLF4JLoggingModule()); ContextBuilder.newBuilder(”google-compute-engine") .credentials(”account-email", ”private-key") .modules(modules) .buildView(ComputeServiceContext.class); 19/11/14   Introduc.on  to  Apache  jclouds   27  

Slide 28

Slide 28 text

~" Roadmap" ~

Slide 29

Slide 29 text

Roadmap •  Finish shiny new clouds such as Google and Docker •  Cleanup labs providers: nuke and promote! •  More vendor engagement •  Better support for Android and other platforms •  Improve the community! 19/11/14   Introduc.on  to  Apache  jclouds   29  

Slide 30

Slide 30 text

Getting involved •  Talk to us –  Participate in our mailing lists –  Join the #jclouds IRC channel at Freenode •  Contribute code –  We use GitHub. Just raise a pull request! •  Contribute documentation –  You don’t even need to checkout the code of the site. Our walk n’ doc allows you to edit every page on-the-fly! 19/11/14   Introduc.on  to  Apache  jclouds   30  

Slide 31

Slide 31 text

Thank you!" ~" http://jclouds.apache.org