apache libcloud
play

Apache Libcloud API Driven Operations Paul Querna September 29, - PowerPoint PPT Presentation

Apache Libcloud API Driven Operations Paul Querna September 29, 2010 Thursday, September 30, 2010 About Me Chief Architect at Cloudkick Developer on Apache HTTP Server Former VP Infrastructure @ ASF Libcloud developer!


  1. Apache Libcloud API Driven Operations Paul Querna September 29, 2010 Thursday, September 30, 2010

  2. About Me • Chief Architect at Cloudkick • Developer on Apache HTTP Server • Former VP Infrastructure @ ASF • Libcloud developer! Thursday, September 30, 2010

  3. About the Cloud Thursday, September 30, 2010

  4. About the Cloud • Awesome. Thursday, September 30, 2010

  5. About the Cloud • Awesome. • Really. Thursday, September 30, 2010

  6. About the Cloud • Awesome. • Really. • Maybe not always. Thursday, September 30, 2010

  7. About the Cloud • Awesome. • Really. • Maybe not always. • But mostly. Thursday, September 30, 2010

  8. Compute • Amazon EC2 • Rackspace Cloud • Linode • GoGrid • Voxel • And many more! Thursday, September 30, 2010

  9. I want a server. Thursday, September 30, 2010

  10. I want a server right now. Thursday, September 30, 2010

  11. Enter Libcloud from libcloud.types import Provider from libcloud.providers import get_driver rs = get_driver(Provider.RACKSPACE)('rackspace-apikey') rs.create_node('serverA') Thursday, September 30, 2010

  12. About Libcloud • Started in the summer of 2009 • Easy to use. • Portable. • Pure Python • Java version also underway Thursday, September 30, 2010

  13. Why? • API Styles: • Amazon: XML + Custom HMAC Auth • Rackspace: JSON + Auth Tickets • SoftLayer: XML RPC + User / Password Thursday, September 30, 2010

  14. 16 Providers Thursday, September 30, 2010

  15. Libcloud APIs • Originally 6 Core APIs • List Nodes • List Images • List Sizes • Create / Destroy / Reboot Node Thursday, September 30, 2010

  16. list_nodes foo = d.list_nodes() for node in foo: print node.id print node.public_ip Thursday, September 30, 2010

  17. Extended APIs • Providers inconsistent about services. • Have a “ex_” prefix, documented per- driver. • Amazon Security Groups: • amz.create_node(‘foo’, ex_securitygroup=‘groupA’) Thursday, September 30, 2010

  18. Getting Started • easy_install apache-libcloud Thursday, September 30, 2010

  19. Get your Provider Info • Amazon: • http://aws-portal.amazon.com/gp/aws/ developer/account/index.html? action=access-key • Rackspace: • https://manage.rackspacecloud.com/ APIAccess.do Thursday, September 30, 2010

  20. List your Machines from libcloud.types import Provider from libcloud.providers import get_driver d = get_driver(Provider.RACKSPACE)("xxxxxxx") nodes = d.list_nodes() for node in nodes: print "id: %s name: %s public_ips: %s" % (node.id, node.name, node.public_ip) Thursday, September 30, 2010

  21. Tricks! • Included data: • Location • Price-per-hour in USD • Cheapest 4 gigabyte node outside the US Thursday, September 30, 2010

  22. Cheapest 4 gig node outside the US possible = [] for d in drivers: loc = filter(lambda x: x.country != 'US', d.list_locations()) for l in loc: sizes = filter(lambda x: x.ram >= 4096, d.list_sizes(l)) for s in sizes: possible.append({'size': s, 'location': l, 'driver': d}) best = sorted(possible, lambda x,y: x['size'].price < y['size'].price)[0] print best Thursday, September 30, 2010

  23. One more thing! • deploy_node • Calls create_node • Consistent initial bootstrapping of machines. • SSH Keys • Configuration Management Thursday, September 30, 2010

  24. Installing Puppet skey = SSHKeyDeployment(key) sd = ScriptDeployment("apt-get install -y puppet") msd = MultiStepDeployment([skey, sd]) node = d.deploy_node(name="lc-test", deploy=msd) Thursday, September 30, 2010

  25. Running commands • Fabric • http://www.fabfile.org/ Thursday, September 30, 2010

  26. Integrating with Fabric env.hosts = [x.public_ip[0] for x in d.list_nodes()] def hostname(): run('hostname') Thursday, September 30, 2010

  27. $ fab hostname [173.45.245.33] run: hostname [173.45.245.33] out: lctest3.k1k.me [173.45.245.32] run: hostname [173.45.245.32] out: lctest2.k1k.me Done. Disconnecting from 173.45.245.33... done. Disconnecting from 173.45.245.32... done. Thursday, September 30, 2010

  28. Up next for Libcloud? Thursday, September 30, 2010

  29. Higher Level Apps • Silver Lining: Python Deployment on the Cloud • http://cloudsilverlining.org/ • Pantheon Mercury: Drupal Deployment on the Cloud • http://getpantheon.com/ Thursday, September 30, 2010

  30. Applications; Not just VMs • Cast: • http://github.com/cloudkick/cast • Galaxy: • http://github.com/ning/galaxy Thursday, September 30, 2010

  31. Related Projects • JClouds • Java • Apache Deltacloud • Ruby, little different ideas Thursday, September 30, 2010

  32. Questions? • Apache Libcloud: http://libcloud.org/ #libcloud on Freenode IRC • Slides online: http://paul.querna.org/slides Thursday, September 30, 2010

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend