Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Apache jclouds - ApacheCon EU 2014

Introduction to Apache jclouds - ApacheCon EU 2014

Introduction to Apache jclouds talk given at ApacheCon EU 2014.

Apache jclouds is an open source multi-cloud toolkit for the Java platform that gives you the freedom to create applications that are portable across clouds while giving you full control to use cloud-specific features.

Ignasi Barrera

November 19, 2014
Tweet

More Decks by Ignasi Barrera

Other Decks in Technology

Transcript

  1. 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  
  2. What is Apache jclouds? An open source multi-cloud toolkit for

    the Java platform 19/11/14   Introduc.on  to  Apache  jclouds   3  
  3. 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  
  4. 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  
  5. 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  
  6. 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  
  7. 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  
  8. 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
  9. 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…
  10. Pluggable strategies 19/11/14   Introduc.on  to  Apache  jclouds   14

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

      API PROVIDER SERVICES MODEL Compute Blob Store Load Balancer
  12. 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  
  13. 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  
  14. 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  
  15. 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  
  16. 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
  17. 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  
  18. Custom Guice modules Custom Guice modules can be configured to

    override the default behavior List<Module> modules = new ArrayList<Module>(); 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  
  19. 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  
  20. 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