CloudBridge
A Simple Cross-Cloud Python Library
Nuwan Goonasekera, Andrew Lonie, James Taylor, Enis Afgan
Outline
● Background and motivation
● Evaluation of available options
● CloudBridge
○ Design philosophy
○ Testing philosophy
○ Structure
○ Code Samples
● Demo
○ CloudLaunch
● Using
● Contributing
● Questions
Why?
● We needed to make the Genomics Virtual Lab/Galaxy CloudMan
cloud independent
○ Original version written against Amazon’s EC2 APIs
○ Ran on OpenStack using OpenStack’s EC2 Compatibility Layer
● OpenStack EC2 compatibility layer had limitations
○ Stability issues
○ Lacked features: Cannot name instances, cannot specify root volume sizes etc.
etc.
○ Deprecated - being spun off as separate project
● Go Native! - native APIs were
○ More stable
○ Cutting edge
○ Not likely to be dropped
The Available Options
● Apache Libcloud
○ The obvious candidate
○ Supports more than 30 providers
○ Supports Python 2.5 - 3
● HTTP abstraction layers
○ e.g. Apache DeltaCloud, Dasein Cloud
○ Need to run a separate HTTP service
○ Service would abstract away the specific clouds
● Build your own abstraction
○ NIH syndrome?
○ Differences between clouds can be complicated
○ How do you get access to so many clouds anyway?
Apache Libcloud Design
● Offers a lowest-common-denominator approach
○ Pros
■ Widest possible compatibility
■ Over 30 providers
■ Supports many versions of Python
■ Basic abstraction standardised
○ Cons
■ Everything else exposed as a provider specific extension (“ex_”)
■ Lots of methods/properties are “ex_”:
● ex_list_availability_zones
● def create_node(ex_keyname, ex_userdata..)
● ex_create_security_group
● ex_create_floating_ip etc.
○ In practice, requires special-cased code, unless requirements are very modest.
Apache Libcloud Design (contd…)
● Wraps libraries at a ReST/HTTP level, instead of using native SDKs
○ Pros
■ Minimises dependencies
■ Gives control over client-side implementation
○ Cons
■ Slower to incorporate features over native SDKs
■ Significant duplication of work
● Boto is over 77,000 lines of code
● Libcloud weighing in at 250,000+
Apache Libcloud Design (contd…)
● Testing is largely provider specific
○ This is because the exposed methods tend to be provider specific
○ Does not guarantee a write-once-run-anywhere experience
○ Makes it difficult to support a large number of clouds in practice
■ How do you test against many clouds yourself?
■ How do you even get access to so many clouds?
Apache Libcloud Design (contd…)
Does not offer a way to determine provider feature sets/profiles at runtime
Makes it difficult to write cross-cloud code
Meanwhile...
Mature clouds are converging in terms of functionality and scope
Making a single, uniform interface possible
Desirable requirements
● Need a write-once, run-anywhere experience
● Should not need to special-case code on a per cloud basis
○ Cannot obtain access to clouds easily
○ Don’t have the time to test them on each
● Simple and Pythonic
Tradeoffs
● Skip on widest possible compatibility
● Fine-grained feature determination
CloudBridge
A Simple Cross-Cloud Python Library
CloudBridge Design Goals
1. Offer a uniform API irrespective of the underlying provider
a. No special casing of application code
b. Simpler code
2. Provide a set of conformance tests for all supported clouds
a. No need to test against each cloud
b. Goal of “write-once-run-anywhere”
3. Focus on mature clouds with a required minimal set of features
a. Enables 1 and 2
4. Be as thin as possible
a. Keep the code-simple and reuse existing work ⟶ greater reliability, reduced development time
CloudBridge Testing Goals
1. Write one set of tests that all provider implementations must pass
2. Make the tests a ‘conformance’ test suite
● Validate that each implementation correctly implements the CloudBridge specification
3. No provider specific testing required
● A provider which passes the test suite can be used safely by an application with no additional
provider specific testing
4. Tests must pass against real infrastructure
● Mocks used to speed-up feedback
● But same tests must pass on real infrastructure
5. Aim for 100% code coverage
Automated testing using Travis
Testing py27, py35,
pypy
On OpenStack
(DevStack) and Mock
AWS (moto)
CloudBridge Design
API revolves around 3 concepts
a. Providers
An entry point for a service, encapsulating a connection
b. Services
Exposes provider functionality/feature sets
c. Resources
A remote cloud resource, such a Machine Instance, Volume etc.
Provider Service Resource Detail
Service name list get find create
InstanceService yes yes yes yes
VolumeService yes yes yes yes
SnapshotService yes yes yes yes
ImageService yes yes yes no
NetworkService yes yes yes yes
SubnetService yes yes no yes
ObjectStoreService yes yes yes yes
KeyPairService yes yes yes yes
SecurityGroupService yes yes yes yes
InstanceTypeService yes yes yes N/A
RegionService yes yes no N/A
Service feature set
Services have consistent interfaces:
<ServiceName>.[list|get|find|create]()
Resource feature
set
Resources have a common set of basic
properties: id, name
Plus fields and methods appropriate for
that resource type
Sample code: provider setup
$ pip install cloudbridge
1. from cloudbridge.cloud.factory import CloudProviderFactory
2. from cloudbridge.cloud.factory import ProviderList
3. aws_config = {'aws_access_key': 'a_key', 'aws_secret_key': 's_key')
4. provider = CloudProviderFactory().create_provider(ProviderList.AWS, aws_config)
5. os_config = {'os_username': 'username',
'os_password': 'pwd',
'os_tenant_name': 'tenant',
'os_auth_url': 'url',
'os_region_name': 'region'}
6. provider = CloudProviderFactory().create_provider(ProviderList.OPENSTACK, os_config)
OpenStack
AWS
Sample code: launch an instance
1. kp = provider.security.key_pairs.create('cloudbridge_intro')
2. with open('cloudbridge_intro.pem', 'w') as f:
3. f.write(kp.material)
4. sg = provider.security.security_groups.create(
5. 'cloudbridge_intro', 'A security group used by CloudBridge')
6. sg.add_rule('tcp', 22, 22, '0.0.0.0/0')
7. img = provider.compute.images.get(image_id)
8. inst_type = sorted([t for t in provider.compute.instance_types.list() if t.vcpus >= 2 and t.ram >= 4],
key=lambda x: x.vcpus*x.ram)[0]
9. inst = provider.compute.instances.create(
name='CloudBridge-intro', image=img, instance_type=inst_type,
key_pair=kp, security_groups=[sg])
10. # Wait until ready
11. inst.wait_till_ready()
12. # Show instance state
13. inst.state
14. # 'running'
15. inst.public_ips
16. # [u'54.166.125.219']
Create a key pair
Create a security group
Launch an instance
Currently Supported
cloudbridge.readthedocs.org
Get started guide
Usage guide
Contributor guide
API reference
A quick demo: CloudLaunch
CloudLaunch is a general-purpose cloud launcher
○ Multi-cloud
○ ReST API driven with Angular 2 front end
○ Built on CloudBridge and Django Rest Framework
http://beta.launch.usegalaxy.org/
Using/Contributing/Source Code
https://github.com/gvlproject/cloudbridge
http://cloudbridge.readthedocs.org/
Acknowledgments

