spot_imgspot_imgspot_imgspot_img
HomeOperationsAutomated Operations5 VScode plugins every DevOps engineer should know

5 VScode plugins every DevOps engineer should know

-

Developers always want to use the tools they prefer. Popular IDEs such as Eclipse, IntelliJ and Visual Studio (enterprise) support a wide range of programming languages. The last couple of years, lightweight editors such as Atom, Sublime and Visual Studio Code became popular choices for developers. Especially for DevOps engineers which need to create and tweak IaC templates, pipeline files, Helm charts, Terraform scripts and Kubernetes manifests. Those files do not need to be compiled and you won’t need all of the advanced features you require for programming languages such as C#, Java or NativeScript. However, those scripts can become lengthy and complex at time. In this article, we’ll explore 5 VScode plugins every DevOps engineer should know. These plugins help to write source code faster, better and it reduces the number of errors later on in the delivery process.

Introduction

Visual Studio Code is the lightweight version of it’s bigger brother: Visual Studio from Microsoft. In the last couple of years, the popularity of this editor grew a lot. It runs on every major platform like Windows, MacOS and Linux. This contributes to it’s popularity, also since it’s not only for tech stacks typically found in Microsoft based environments. Since the number of users grows every day, the number of plugins increases and extra features are added with every new release. If you have not done so, download and install a copy from the original website. It’s free and open source.

In the next chapters you will find an overview of some of the most useful plugins grouped per category which resemble common stages in the entire Software Development LifeCycle. It greatly helps you to optimize and boost your productivity.

Infrastructure as Code

AWS offers Cloudformation as it’s template engine to fully support IaC. Templates can be written in plain Json or Yaml format. One of the most popular plugins to support this is called “Cloudformation” by AWS-scripting-guy.

  • It’s core feature is syntax checking from Yaml/Json file formats as well as .cform and .template extensions.
  • Function tags such as !If, !Ref and !Join will be whitelisted when you apply the plugin configuration to your settings file. This helps to reduce the number of unimportant notifications so it won’t distract you from writing your code.
  • The plugin supports several code snippets such as VPC, s3-bucket, output, elastic-load-balancer, etc.

5 VScode plugins every DevOps engineer should know

Besides syntax highlighting and validation, it’s very useful to lint your Cloudformation templates. Kddejong offers a Cloudformation Linter and this plugin has been download 95.000+ times with a 5-star ranking. Two features stand out here:

  • Execute linting of your Cloudformation templates as you type. No need to run it separately, so this saves another manual step. It quickly helps you find and correct common problems that can lead to bigger issues later in the deployment process.
  • A very useful feature is the integration of Pydot. This little tool shows the resources in a graph when using the preview mode of the template. It quickly helps to find relationships and dependencies.

There are plenty plugins to support you writing proper Terraform templates. Key features of a range of Terraform based plugins include the following:

  • Syntax highlighting to help you avoid typing errors.
  • Code completion: enter the first characters of your snippet and the plugin completes it for you.
  • Help with syntax shortcuts for common patterns such as for_each and variable.

Some plugins also support Terragrunt to help you keep your templates clean, highlight duplicate code and format it nicely. Write your code once and use it for as many environments as you like. A big help.

Support for CI/CD pipelines

Microsoft Azure DevOps pipelines can be constructed “the old and manual way” using the GUI to click and collect the building block you require. The more modern way is to create a pipeline programmatically. This requires a so called azure-pipeline.yaml file inside your repository. There are at least two plugins to help you create and maintain this file: the official Microsoft plugin called Azure Pipelines and the Azure Pipelines YAML Validator plugin from Tom Austin. There is a lot of overlap of these plugins. Key features of those plugins are:

  • Context specific syntax highlighting of your pipeline files since it’s aware of the Pipelines Yaml scheme. The control-space keyboard shortcut shows you the options to choose from for the supported snippets of code.
  • Validation of your Yaml file. By default, it looks at the root of your project directory. It’s also possible to select a pattern to match every Yaml pipeline file in other (sub)directories.
  • Document formatting of Yaml pipeline files can work together with other formatters. You need to change your settings.json file to support this.

On the other end of the spectrum you will find Gitlab CI to create very useful CI/CD pipelines. The official plugin by Gitlab itself is called Gitlab Workflow and this plugin supports a wide range of features. Focusing on the CI/CD pipeline, the following ones are of particular interest:

  • View the latest status of your pipeline in the Visual Studio Code’ status bar. There is no need to use your browser and navigate to your Gitlab instance view to see this.
  • The plugin helps to create a pipeline from scratch or use a template to give you a kick-starter.
  • Pipeline actions help to control your pipelines: view the latest pipeline in Gitlab, cancel the last pipeline or restart it.

5 VScode plugins every DevOps engineer should know

These features help to avoid context switching so developers can focus more on the actual coding.

Containers & Kubernetes

Containers are still a popular way to build, ship and run your applications. Especially since the Kubernetes ecosystem kicked in a couple of years ago.

