Rule the cloud with!
Apache jclouds
ACNA 2016 − Vancouver
Ignasi Barrera
Apache jclouds PMC
ASF Member
Senior Engineer
Abiquo
Slide 2
Slide 2 text
Agenda
• Overview
• Core concepts
• Example application
• Roadmap: what’s next?
12 May 2016 Rule the cloud with Apache jclouds 2
Slide 3
Slide 3 text
What is Apache jclouds?
An open source multi-cloud toolkit for the
Java platform
12 May 2016 Rule the cloud with 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
12 May 2016 Rule the cloud with 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
• Runtime portability
• Error/retry handling
• Optimization: pagination, (re)auth, caching
12 May 2016 Rule the cloud with Apache jclouds 5
Slide 6
Slide 6 text
How to keep quality?
Supporting many providers is hard:
• APIs / Services change
• Providers can become obsolete
• Contributions have to be maintained
• …
Unit + Live tests
12 May 2016 Rule the cloud with Apache jclouds 6
Slide 7
Slide 7 text
Core concepts
Slide 8
Slide 8 text
Locations
12 May 2016 Rule the cloud with Apache jclouds 8
Help normalize
placement across
resource types
All top-level
resources have a
location
US-CA
DE-HE
BR-SP
CH-ZH JP-13
Slide 9
Slide 9 text
APIs
API
Custom endpoint
Credentials
…
APIs are the Java
translation of API
docs
Abiquo, EC2, Nova,
CloudStack…
12 May 2016 Rule the cloud with Apache jclouds 9
Slide 10
Slide 10 text
Providers
PROVIDER
API
LOCATION+DEFAULTS
Configuration
Providers represent
concrete cloud services:
API + location + defaults
AWS, Azure, GCE,
Rackspace…
12 May 2016 Rule the cloud with Apache jclouds 10
Slide 11
Slide 11 text
Pluggable strategies
PROVIDER
API
LOCATION+DEFAULTS
Configuration
Pluggable
strategies, error &
retry policies,
pagination, drivers
12 May 2016 Rule the cloud with Apache jclouds 11
Slide 12
Slide 12 text
Portable abstractions
API
PROVIDER
SERVICES
MODEL
Compute
Blob Store
Load Balancer
12 May 2016 Rule the cloud with Apache jclouds 12
Slide 13
Slide 13 text
Example application
Slide 14
Slide 14 text
Example application
12 May 2016 Rule the cloud with Apache jclouds 14
1. Provision a
load balancer
Slide 15
Slide 15 text
Example application
12 May 2016 Rule the cloud with Apache jclouds 15
2. Create servers
in two clouds
Slide 16
Slide 16 text
Example application
12 May 2016 Rule the cloud with Apache jclouds 16
3. Register in the
Chef Server
Slide 17
Slide 17 text
Example application
12 May 2016 Rule the cloud with Apache jclouds 17
4. Service
discovery
Slide 18
Slide 18 text
Example application
12 May 2016 Rule the cloud with Apache jclouds 18
5. Forward traffic
Slide 19
Slide 19 text
Example application
12 May 2016 Rule the cloud with Apache jclouds 19
• Using the same code to:
– Deploy all servers
– Generate the bootstrap scripts
– Manage the different clouds
Slide 20
Slide 20 text
Source code
Slide 21
Slide 21 text
Connection to the provider
12 May 2016 Rule the cloud with Apache jclouds 21
ComputeServiceContext ctx =
ContextBuilder.newBuilder(”google-compute-engine”)
.credentials(”account-email”, ”private-key”)
.buildView(ComputeServiceContext.class);
!
Slide 22
Slide 22 text
Connection to the provider
12 May 2016 Rule the cloud with Apache jclouds 22
ComputeServiceContext ctx =
ContextBuilder.newBuilder(”google-compute-engine”)
.credentials(”account-email”, ”private-key”)
.buildView(ComputeServiceContext.class);
ChefApi chef =
ContextBuilder.newBuilder(”chef”)
.endpoint(“https://chef-server/api”)
.credentials(”client-id”, ”private-key”)
.buildApi(ChefApi.class);
Slide 23
Slide 23 text
Connection to the provider
12 May 2016 Rule the cloud with Apache jclouds 23
ComputeServiceContext ctx =
ContextBuilder.newBuilder(”google-compute-engine”)
.credentials(”account-email”, ”private-key”)
.buildView(ComputeServiceContext.class);
ChefApi chef =
ContextBuilder.newBuilder(”chef”)
.endpoint(“https://chef-server/api”)
.credentials(”client-id”, ”private-key”)
.buildApi(ChefApi.class);
ctx.unwrapApi(GoogleComputeEngineApi.class);
Slide 24
Slide 24 text
Deployment template
12 May 2016 Rule the cloud with Apache jclouds 24
ComputeService compute = ctx.getComputeService();
Template template = compute.templateBuilder()
.smallest()
.minRam(2048)
.osFamily(OsFamily.DEBIAN)
.os64Bit(true)
.options(runScript(execute-chef)
.inboundPorts(22, 80, 22002))
.build();
Slide 25
Slide 25 text
Image selection
12 May 2016 Rule the cloud with Apache jclouds 25
ComputeService compute = ctx.getComputeService();
Template template = compute.templateBuilder()
.smallest()
.minRam(2048)
.osFamily(OsFamily.DEBIAN)
.os64Bit(true)
.options(runScript(execute-chef)
.inboundPorts(22, 80, 22002))
.build();
Slide 26
Slide 26 text
Deployment configuration
12 May 2016 Rule the cloud with Apache jclouds 26
ComputeService compute = ctx.getComputeService();
Template template = compute.templateBuilder()
.smallest()
.minRam(2048)
.osFamily(OsFamily.DEBIAN)
.os64Bit(true)
.options(runScript(execute-chef)
.inboundPorts(22, 80, 22002))
.build();
Slide 27
Slide 27 text
Deployment template
12 May 2016 Rule the cloud with Apache jclouds 27
ComputeService compute = ctx.getComputeService();
Template template = compute.templateBuilder()
.smallest()
.minRam(2048)
.osFamily(OsFamily.DEBIAN)
.os64Bit(true)
.options(runScript(execute-chef)
.inboundPorts(22, 80, 22002))
.build();
Slide 28
Slide 28 text
Deploy the nodes
12 May 2016 Rule the cloud with Apache jclouds 28
compute.createNodesInGroup(“lb”, 1, lb-template);
compute.createNodesInGroup(“web”, 4, web-template);
Slide 29
Slide 29 text
Live demo!!
!
https://github.com/nacx/acna2016-demo
Slide 30
Slide 30 text
Roadmap
Slide 31
Slide 31 text
Roadmap
• Promote Docker out of labs
• Complete the Azure ARM provider
• Finish the ProfitBricks REST provider
• Mentor GSoC 2016 project
• Release jclouds 2.0
• More docs!
12 May 2016 Rule the cloud with Apache jclouds 31
Slide 32
Slide 32 text
Get 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!
12 May 2016 Rule the cloud with Apache jclouds 32