Skip to main content

VS Code for DevOps & AI Development

VS Code is the most popular editor for DevOps and AI development. This guide covers the optimal setup for infrastructure and AI workflows.

Essential Extensions

DevOps & Infrastructure

ExtensionPurpose
HashiCorp TerraformTerraform syntax, validation, auto-complete
KubernetesCluster explorer, manifest editing
YAMLYAML validation (Helm charts, K8s manifests)
DockerDockerfile support, container management
Remote - SSHEdit files on remote servers
GitLensAdvanced Git blame, history, comparison

AI Development

ExtensionPurpose
GitHub CopilotAI code completion and chat
JupyterNotebook support for ML experiments
PythonPython language support
PylanceFast Python IntelliSense
REST ClientTest API endpoints inline

Install All at Once

# DevOps extensions
code --install-extension hashicorp.terraform
code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools
code --install-extension redhat.vscode-yaml
code --install-extension ms-azuretools.vscode-docker
code --install-extension ms-vscode-remote.remote-ssh
code --install-extension eamodio.gitlens

# AI development extensions
code --install-extension github.copilot
code --install-extension ms-toolsai.jupyter
code --install-extension ms-python.python
code --install-extension ms-python.vscode-pylance
code --install-extension humao.rest-client

Remote Development Setup

SSH Config for Jump Hosts

# ~/.ssh/config
Host bastion
HostName bastion.example.com
User admin
IdentityFile ~/.ssh/id_ed25519

Host k8s-node-*
ProxyJump bastion
User ubuntu
IdentityFile ~/.ssh/id_ed25519

Host gpu-server
HostName 10.0.1.50
ProxyJump bastion
User ubuntu
ForwardAgent yes

Dev Containers for Reproducible Environments

// .devcontainer/devcontainer.json
{
"name": "DevOps Workspace",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/terraform:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/python:1": { "version": "3.12" },
"ghcr.io/devcontainers/features/aws-cli:1": {}
},
"customizations": {
"vscode": {
"extensions": [
"hashicorp.terraform",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"redhat.vscode-yaml",
"github.copilot"
]
}
}
}

Workspace Settings for DevOps

// .vscode/settings.json
{
// Terraform
"terraform.languageServer.enable": true,
"terraform.validation.enableEnhancedValidation": true,

// YAML — Kubernetes schema validation
"yaml.schemas": {
"kubernetes": ["k8s/**/*.yaml", "manifests/**/*.yaml"],
"https://json.schemastore.org/github-workflow.json": ".github/workflows/*.yml"
},

// Python
"python.analysis.typeCheckingMode": "basic",
"python.formatting.provider": "black",

// Editor
"editor.formatOnSave": true,
"editor.rulers": [80, 120],
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,

// Git
"git.autofetch": true,
"git.confirmSync": false
}

Keyboard Shortcuts for Productivity

ShortcutAction
Ctrl+Shift+PCommand palette
Ctrl+`` Toggle terminal
Ctrl+Shift+`` New terminal
Ctrl+PQuick file open
Ctrl+Shift+FSearch across files
Ctrl+K Ctrl+SKeyboard shortcuts
F2Rename symbol
Alt+Shift+FFormat document
Ctrl+Shift+GGit panel

Tasks for Common DevOps Operations

// .vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Terraform Plan",
"type": "shell",
"command": "terraform plan -out=tfplan",
"group": "build",
"problemMatcher": []
},
{
"label": "Terraform Apply",
"type": "shell",
"command": "terraform apply tfplan",
"group": "build",
"problemMatcher": []
},
{
"label": "K8s Port Forward",
"type": "shell",
"command": "kubectl port-forward svc/${input:service} ${input:port}:${input:port}",
"isBackground": true,
"problemMatcher": []
}
],
"inputs": [
{ "id": "service", "type": "promptString", "description": "Service name" },
{ "id": "port", "type": "promptString", "description": "Port number", "default": "8080" }
]
}

Next Steps