Video by freeCodeCamp.org · streamed from YouTube. All rights remain with the creator.
Lesson 4: Build a Heroku-Style Platform with Python and Pulumi
About this lesson
Services such as Heroku let developers launch websites and servers with a few clicks, and this tutorial shows how to build a simplified version of such a platform yourself in Python. The key is Pulumi's Automation API, which lets an ordinary program create and manage cloud infrastructure directly, instead of a person running commands at a terminal. The course begins by explaining what Heroku offers and how the Automation API fits into the idea of a self-service platform. It then installs and configures the Pulumi and AWS command-line tools, and sets up a new project from a template, adding Flask and a library for web requests. Next it builds the Flask web application step by step, and then writing the templates for the pages: a shared base layout, an index page, pages for websites and pages for virtual machines. The main part writes the functionality in Python. One module lets users create static websites hosted on Amazon S3, with each submitted form creating or updating its own stack and the list of sites built by reading each stack's exported outputs, along with editing and deleting. A second module does the same for EC2 virtual machines, choosing machine sizes and supplying an SSH key for access. To finish, you generate SSH keys, run the application and test both features end to end. Familiarity with Python and Flask helps. Afterwards, read Chapter 4 of the course book, which explains the design and what a production platform would add.