Scott's Weblog The weblog of an IT pro focusing on cloud computing, Kubernetes, Linux, containers, and networking

A Sandbox for Learning Pulumi

I recently started using Pulumi, a way of using a general purpose programming language for infrastructure-as-code projects. I’ve been using Pulumi with JavaScript (I know, some folks would say I should question my life decisions), and while installing Pulumi itself is pretty low-impact (a small group of binaries) there are a number of dependencies that need to be installed when using Pulumi with JavaScript. As I’m a stickler for keeping my primary system very “clean” with regard to installed packages and software, I thought I’d create a means whereby I can easily spin up a “sandbox environment” for learning Pulumi.

When creating this sandbox environment, I turned to some tools that are very familiar:

  • I used virtualization (a virtual machine) as the isolation mechanism. The next step is to use a Linux container, like a Docker container, as the isolation mechanism, but I thought I’d start with something a bit simpler at first.
  • Vagrant provides a way of automating the creation/destruction of said VM. Again, Vagrant is well-understood and widely used.
  • Ansible provides the automation to configure the VM with the necessary software (Pulumi and associated dependencies).
  • I also thought that some folks might find it interesting or useful to be able to instantiate AWS instances from a preconfigured AMI, so I also included a Packer build file to enable folks to build their own Pulumi-ready AMI.

Since it seemed reasonable to think that others might find this useful as well, I placed all of this into my GitHub “learning-tools” repository; check the pulumi folder. Obviously, you’ll need a virtualization provider (VMware Fusion, VirtualBox, and Libvirt are all supported), Vagrant, and Ansible installed. If you want to build your own AMI, you’ll need Packer and the associated AWS tooling installed as well.

There’s nothing terribly new or novel here; it uses tools and techniques that are already pretty well-known and well-understood by most folks. My goal here wasn’t to create something entirely new, but rather to make it easier to learn Pulumi while minimizing the impact/affect on my Linux system.

To use the Vagrant environment I created, simply copy the directory (or clone the entire repository) and then run vagrant up. After Vagrant is finished, run ansible-playbook configure.yml to configure the VM for Pulumi, and then you’re good to go.

In AWS, you could create a new AMI using Packer by running packer build packer.json, or create a new EC2 instance and run the configure.yml Ansible playbook against it.

To then make it easier to set up this Pulumi sandbox for various scenarios, I’ll be creating scenario-specific playbooks that you can apply using ansible-playbook. There’s only one there right now; it’s for creating a single EC2 instance using Pulumi and JavaScript. Since I’ve chosen to focus my efforts around JavaScript, future scenarios will also be JavaScript-centric, so keep that in mind.

(By the way, all this information is in the README file in the pulumi directory of my “learning-tools” repository.)

Additional Resources

For more background and context on Pulumi, you may want to check out episode 30 of the Full Stack Journey podcast, which features Luke Hoban, CTO of Pulumi, discussing what Pulumi is and why users should consider using it for their infrastructure-as-code projects. Also, Joe Beda did a TGIK episode on Pulumi; check it out on YouTube.

Metadata and Navigation

Be social and share this post!