More Related Content

PPTX
Node js with steroids
PDF
PyConIT 2018 Writing and deploying serverless python applications
PPTX
Docker on AWS - the Right Way
PPTX
Node.js Chapter1
PDF
Microservices with AWS Lambda and the Serverless Framework
PPTX
Nodejs overview
PDF
Before you jump into Angular
PDF
API Design in the Modern Era - Architecture Next 2020
Node js with steroids
PyConIT 2018 Writing and deploying serverless python applications
Docker on AWS - the Right Way
Node.js Chapter1
Microservices with AWS Lambda and the Serverless Framework
Nodejs overview
Before you jump into Angular
API Design in the Modern Era - Architecture Next 2020

What's hot (20)

PPT
Docker swarm
PPTX
Coordinating Micro-Services with Spring Cloud Contract
PPTX
Asynchronous programming in ASP.NET
PDF
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
PDF
Using Document Databases with TYPO3 Flow
PDF
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
PDF
The new Netflix API
PPTX
Multi host container networking
PPTX
Docker & ECS: Secure Nearline Execution
PDF
Netflix Open Source Meetup Season 4 Episode 3
PPT
Sebastien goasguen cloud stack and docker
PDF
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
PDF
AWS Primer and Quickstart
PPTX
Building Micro-Services with Scala
PDF
Writing your First Ansible Playbook
PPTX
How to Build Your First Web App in Go
PPTX
Onnx and onnx runtime
PDF
20170831 - Greg Palmier: Terraform & AWS at Tempus
PDF
Wido den hollander cloud stack and ceph
PPTX
Serverless
Docker swarm
Coordinating Micro-Services with Spring Cloud Contract
Asynchronous programming in ASP.NET
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Using Document Databases with TYPO3 Flow
Cloudsolutionday 2016: DevOps workflow with Docker on AWS
The new Netflix API
Multi host container networking
Docker & ECS: Secure Nearline Execution
Netflix Open Source Meetup Season 4 Episode 3
Sebastien goasguen cloud stack and docker
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
AWS Primer and Quickstart
Building Micro-Services with Scala
Writing your First Ansible Playbook
How to Build Your First Web App in Go
Onnx and onnx runtime
20170831 - Greg Palmier: Terraform & AWS at Tempus
Wido den hollander cloud stack and ceph
Serverless
Ad

