Multi-Provider Vagrant: AWS, VMware & More - PuppetConf 2013

9,884 views

Published on

"Multi-Provider Vagrant: AWS, VMware & More" by Mitchell Hashimoto, Founder, HashiCorp.

Presentation Overview: VirtualBox, VMware, AWS, RackSpace, and more. You get all the benefits of Vagrant with the power of working in whatever environment you need to. This capability unlocks entirely new use cases for Vagrant that can help better optimize the entire process of developing and testing Puppet code. In this talk, you'll learn how about the new multi-provider features, why they exist, and how they can be used. Your life will never be the same again.

Speaker Bio: Mitchell is best known as the creator of Vagrant and founder of HashiCorp. He is also an O'Reilly author and professional speaker. He is one of the top GitHub users by followers, activity, and contributions. "Automation obsessed," Mitchell strives to build elegant, powerful DevOps tools at HashiCorp that automate anything and everything. Mitchell is probably the only person in the world with deep knowledge of most virtualization hypervisors.

Published in: Technology
0 Comments
19 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
9,884
On SlideShare
0
From Embeds
0
Number of Embeds
4,334
Actions
Shares
0
Downloads
118
Comments
0
Likes
19
Embeds 0
No embeds

No notes for slide

Multi-Provider Vagrant: AWS, VMware & More - PuppetConf 2013

  1. 1. Living in a Multi-Provider World Friday, August 23, 13
  2. 2. I’m Mitchell Hashimoto Also known as @mitchellh Friday, August 23, 13
  3. 3. I build tools http://hashicorp.com Friday, August 23, 13
  4. 4. Vagrant http://www.vagrantup.com Friday, August 23, 13
  5. 5. Packer http://www.packer.io Friday, August 23, 13
  6. 6. http://vagrantup.com Friday, August 23, 13
  7. 7. I think you know what this nowadays... Friday, August 23, 13
  8. 8. SUCCESS! Friday, August 23, 13
  9. 9. You probably should really be using this nowadays to be working with and testing Puppet modules... Friday, August 23, 13
  10. 10. State of the Vagrant Friday, August 23, 13
  11. 11. Vagrants are still struggling to find work, shelter, and food. Friday, August 23, 13
  12. 12. Friday, August 23, 13
  13. 13. Vagrants are still struggling to find work, shelter, and food. Friday, August 23, 13
  14. 14. Vagrant! Friday, August 23, 13
  15. 15. Mature, stable, proven. Development since Jan 2010. Used by thousands of companies. Friday, August 23, 13
  16. 16. Friday, August 23, 13
  17. 17. Friday, August 23, 13
  18. 18. Vagrant Friday, August 23, 13
  19. 19. Puppet Friday, August 23, 13
  20. 20. Friday, August 23, 13
  21. 21. Create and Manage Virtualized Development Environments Mitchell Hashimoto Vagrant Up and Running http://hashi.co/vagrant-book Friday, August 23, 13
  22. 22. Releases in 2013: 14 Friday, August 23, 13
  23. 23. Vagrant 1.1+ was finally released in March. A year in development. Friday, August 23, 13
  24. 24. SUCCESS! Friday, August 23, 13
  25. 25. Things are good. Friday, August 23, 13
  26. 26. Things are getting BETTER! Friday, August 23, 13
  27. 27. Vagrant 1.1+ Friday, August 23, 13
  28. 28. I hear you like VirtualBox... Friday, August 23, 13
  29. 29. Providers. Friday, August 23, 13
  30. 30. a.k.a. No more VirtualBox. Friday, August 23, 13
  31. 31. (Don’t worry, Vagrant still works with VirtualBox) Friday, August 23, 13
  32. 32. BUT NOW IT WORKS WITH: AWS, DigitalOcean, HP Cloud, Joyent, KVM, libvirt, lxc, OpenStack, Rackspace, VMware. Friday, August 23, 13
  33. 33. Mother of God... Friday, August 23, 13
  34. 34. Vagrant 1.1: March 2013 Friday, August 23, 13
  35. 35. We’re now on 1.2.7. (14 releases later) Friday, August 23, 13
  36. 36. The same Vagrant you know and love, but so much better. Friday, August 23, 13
  37. 37. Backwards Compatible* Just “vagrant up” your 1.0.x Vagrantfiles. * Plugins from 1.0.x aren’t backwards compatible. Friday, August 23, 13
  38. 38. VAGRANT_API_VERSION = “2” Vagrant.configure(VAGRANT_API_VERSION) do |config| config.vm.box = “precise64” end A Vagrantfile Friday, August 23, 13
  39. 39. Installer only. “gem install” folks living in the past, take note. http://downloads.vagrantup.com Friday, August 23, 13
  40. 40. Path to 2.0 Guaranteed Vagrantfile stability, widespread use. Friday, August 23, 13
  41. 41. But 1.2.x is quite good The core is much stronger, many subtle issues fixed, latest support for various host/guest combos, NFS is way better, etc. Friday, August 23, 13
  42. 42. Vagrant Future Friday, August 23, 13
  43. 43. Going to get way better. This is the part where I tease you. Friday, August 23, 13
  44. 44. Windows VM support “vagrant up” Windows VMs with ease. Friday, August 23, 13
  45. 45. Box versioning No more “am I using the latest box?” Friday, August 23, 13
  46. 46. Docker Provisioner Yes, I’ll take a RabbitMQ with a side of Nginx. Friday, August 23, 13
  47. 47. Superpowered “package” Powered by Packer, to be discussed. Friday, August 23, 13
  48. 48. Automated box building PACKER! Friday, August 23, 13
  49. 49. Other stuff... I think I’ve said enough. Get excited. Friday, August 23, 13
  50. 50. Multi-Provider What does it mean? Why? Friday, August 23, 13
  51. 51. A provider manages compute resources* for Vagrant machines. * But also sets up networking and some basic storage too. Friday, August 23, 13
  52. 52. Vagrant 1.0: VirtualBox was the only “provider” Friday, August 23, 13
  53. 53. Why? Because you didn’t love VirtualBox hard enough. Friday, August 23, 13
  54. 54. VirtualBox isn’t great for every situation. Friday, August 23, 13
  55. 55. Honestly: VirtualBox is bad. * Its okay, until you realize almost anything else is way better. Friday, August 23, 13
  56. 56. Multiple providers enable Vagrant to do new and awesome things. Friday, August 23, 13
  57. 57. People love Vagrant for the workflow. Not for VirtualBox. Friday, August 23, 13
  58. 58. Other providers let you have that workflow in an environment that works best for you. Friday, August 23, 13
  59. 59. New use cases... Vagrant where Vagrant has never gone before. Friday, August 23, 13
  60. 60. Continuous Integration AWS, LXC, etc. Fantastic. Friday, August 23, 13
  61. 61. Develop locally. Test remotely. Work in VirtualBox. Test in AWS (more prod-like). Friday, August 23, 13
  62. 62. Vagrant in Vagrant VMware outside. LXC inside. Etcetera. Friday, August 23, 13
  63. 63. Corporate Environments Maximize that VMware investment. Friday, August 23, 13
  64. 64. etc... That was just a taste. Friday, August 23, 13
  65. 65. Multi-Provider How do I use it? Friday, August 23, 13
  66. 66. vagrant up --provider=foo Where foo is “vmware_fusion”, “aws”, etc. Friday, August 23, 13
  67. 67. Same Vagrantfile, multiple providers. Pretty magical once you see it. Friday, August 23, 13
  68. 68. Vagrant.configure(“2”) do |config| config.vm.box = “precise64” end A Vagrantfile Friday, August 23, 13
  69. 69. $ vagrant box add precise64 http://files.vagrantup.com/precise64.box ... $ vagrant box add precise64 http://files.vagrantup.com/precise64_vmware_fusion.box ... Some Boxes Friday, August 23, 13
  70. 70. $ vagrant up --provider=virtualbox ... OR $ vagrant up --provider=vmware_fusion ... Up in VirtualBox or VMware Friday, August 23, 13
  71. 71. It’s that easy. Friday, August 23, 13
  72. 72. Best effort. Not every provider can satisfy every Vagrant abstraction, but it won’t fail if it can’t. Example: AWS networking doesn’t map well to Vagrant networking. Vagrant + AWS will just ignore networking configurations. Not error. It’ll make a “best effort” to work. Friday, August 23, 13
  73. 73. Boxes They’re now tied to providers. Friday, August 23, 13
  74. 74. $ vagrant box list centos (virtualbox) precise64 (aws) precise64 (virtualbox) precise64 (vmware_fusion) Tied to a Provider Friday, August 23, 13
  75. 75. You need a box for each provider. Packer to the rescue! Friday, August 23, 13
  76. 76. VirtualBox: OVF export VMware: VMX export LXC: rootfs tarball AWS: Metadata (AMI info) What’s in a box? It varies by provider. Actually, anything can be in a box. The provider is responsible for reading and verifying structure. Friday, August 23, 13
  77. 77. Provider-Specific Config The full power of the provider, if you need it. Abstractions are nice, but sometimes you want to take advantage of specific properties of a provider. For example, AWS can do things VMware can’t, and vice versa. Provider-specific config lets you do that. Friday, August 23, 13
  78. 78. Vagrant.configure(“2”) do |config| config.vm.box = “precise64” config.vm.provider “virtualbox” do |v| v.customize [“modifyvm”, :id, “--memory”, “2048”] end config.vm.provider “vmware_fusion” do |v| v.vmx[“memsize”] = “2048” end end Example: Setting Memory Friday, August 23, 13
  79. 79. Vagrant.configure(“2”) do |config| config.vm.box = “precise64” config.vm.provider “virtualbox” do |v| v.customize [“modifyvm”, :id, “--memory”, “2048”] end config.vm.provider “vmware_fusion” do |v| v.vmx[“memsize”] = “2048” end end Example: Setting Memory Friday, August 23, 13
  80. 80. Vagrant.configure(“2”) do |config| config.vm.box = “precise64” config.vm.provider “virtualbox” do |v| v.customize [“modifyvm”, :id, “--memory”, “2048”] end config.vm.provider “vmware_fusion” do |v| v.vmx[“memsize”] = “2048” end end Example: Setting Memory Friday, August 23, 13
  81. 81. Powerful A place to expose full capabilities of underlying providers. Friday, August 23, 13
  82. 82. Portable Even if the user doesn’t have that provider installed, the Vagrantfile will still work. Friday, August 23, 13
  83. 83. Clear Purpose It makes it clear that that configuration applies ONLY to specific providers. Friday, August 23, 13
  84. 84. Totally Optional Just use a normal Vagrantfile if you don’t care. This is for power users. Friday, August 23, 13
  85. 85. That’s it for providers. Same powerful workflow, clean abstractions, uncompromised flexibility. Friday, August 23, 13
  86. 86. Real world: People usually choose one provider and stick with it. The important part is you now have choice. Friday, August 23, 13
  87. 87. Packer Friday, August 23, 13
  88. 88. Automatically create machine images for multiple platforms from a single source config Friday, August 23, 13
  89. 89. Friday, August 23, 13
  90. 90. Friday, August 23, 13
  91. 91. Machine image: A single deployable unit that contains a pre-configured OS and software. Friday, August 23, 13
  92. 92. AWS: AMI VMware: VMX + disks VirtualBox: OVF + disks DigitalOcean: Snapshots Friday, August 23, 13
  93. 93. Useful on its own, without Vagrant. But also very useful with Vagrant. Friday, August 23, 13
  94. 94. Production and dev are different providers. Case One Friday, August 23, 13
  95. 95. “vagrant up” takes too long. Case Two Friday, August 23, 13
  96. 96. Multi-provider Vagrant, but want identical images. Case Three Friday, August 23, 13
  97. 97. Packer images solve these three cases (and way more). Friday, August 23, 13
  98. 98. Ew... Images. The anti-image stigma Friday, August 23, 13
  99. 99. DevOps has historically been against machine images. Friday, August 23, 13
  100. 100. Important to understand why DevOps has historically been against machine images. Friday, August 23, 13
  101. 101. Golden images used to be the way. Friday, August 23, 13
  102. 102. Quarterly, unchanged, blessed image. Friday, August 23, 13
  103. 103. Getting any changes (ops or dev) in was slow and frustrating. Friday, August 23, 13
  104. 104. Necessary evil while tooling wasn’t as good as it is today. Friday, August 23, 13
  105. 105. With modern config management, easy to simply ignore images. Friday, August 23, 13
  106. 106. Machine images also have a ton of benefits. Friday, August 23, 13
  107. 107. Super fast infrastructure deployment. Friday, August 23, 13
  108. 108. Multi-cloud portability Friday, August 23, 13
  109. 109. Stability and Testability Friday, August 23, 13
  110. 110. A Modern Tool Embrace best practices. Friday, August 23, 13
  111. 111. Packer brings all the benefits of machine images without the downsides. Friday, August 23, 13
  112. 112. Automation No human interaction. Great for CI. Friday, August 23, 13
  113. 113. Config management Use Puppet to configure the image, run Puppet after it boots still. Lose nothing. Friday, August 23, 13
  114. 114. Repeatability Template goes into version control. Image creation knowledge is now in code. Friday, August 23, 13
  115. 115. Example Docker-ready AMI Friday, August 23, 13
  116. 116. Template { "variables": { "aws_access_key": "", "aws_secret_key": "" }, Friday, August 23, 13
  117. 117. Template "builders": [{ "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key` }}", "region": "us-east-1", "source_ami": "ami-23d9a94a", "instance_type": "m1.small", "ssh_username": "ubuntu", "ami_name": "packer-docker {{timestamp}}" }], Friday, August 23, 13
  118. 118. Template "provisioners": [{ "type": "shell", "scripts": [ "scripts/kernel.sh", "scripts/docker.sh" ] }] } Friday, August 23, 13
  119. 119. BUILD! $ packer build -var ‘aws_access_key=YOUR KEY’ -var ‘aws_secret_key=YOUR SECRET’ template.json ... Friday, August 23, 13
  120. 120. A few minutes later... Friday, August 23, 13
  121. 121. Easiest AMI creation ever? Just the beginning. Friday, August 23, 13
  122. 122. Thank you. vagrantup.com packer.io Friday, August 23, 13

×