Real-time usage and learning

chevron-rightAs a DevOps what to learnhashtag

Yeah, I totally get that! As a DevOps Engineer, your focus is on infrastructure, automation, and reliability, while developers often take interviews with a coding-heavy mindset. That can be frustrating, especially when they expect developer-level Python skills instead of practical scripting knowledge.

🚀 How to Handle Dev-Centric Interviews as a DevOps Engineer?

1️⃣ Focus on Problem-Solving Over Syntax

Instead of worrying about deep Python concepts, focus on writing clean, efficient scripts for real-world problems like: ✅ Parsing logs (e.g., filtering logs using Python instead of grep) ✅ Automation (e.g., auto-scaling AWS instances using boto3) ✅ Monitoring (e.g., exposing FastAPI metrics for Prometheus)

💡 Example Question: "How would you restart a failed container in Kubernetes using Python?" 📌 Your Answer: "I’d use the kubernetes Python client to watch pod statuses and trigger a restart."


2️⃣ Learn the Python You Actually Need (Not Everything)

As a DevOps Engineer, you don’t need full-stack Python. Instead, focus on:

  • Automation → Shell scripting alternatives in Python (subprocess, os, shutil)

  • Infrastructure as Code (IaC)boto3 for AWS, paramiko for SSH automation

  • Monitoring & Logging → Using Python to expose Prometheus metrics (prometheus_client)

  • CI/CD Pipelines → Automating workflows in Jenkins/GitHub Actions (requests, pyyaml)

💡 Instead of memorizing Python theory, focus on scripts that help in daily tasks.


3️⃣ Expect Algorithmic Questions but Keep It Practical

Even if you’re not a developer, some interviewers ask DSA-style questions like:

  • Find the duplicate in a list (simple set() usage)

  • Reverse a string (s[::-1])

  • Parse JSON logs (json.loads())

💡 They just want to see if you can think logically, not build complex applications.


4️⃣ Steer the Interview Towards DevOps Topics

If a developer asks too many Python-heavy questions, redirect the discussion to DevOps skills: 📌 Example: "I use Python for automation in CI/CD and cloud infrastructure. Do you want me to demonstrate an automation script I built?"

🔥 This shifts the focus from generic Python to DevOps-specific use cases.


5️⃣ Keep Handy Some Pre-Written Scripts

Many Python interview questions can be answered by slightly modifying a past script. Keep scripts for: ✅ Managing AWS instances (boto3) ✅ Deploying Kubernetes resources (kubernetes client) ✅ Automating log parsing (re, json, csv)

📌 Having a GitHub repo with these can help you answer questions confidently!


💡 Summary

Learn Python for DevOps, not general-purpose development ✔ Redirect the interview towards your strong areas (CI/CD, infra automation) ✔ Prepare practical scripts that match real-world DevOps tasks ✔ Focus on problem-solving, not deep syntax knowledge

🔥 If you want, I can help you with Python scripts that match your DevOps role & interview prep! 🚀

chevron-rightDevOps uses this libraryhashtag

Here you go, Pavan — a curated list of commonly used functions and attributes (prefixes/suffixes/methods) from Python libraries useful in DevOps/SRE workflows: requests, boto3, yaml, json, and os.


requests (HTTP Client Library)

Method
Description

requests.get()

Sends a GET request

requests.post()

Sends a POST request

requests.put()

Sends a PUT request

requests.delete()

Sends a DELETE request

requests.head()

Sends a HEAD request

requests.patch()

Sends a PATCH request

requests.request()

Low-level general-purpose request

requests.Session()

Persistent session (cookies, headers)

response.status_code

Status code of the response

response.headers

Response headers

response.text

Response as string

response.json()

JSON-decoded response

response.content

Raw bytes of response


boto3 (AWS SDK for Python)

🔹 General

Method
Description

boto3.client()

Low-level service client

boto3.resource()

High-level service resource (e.g., S3)

boto3.session.Session()

Create a custom session

🔹 Common AWS Services (Client-based usage)

🔸 S3

s3 = boto3.client('s3')
Method
Description

s3.upload_file()

Uploads file to S3 bucket

s3.download_file()

Downloads file from S3

s3.list_buckets()

Lists all buckets

s3.create_bucket()

Creates a new bucket

s3.put_object()

Puts object in bucket

s3.get_object()

Gets object from bucket

s3.delete_object()

Deletes an object

🔸 EC2

ec2 = boto3.client('ec2')
Method
Description

ec2.describe_instances()

Lists EC2 instances

ec2.start_instances()

Starts stopped instances

ec2.stop_instances()

Stops running instances

ec2.terminate_instances()

Terminates instances

🔸 IAM

iam = boto3.client('iam')
Method
Description

iam.create_user()

Creates a new IAM user

iam.attach_user_policy()

Attaches policy to user

iam.list_users()

Lists all IAM users


yaml (PyYAML - YAML Parser)

import yaml
Method
Description

yaml.safe_load()

Loads YAML into Python (safe, preferred)

yaml.load()

Loads YAML (use only with Loader arg)

yaml.dump()

Dumps Python object into YAML

yaml.safe_dump()

Dumps safely without tags or custom types

yaml.load_all()

Loads multiple YAML documents

yaml.dump_all()

Dumps multiple documents to a stream


json (Standard Library for JSON Handling)

import json
Method
Description

json.load()

Parses JSON from file-like object

json.loads()

Parses JSON string

json.dump()

Writes JSON to file-like object

json.dumps()

Converts object to JSON string

json.JSONDecodeError

Exception class for decoding issues


os (Standard Library for OS Operations)

import os
Function/Property
Description

os.getenv()

Get environment variable

os.environ

Dict of environment variables

os.path.exists()

Check if file/path exists

os.path.join()

Join file paths

os.listdir()

List files in directory

os.remove()

Delete file

os.rename()

Rename file or directory

os.mkdir() / os.makedirs()

Create directory (single/all levels)

os.rmdir() / os.removedirs()

Remove directory

os.system()

Run shell command

os.path.basename()

Get filename from path

os.path.abspath()

Get absolute path

os.chmod()

Change permission of file

os.getcwd()

Get current working directory

os.chdir()

Change current working directory

os.walk()

Recursively traverse directory structure

os.stat()

Get file metadata


💡 Pro Tip:

Use dir(module) to explore more methods interactively in Python:

import requests  
print(dir(requests))

Let me know if you'd like:

  • 📄 A printable PDF version

  • 🔧 Ready-to-use code snippets for automation

  • 📽️ Reels/short videos explaining each library's real-world use

Happy to help you convert this into tutorial content or interview flashcards, Pavan!

Last updated