Similar to 2016 07 - CloudBridge Python library (XSEDE16) (20)

PDF
Columbus AWS Meetup: AWS Certifications
PPTX
Power of Azure Devops
ODP
Groovy In the Cloud
PDF
Learn about AWS Certifications - Andrew May, Columbus
PPTX
How (and why) to roll your own Docker SaaS
PDF
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
PDF
Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...
PDF
Evaluating Cloud Native Storage Vendors - DoK Talks #147
PPTX
Andrew May - Getting Certified for Fun and Profit
PPTX
Azure serverless architectures
PPTX
Building self service framework
PPTX
Funky serverless features at aws
PPTX
AWS ECS Copilot DevOps Presentation
PDF
Serverless in java Lessons learnt
PDF
Serverless in Java Lessons learnt
PDF
Extensible dev secops pipelines with Jenkins, Docker, Terraform, and a kitche...
PPTX
How to build a JavaScript toolkit
PPTX
Serverless - DevOps Lessons Learned From Production
PDF
CI CD using AWS Developer Tools Online Workshop
PPTX
Serverless design considerations for Cloud Native workloads
Columbus AWS Meetup: AWS Certifications
Power of Azure Devops
Groovy In the Cloud
Learn about AWS Certifications - Andrew May, Columbus
How (and why) to roll your own Docker SaaS
Devops continuousintegration and deployment onaws puttingmoneybackintoyourmis...
Three Degrees of Mediation: Challenges and Lessons in building Cloud-agnostic...
Evaluating Cloud Native Storage Vendors - DoK Talks #147
Andrew May - Getting Certified for Fun and Profit
Azure serverless architectures
Building self service framework
Funky serverless features at aws
AWS ECS Copilot DevOps Presentation
Serverless in java Lessons learnt
Serverless in Java Lessons learnt
Extensible dev secops pipelines with Jenkins, Docker, Terraform, and a kitche...
How to build a JavaScript toolkit
Serverless - DevOps Lessons Learned From Production
CI CD using AWS Developer Tools Online Workshop
Serverless design considerations for Cloud Native workloads
Ad

More from Enis Afgan (17)

PDF
Federated Galaxy: Biomedical Computing at the Frontier
PDF
From laptop to super-computer: standardizing installation and management of G...
PDF
Horizontal scaling with Galaxy
PDF
Endofday: A Container Workflow Engine for Scalable, Reproducible Computation
PDF
2017.07.19 Galaxy & Jetstream cloud
PDF
Resource planning on the (Amazon) cloud
PDF
The pulse of cloud computing with bioinformatics as an example
PDF
Cloud computing and bioinformatics
PDF
Galaxy CloudMan performance on AWS
PDF
Adding Transparency and Automation into the Galaxy Tool Installation Process
PDF
Enabling Cloud Bursting for Life Sciences within Galaxy
PDF
Introduction to Galaxy and RNA-Seq
PDF
IRB Galaxy CloudMan radionica
PDF
GCC 2014 scriptable workshop
PPTX
Data analysis with Galaxy on the Cloud
PDF
Galaxy workshop
PDF
CloudMan workshop
Federated Galaxy: Biomedical Computing at the Frontier
From laptop to super-computer: standardizing installation and management of G...
Horizontal scaling with Galaxy
Endofday: A Container Workflow Engine for Scalable, Reproducible Computation
2017.07.19 Galaxy & Jetstream cloud
Resource planning on the (Amazon) cloud
The pulse of cloud computing with bioinformatics as an example
Cloud computing and bioinformatics
Galaxy CloudMan performance on AWS
Adding Transparency and Automation into the Galaxy Tool Installation Process
Enabling Cloud Bursting for Life Sciences within Galaxy
Introduction to Galaxy and RNA-Seq
IRB Galaxy CloudMan radionica
GCC 2014 scriptable workshop
Data analysis with Galaxy on the Cloud
Galaxy workshop
CloudMan workshop

Recently uploaded (20)

PDF
The Digital Engine Room: Unlocking APAC’s Economic and Digital Potential thro...
PDF
EGCB_Solar_Project_Presentation_and Finalcial Analysis.pdf
PDF
Decision Optimization - From Theory to Practice
PPTX
Introduction-to-Artificial-Intelligence (1).pptx
PDF
Altius execution marketplace concept.pdf
PDF
FASHION-DRIVEN TEXTILES AS A CRYSTAL OF A NEW STREAM FOR STAKEHOLDER CAPITALI...
PDF
Uncertainty-aware contextual multi-armed bandits for recommendations in e-com...
PDF
Human Computer Interaction Miterm Lesson
PDF
Revolutionizing recommendations a survey: a comprehensive exploration of mode...
PDF
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
PDF
The Basics of Artificial Intelligence - Understanding the Key Concepts and Te...
PDF
Peak of Data & AI Encore: Scalable Design & Infrastructure
PDF
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
PDF
【AI論文解説】高速・高品質な生成を実現するFlow Map Models(Part 1~3)
PPTX
Strategic Picks — Prioritising the Right Agentic Use Cases [2/6]
PDF
State of AI in Business 2025 - MIT NANDA
PPTX
AQUEEL MUSHTAQUE FAKIH COMPUTER CENTER .
PDF
Be ready for tomorrow’s needs with a longer-lasting, higher-performing PC
PDF
Optimizing bioinformatics applications: a novel approach with human protein d...
PDF
1_Keynote_Breaking Barriers_한계를 넘어서_Charith Mendis.pdf
The Digital Engine Room: Unlocking APAC’s Economic and Digital Potential thro...
EGCB_Solar_Project_Presentation_and Finalcial Analysis.pdf
Decision Optimization - From Theory to Practice
Introduction-to-Artificial-Intelligence (1).pptx
Altius execution marketplace concept.pdf
FASHION-DRIVEN TEXTILES AS A CRYSTAL OF A NEW STREAM FOR STAKEHOLDER CAPITALI...
Uncertainty-aware contextual multi-armed bandits for recommendations in e-com...
Human Computer Interaction Miterm Lesson
Revolutionizing recommendations a survey: a comprehensive exploration of mode...
“Introduction to Designing with AI Agents,” a Presentation from Amazon Web Se...
The Basics of Artificial Intelligence - Understanding the Key Concepts and Te...
Peak of Data & AI Encore: Scalable Design & Infrastructure
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
【AI論文解説】高速・高品質な生成を実現するFlow Map Models(Part 1~3)
Strategic Picks — Prioritising the Right Agentic Use Cases [2/6]
State of AI in Business 2025 - MIT NANDA
AQUEEL MUSHTAQUE FAKIH COMPUTER CENTER .
Be ready for tomorrow’s needs with a longer-lasting, higher-performing PC
Optimizing bioinformatics applications: a novel approach with human protein d...
1_Keynote_Breaking Barriers_한계를 넘어서_Charith Mendis.pdf

