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.

Ignasi Barrera

July 03, 2014
Tweet

More Decks by Ignasi Barrera

Other Decks in Programming

Transcript

  1. Agenda •  What is Apache jclouds? •  What does it

    do? •  Code examples •  Roadmap: what’s next?
  2. Why does multi-cloud matter? •  High availability •  Privacy • 

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

    generic and represent common service offerings: EC2, Nova...
  5. 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…
  6. How? Pluggable strategies P R O V I D E

    R A P I LOCATION + DEFAULTS Configuration Pluggable strategies Error/retry policies Pagination Drivers
  7. 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
  8. 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);
  9. 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);
  10. 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);
  11. 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);
  12. What’s next? •  Dropping support for Java 6 •  OpenStack

    Neutron and Swift refactor •  Docker •  DigitalOcean API v2 •  More docs!