Docker continuous to be the leading container runtime in the world and the number of Docker related plugins for Visual Studio Code is overwhelming. There are plugins to manage your images, your containers itself, your docker compose files (also in Yaml format), interact with running containers, etc.

Microsoft offers the “Docker plugin/extension” to help you with the following tasks:

  • Syntax highlighting and command-completion of your Dockerfiles and docker-compose files.
  • Help generate Dockerfiles and .dockerignore files directly into your editor.
  • Docker view helps to assess Docker assets: images, volumes, networks, registries and the actual running containers themselves.
  • Support to write common Docker commands to help you avoid using wrong ones.

Another powerful Docker plugin is called “Remote – containers” to use Docker containers as a local development environment. This helps in the following ways:

  • Use and share isolated development environments for you and your team members. They can start up and running in a quick way.
  • Swap different environments without having to worry about your local environment being configured differently compared to the reference environment. It also helps to let you try out new technologies.

Kubernetes

As with Docker, the number of Kubernetes plugins is very large. Kubernetes templates is one of the plugins to help you create error-free Kuberntes resources. It’s a simple plugin dedicated to help you select and write the correct resources.

Red Hat offers a very popular plugin called “YAML”. This plugin also supports Kubernetes in a number of ways:

  • Detect errors such as nodes not found, invalid node types. It does so by validating your entire Yaml file.
  • Help to outline your entire document.
  • Auto-completion of your Kubernetes based syntax.

Microsoft offers a heavily used plugin called “Bridge to Kubernetes”. It states the following:

Bridge to Kubernetes extends the Kubernetes perimeter to your development computer allowing you to write, test, and debug microservice code while connected to your Kubernetes cluster with the rest of your application or services.

This plugin helps to run your code directly using your development workstation without the need for Dockerfiles or Kubernetes manifests. It directly connects to your local Kubernetes cluster to run your micro-service. Quick and painless.

Cloud (native) support

Every IDE must support Cloud based development.

Cloud Code for Visual Studio Code deeply integrates with the Google cloud native services that developers use. For example Google Kubernetes Engine, Cloud Run and Secret Manager. It also integrates with Cloud SDK to utilize whatever is available there to help you develop your cloud native applications.

  •  Cloud Run helps developers to quickly setup a new service that also includes the development workflow, the development progress and Log viewer. It also supports a local Cloud Run emulator to run and verify your application locally.
  • Since the number of Cloud APIs grows every day, it’s very helpful to explore and enable cloud services from Visual Studio Code itself. You can also install client libraries which you need from within the IDE. No need to separately download them from the internet.
  • Secret sprawl is still a very big problem for a lot of companies. This plugin has a built-in secret manager to handle all of your secrets in a decent way. Create, view, update and use secrets so you avoid putting secrets in your source code base.

Another simple, yet powerful extension is called Google Cloud Platform SSH to login to remote instances in the cloud. You don’t need to keep your ssh keys for every instance, they are added to the project level so you use them for all of the instances.

Serverless

Suppose you want to avoid having to maintain infrastructure in the cloud, you can focus on application development related activities. Use plugins to support your serverless based applications.

AWS lambda is one of the most popular cloud native services to run applications directly in the cloud. Thundra launched a plugin called “Debugger for AWS Lambda”. It supports the following topics:

  • Debug your Python and NodeJS based Lambda code.
  • Invoke your Lambda code locally and iterate through your breakpoints in Visual Studio Code itself to help you pinpoint problems in your source code.

This plugin avoids having to setup mock services and browse log files to search and find the problem area. This is especially useful since serverless architecture consists of a lot of connected/chained services such as WAF, API Gateway, Lambda itself (perhaps in a Source Code Bucket) and other backend systems such as databases or message queues.

SAM

AWS also offers SAM, the Serverless Application Model. This is a serverless framework to help developers speed up the development of their serverless applications. It comes with a bunch of templates that carry out the hard work based on a minimum set of code you need to write. The AWS Toolkit plugin helps in a number of ways:

  • CodeLense is a feature to help you to build, run and debug your functions from your local machine without having the need to interact with AWS itself.
  • When debugging an application, the logging information shows up in Visual Studio Code directly. AWS Cloudwatch logs can also be fetched from AWS itself and presented in your IDE.
  • It’s also possible to focus entirely on the Lambda function itself, without having the other resources in scope. This speeds up finding a problem of which you know it resides in your function.
  • IntelliSense helps to construct and complete launch configuration to quickly develop the entry-point for your serverless function.

Wrap up / conclusion

Powerful IDEs help developers a lot to build (cloud native) applications, pipelines and IaC templates. Visual Studio is a popular IDE nowadays which runs on nearly every platform. Numerous plugins help developers to speed up their development related activities ranging from source code completion and validation to debugging and running their applications locally, even serverless. I hope this article helped you a lot and be sure to check-out the plugins presented here.

If you have questions related to this topic, feel free to book a meeting with one of our solutions experts, mail to sales@amazic.com.

NEWSLETTER

Sign up to receive our top stories directly in your inbox

LET'S CONNECT

spot_img