2016 07 - CloudBridge Python library (XSEDE16)

  • 1. CloudBridge A Simple Cross-Cloud Python Library Nuwan Goonasekera, Andrew Lonie, James Taylor, Enis Afgan
  • 2. Outline ● Background and motivation ● Evaluation of available options ● CloudBridge ○ Design philosophy ○ Testing philosophy ○ Structure ○ Code Samples ● Demo ○ CloudLaunch ● Using ● Contributing ● Questions
  • 3. Why? ● We needed to make the Genomics Virtual Lab/Galaxy CloudMan cloud independent ○ Original version written against Amazon’s EC2 APIs ○ Ran on OpenStack using OpenStack’s EC2 Compatibility Layer ● OpenStack EC2 compatibility layer had limitations ○ Stability issues ○ Lacked features: Cannot name instances, cannot specify root volume sizes etc. etc. ○ Deprecated - being spun off as separate project ● Go Native! - native APIs were ○ More stable ○ Cutting edge ○ Not likely to be dropped
  • 4. The Available Options ● Apache Libcloud ○ The obvious candidate ○ Supports more than 30 providers ○ Supports Python 2.5 - 3 ● HTTP abstraction layers ○ e.g. Apache DeltaCloud, Dasein Cloud ○ Need to run a separate HTTP service ○ Service would abstract away the specific clouds ● Build your own abstraction ○ NIH syndrome? ○ Differences between clouds can be complicated ○ How do you get access to so many clouds anyway?
  • 5. Apache Libcloud Design ● Offers a lowest-common-denominator approach ○ Pros ■ Widest possible compatibility ■ Over 30 providers ■ Supports many versions of Python ■ Basic abstraction standardised ○ Cons ■ Everything else exposed as a provider specific extension (“ex_”) ■ Lots of methods/properties are “ex_”: ● ex_list_availability_zones ● def create_node(ex_keyname, ex_userdata..) ● ex_create_security_group ● ex_create_floating_ip etc. ○ In practice, requires special-cased code, unless requirements are very modest.
  • 6. Apache Libcloud Design (contd…) ● Wraps libraries at a ReST/HTTP level, instead of using native SDKs ○ Pros ■ Minimises dependencies ■ Gives control over client-side implementation ○ Cons ■ Slower to incorporate features over native SDKs ■ Significant duplication of work ● Boto is over 77,000 lines of code ● Libcloud weighing in at 250,000+
  • 7. Apache Libcloud Design (contd…) ● Testing is largely provider specific ○ This is because the exposed methods tend to be provider specific ○ Does not guarantee a write-once-run-anywhere experience ○ Makes it difficult to support a large number of clouds in practice ■ How do you test against many clouds yourself? ■ How do you even get access to so many clouds?
  • 8. Apache Libcloud Design (contd…) Does not offer a way to determine provider feature sets/profiles at runtime Makes it difficult to write cross-cloud code
  • 9. Meanwhile... Mature clouds are converging in terms of functionality and scope Making a single, uniform interface possible
  • 10. Desirable requirements ● Need a write-once, run-anywhere experience ● Should not need to special-case code on a per cloud basis ○ Cannot obtain access to clouds easily ○ Don’t have the time to test them on each ● Simple and Pythonic Tradeoffs ● Skip on widest possible compatibility ● Fine-grained feature determination
  • 12. CloudBridge Design Goals 1. Offer a uniform API irrespective of the underlying provider a. No special casing of application code b. Simpler code 2. Provide a set of conformance tests for all supported clouds a. No need to test against each cloud b. Goal of “write-once-run-anywhere” 3. Focus on mature clouds with a required minimal set of features a. Enables 1 and 2 4. Be as thin as possible a. Keep the code-simple and reuse existing work ⟶ greater reliability, reduced development time
  • 13. CloudBridge Testing Goals 1. Write one set of tests that all provider implementations must pass 2. Make the tests a ‘conformance’ test suite ● Validate that each implementation correctly implements the CloudBridge specification 3. No provider specific testing required ● A provider which passes the test suite can be used safely by an application with no additional provider specific testing 4. Tests must pass against real infrastructure ● Mocks used to speed-up feedback ● But same tests must pass on real infrastructure 5. Aim for 100% code coverage
  • 14. Automated testing using Travis Testing py27, py35, pypy On OpenStack (DevStack) and Mock AWS (moto)
  • 15. CloudBridge Design API revolves around 3 concepts a. Providers An entry point for a service, encapsulating a connection b. Services Exposes provider functionality/feature sets c. Resources A remote cloud resource, such a Machine Instance, Volume etc.
  • 17. Service name list get find create InstanceService yes yes yes yes VolumeService yes yes yes yes SnapshotService yes yes yes yes ImageService yes yes yes no NetworkService yes yes yes yes SubnetService yes yes no yes ObjectStoreService yes yes yes yes KeyPairService yes yes yes yes SecurityGroupService yes yes yes yes InstanceTypeService yes yes yes N/A RegionService yes yes no N/A Service feature set Services have consistent interfaces: <ServiceName>.[list|get|find|create]() Resource feature set Resources have a common set of basic properties: id, name Plus fields and methods appropriate for that resource type
  • 18. Sample code: provider setup $ pip install cloudbridge 1. from cloudbridge.cloud.factory import CloudProviderFactory 2. from cloudbridge.cloud.factory import ProviderList 3. aws_config = {'aws_access_key': 'a_key', 'aws_secret_key': 's_key') 4. provider = CloudProviderFactory().create_provider(ProviderList.AWS, aws_config) 5. os_config = {'os_username': 'username', 'os_password': 'pwd', 'os_tenant_name': 'tenant', 'os_auth_url': 'url', 'os_region_name': 'region'} 6. provider = CloudProviderFactory().create_provider(ProviderList.OPENSTACK, os_config) OpenStack AWS
  • 19. Sample code: launch an instance 1. kp = provider.security.key_pairs.create('cloudbridge_intro') 2. with open('cloudbridge_intro.pem', 'w') as f: 3. f.write(kp.material) 4. sg = provider.security.security_groups.create( 5. 'cloudbridge_intro', 'A security group used by CloudBridge') 6. sg.add_rule('tcp', 22, 22, '0.0.0.0/0') 7. img = provider.compute.images.get(image_id) 8. inst_type = sorted([t for t in provider.compute.instance_types.list() if t.vcpus >= 2 and t.ram >= 4], key=lambda x: x.vcpus*x.ram)[0] 9. inst = provider.compute.instances.create( name='CloudBridge-intro', image=img, instance_type=inst_type, key_pair=kp, security_groups=[sg]) 10. # Wait until ready 11. inst.wait_till_ready() 12. # Show instance state 13. inst.state 14. # 'running' 15. inst.public_ips 16. # [u'54.166.125.219'] Create a key pair Create a security group Launch an instance
  • 21. cloudbridge.readthedocs.org Get started guide Usage guide Contributor guide API reference
  • 22. A quick demo: CloudLaunch CloudLaunch is a general-purpose cloud launcher ○ Multi-cloud ○ ReST API driven with Angular 2 front end ○ Built on CloudBridge and Django Rest Framework http://beta.launch.usegalaxy.org/