How to Deliver a Successful Tech Workshop with Vagrant and AWS
At Strata, I delivered workshop called Mining the Social Web with IPython Notebook, and in order to ensure that the workshop would meet its objectives and be a smashing success, I knew that a few constraints had to be considered:
- Everyone must be able to follow along with the examples. (The goal of the workshop is actually doing something with data as opposed to just talking about it.)
- You need a development environment to follow along with the examples. (You can’t do anything with data unless you have a development environment.)
- Most people wouldn’t have prepared a development environment. (Inevitable.)
- Preparing a development environment is isn’t possible to do on site at the workshop. (It’s far too time-consuming and the wireless would probably buckle even if it weren’t.)
Those constraints are actually pretty challenging to satisfy, but there are some approaches that you can consider:
- Do nothing; if people didn’t prepare, then it’s too bad for them. (Unacceptable if you want people to enjoy your workshop. Even if it’s not your fault that they didn’t prepare, it’s still your fault that they didn’t prepare.)
- Pass out media such as CDs or USB drives with the necessary software on it on site. (Cumbersome at the very least for a non-trivial number of attendees and still could be fairly time consuming.)
- Provide pre-configured cloud-based machines for everyone. (Check.)
Running a Vagrant Box on AWS
Powering Mining the Social Web’s virtual machine experience with Vagrant has turned out to be a remarkably good decision. It trivializes the process of bootstrapping a virtual machine and applying a configuration management template, which is perfect for creating a repeatable development environment. Just follow along with the quick start guide, watch the screencasts, and you’ll be up and running in no time.
But that’s the Vagrant you know and not the Vagrant that would do much to help with the workshop.
The Vagrant that you (probably) don’t know is the Vagrant that can just as trivially launch that very same virtual machine on the AWS cloud. In short, you just need an AWS account and the vagrant-aws plugin. In a little more detail, here are the basic steps involved once you’ve already been able to follow along with the quick start guide and launch your virtual machine locally:
- Sign up for an AWS account. (Right now, there’s even a “free tier” that will work just fine for Mining the Social Web, so it won’t even cost you anything. However, you are required to have a credit card on file.)
- Install the vagrant-aws plugin. Type this in a terminal: vagrant plugin install vagrant-aws
- Install a “dummy” Vagrant box, which just creates a shell for Vagrant to use for some local bookkeeping. Type this in a terminal: vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
- Define the four environment variables starting with MTSW_ that are referenced in Mining the Social Web’s Vagrantfile. These environment variables define your AWS access key, AWS secret access key, the name of the keypair used to start an EC2 instance, and the path to the private key for that keypair.
- Start your virtual machine in the cloud. Type vagrant up –provider=aws and keep an eye on the console
As with anything else, there may be a few configuration details that you’ll need to tweak, but that’s the gist. If you’re interested in launching a virtual machine with AWS provider, you should definitely learn some EC2 fundamentals, and read up enough about Vagrant to understand the contents of the Vagrantfile. In particular, bone up on the details associated with launching EC2 instances (so that you have a better idea of some of the other settings you can configure such as the region in which your AWS machines will start and those sorts of things), and invest a little bit of time learning more about Vagrantfile settings.
Vagrant Box on AWS
The instructions in the previous section are exactly what you’d do to bootstrap a single AWS instance in the cloud, and unless you’re doing some fairly heavy duty work, you should be able to employ a micro-instance that costs less than $0.02 per hour! However, recall that for my workshop, I didn’t need just a single instance. I needed to launch ~60 machines so that everyone in the workshop would have their own virtual machine.
As it turns out, it’s not so difficult to go from one to sixty. Here’s how:
- Login to your AWS management console to view running EC2 instances. (You’ll see the instance that Vagrant started on your behalf.)
- Create an AMI from your running EC2 instance. (An AMI is an “Amazon Machine Image”; think of it as a template for an EC2 instance.)
- Launch new EC2 instances from the “AMIs” item in the navigation menu.
Again, you will need to gain a little comfort with AWS along the way, but that’s pretty much all that’s required for a basic setup. At this point, you technically don’t even need Vagrant anymore since you can launch fully pre-configured EC2 instances as needed. (However, do keep in mind how much work Vagrant did to make it this easy to create the AMI image that you can now so easily employ.)
One other consideration worth pointing out is that you may want to think about securing your IPython Notebook server with a password since it’s in the cloud and could be accessible to anyone in the world if you haven’t locked down the range of IP addresses that access it. (Even then, a password would still probably be a good idea.)
Finally, note that your account will only be able to launch 20 EC2 instances by default, but that AWS customer service is ready and willing to help you if you need more. (Read more about my terrific encounter with AWS customer support.)
Now, go out and deliver a successful technical workshop!
If you’ve found this post interesting, you may also enjoy these other resources:
- Mining the Social Web’s Quick Start Guide
- Screencasts about social web mining
- Mining the Social Web with IPython Notebook (Workshop slides)