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

Introduction to Apache jclouds

Introduction to Apache jclouds

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.

4ca6230b05046f1a809835985b1f8bc2?s=128

Ignasi Barrera

July 03, 2014
Tweet

Transcript

  1. Introduction to Apache jclouds The java multi-cloud toolkit Ignasi Barrera

    Apache jclouds PMC nacx@apache.org
  2. Agenda •  What is Apache jclouds? •  What does it

    do? •  Code examples •  Roadmap: what’s next?
  3. What is Apache jclouds? An open source multi-cloud toolkit for

    the Java platform
  4. Why does multi-cloud matter? •  High availability •  Privacy • 

    Cost •  Performance •  Support One size does not fit all Avoid lock-in
  5. 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
  6. How? APIs A P I Endpoint Credentials … APIs are

    generic and represent common service offerings: EC2, Nova...
  7. How? Providers P R O V I D E R

    A P I LOCATION + DEFAULTS Configuration Providers represent concrete cloud services: API + location + defaults AWS, GCE, Rackspace…
  8. How? Pluggable strategies P R O V I D E

    R A P I LOCATION + DEFAULTS Configuration Pluggable strategies Error/retry policies Pagination Drivers
  9. How? Portable abstractions A P I P R O V

    I D E R S E R V I C E S M O D E L Compute Blob Store Load Balancer
  10. Connection to a Provider ComputeServiceContext ctx = ContextBuilder.newBuilder(”hpcloud-compute") .credentials("identity", "credential")

    .buildView(ComputeServiceContext.class);
  11. Connection to an API ComputeServiceContext ctx = ContextBuilder.newBuilder(”hpcloud-compute") .credentials("identity", "credential")

    .buildView(ComputeServiceContext.class); ComputeServiceContext ctx = ContextBuilder.newBuilder(”openstack-nova") .credentials("identity", "credential") .endpoint(“http://keystone.endpoint:5000/v2.0/”) .buildView(ComputeServiceContext.class);
  12. Getting the services ComputeServiceContext ctx = ContextBuilder.newBuilder(”hpcloud-compute") .credentials("identity", "credential") .buildView(ComputeServiceContext.class);

    ComputeServiceContext ctx = ContextBuilder.newBuilder(”openstack-nova") .credentials("identity", "credential") .endpoint(“http://keystone.endpoint:5000/v2.0/”) .buildView(ComputeServiceContext.class); ComputeService compute = ctx.getComputeService(); NovaApi nova = ctx.unwrapApi(NovaApi. class);
  13. Compute example ComputeService compute = ctx.getComputeService(); Template template = compute.templateBuilder()

    .osFamily(OsFamily.UBUNTU) .minRam(2048) .options(inboundPorts(22, 80)) .build(); compute.createNodesInGroup("jclouds", 1, template);
  14. Configure a node compute.runScriptOnNode(“node-id”, script, options) compute.runScriptOnNodesMatching(filter, script, options) compute.submitScriptOnNode(“node-id”,

    script, options)
  15. Access the node SshClient ssh = ctx.utils().sshForNode().apply(“node-id”);

  16. Access the node SshClient ssh = ctx.utils().sshForNode().apply(“node-id”); ssh.get(path); ssh.put(path, content);

    ExecResponse result = ssh.exec(script); ExecChannel channel = ssh.execChannel(script);
  17. Open source ecosystem •  Apache Stratos •  Apache Brooklyn (incubating)

    •  Jenkins •  Chef •  jclouds CLI
  18. What’s next? •  Dropping support for Java 6 •  OpenStack

    Neutron and Swift refactor •  Docker •  DigitalOcean API v2 •  More docs!
  19. Thank you! http://jclouds.apache.org