Over the last few months, I’ve become an ardent evangelist for Microsoft’s Visual Studio Codespaces. Originally rolled out in November 2019 under the name Visual Studio Online, it has fast become my favorite place to noodle around with code. In this post, I’ll give an overview of Visual Studio Codespaces, touch on its costs, discuss some potential use-cases, and provide a high-level walk-through of how to set up your own instance of Visual Studio Codespaces.
What are Visual Studio Codespaces?
Visual Studio Codespaces are development environments hosted on the cloud accessible from any device. I can run Visual Studio Code from a browser window without installing it–or any dependencies the development environment needs to run my code–on my local computer. This allows me to edit, run, and save my code to a Git repository from any device with an Internet connection. This browser-based version of Visual Studio Code is fully functional and supports all of my favorite extensions. There’s also an option to connect directly to Visual Studio Codespaces from your local instance of Visual Studio Code.
How much do Visual Studio Codespaces cost?
Each Codespace currently incurs two types of costs–storage costs and compute costs. Currently, storage costs are charged over the lifetime of a Codespace. Compute costs are calculated based on the specifications of the virtual machine attached to a Codespace. It’s important to note that compute costs are charged only when a Codespace is in an “active” state. Typically, when a Codespace has been idle for 30 minutes, it changes to a “suspended” state and no more compute charges are incurred.
For example, a developer using Codespaces for two hours with a Basic virtual machine attached to review a pull request could expect to be charged approximately $0.19 total. A developer using a Codespace for a month (presuming 160 hours of active development and 730 hours of storage) could expect to pay approximately $33.44 for the month. You can learn more about pricing for Visual Studio Codespaces here, or you can visit the Microsoft pricing calculator that I set up here.
What are some use-cases for Visual Studio Codespaces?
On an enterprise level, a firm might use Codespaces for a team of developers. This would save the team the cost and effort of configuring individual physical development computers. Instead, each team member would have identical cloud-based development environments. This could reduce the perennial problem of: “Why does this code work on your machine, but not on mine?”
Individual developers might find Visual Studio Codespaces useful, too. Instead of being bound to a developer-strength personal device, a developer could rely on the power of the virtual machine attached to a Codespace to do the heavy lifting. Then, a developer could code in the browser window on a less powerful device–like a tablet or smartphone–from anywhere they have an Internet connection.
When you need fast and disposable development environments, you might consider using Visual Studio Codespaces. I’ve been studying for Microsoft’s Azure AI Engineer Associate certification lately. As part of my studies, I tinker with various code samples provided by Microsoft. Using Visual Studio Codespaces, I quickly spin up a Codespace, point it at the code sample’s repository, and edit the code from a browser window. This saves me from polluting my local development machine with dependencies I won’t need again. When I’m done, I just delete the Codespace.
How do I get started with Visual Studio Codespaces?
To get started with Visual Studio Codespaces, just follow the steps below. If you run into any issues, you might also try this quick-start provided by Microsoft here.
2. Select “Get started.”
3. Sign in using your Microsoft account, or create one.
4. Select “Create Codespace.”
5. You will be prompted to create a billing plan. Select your Subscription and Location and click Create.
6. Create your Codespace by filling in the fields. You can point your codespace at a particular Git repository or leave it blank. I recommend selecting Basic or Standard for Instance Type if you’re just exploring the service.
7. The Codespace may take a few minutes to create as the virtual machine is initialized and code from the Git repository you provided is loaded.
8. Voilà! A fully functional instance of Visual Studio Code running in the browser.
9. When you’re done with your Codespace, navigate back to the screen that displays all of your Codespaces, click the three dots on the tile for your Codespace and you can either suspend or delete the codespace.
10. If you don’t intend to continue using Visual Studio Codespaces, delete the Azure Resource Group that was automatically created when you created your Codespaces account in order to avoid incurring additional storage costs. To learn more about managing Resource Groups in Azure, you can visit Microsoft’s documentation here.
If you or your organization need development environments that are fast, duplicable, and dependable, consider using Visual Studio Codespaces. If you’d like more information on getting started, feel free to reach out to us at Intertech and we’ll gladly help!
Founded in 1991, Intertech delivers technology training and software development consulting to Fortune 500, Government and Leading Technology institutions. Learn more about us. Whether you are a developer interested in working for a company that invests in its employees or a company looking to partner with a team of technology leaders who provide solutions, mentor staff and add true business value, we’d like to meet you.