APURV
  • Home
  • Journey
  • Projects
  • Blogs
  • Interview
  • Exams
Resume
APURV

Building scalable, secure, and production-ready cloud infrastructure. Automation first.

NAVIGATION

HomeExperienceProjectsCertificationsSkills

TECH STACK

AWSGCPK8sCI/CDLinuxDocker

CONNECT

LinkedInGitHubEmailResume

© 2026 Apurv Gujjar. All rights reserved.
Apurv Gujjar
Apurv GujjarDevOps & Cloud Engineer
|Interview Documentation
Portfolio
Handbooks
🎯Linux🐙Git & GitHub🤖GitHub Actions🌐Networking☁AWS🛠Terraform🐳Docker☸Kubernetes📊Monitoring🛡DevSecOps💰Cost Optimization🚨Incident Scenarios👤HR & Behavioral☁GCP🐍Python
Interview DocumentationPython

Python

DevOps Automation & Boto3 SDK Scripting Guide

Q1

What is the difference between a List and a Tuple?

💬Answer
  • List ([]): Mutable (can be modified after creation).
  • Tuple (()): Immutable (cannot be changed once created).
  • DevOps Use Case: Use a list for dynamic data (e.g., list of IPs retrieved from AWS API that you need to filter). Use a tuple for fixed data (e.g., a hardcoded set of allowed HTTP response codes (200, 201, 204)).
my_list = [1, 2, 3]
my_tuple = (1, 2, 3)

my_list[0] = 10  # Works
# my_tuple[0] = 10 # Raises TypeError
Q2

What is the difference between the `==` and `is` operators?

Q3

What are the primary Python data types?

Q4

What is a dictionary and why is it heavily used in DevOps?

Q5

How do you print all EC2 instance names stored in a list?

Q6

What is the difference between a `for` loop and a `while` loop?

Q7

Why do we use functions?

Q8

What is the difference between a parameter and an argument?

Q9

How do you read a log file safely in Python?

Q10

Why do we use the `os` module?

Q11

What is the difference between `os.path.exists()` and `os.path.isfile()`?

Q12

What does `os.listdir()` return?

Q13

What is the difference between `os.remove()` and `os.rmdir()`?

Q14

How do you create nested directories (like `mkdir -p`) in Python?

Q15

How do you read environment variables using `os.environ` and `os.getenv()`? What is the difference?

Q16

What is the difference between `shutil.copy()` and `shutil.copy2()`?

Q17

What does `shutil.move()` do?

Q18

How do you copy an entire directory recursively in Python?

Q19

How do you delete a directory recursively in Python?

Q20

How do you check disk usage using `shutil.disk_usage()`?

Q21

What is the difference between `datetime.now()` and `datetime.utcnow()`?

Q22

How do you calculate the difference between two dates in Python?

Q23

What is the difference between `subprocess.run()` and `subprocess.Popen()`?

Q24

Why is `shell=True` sometimes considered dangerous in scripts?

Q25

How do you capture standard output and check return codes using `subprocess.run()`?

Q26

What is `sys.argv`? How do you pass and parse command-line arguments in scripts?

Q27

What is `sys.exit()` and why is it used in production scripts?

Q28

How does Boto3 authenticate to AWS?

Q29

What is the difference between a Client and a Resource in Boto3?

Q30

How do you list EC2 instances, filter them by tags, and start/stop them using Boto3?

Q31

How do you handle pagination when listing hundreds of objects in Boto3 S3 APIs?

Q32

How do you assume an IAM role programmatically inside a Boto3 script?

Q33

Scenario 1: Write a script that checks disk usage. If usage is > 90%, compress old logs and upload them to AWS S3.

Q34

Scenario 2: Write a script that lists all EC2 instances, identifies any in a 'stopped' state, and starts them automatically.

Q35

Scenario 3: Write a script that executes a Terraform workspace deployment, captures the stdout logs, and logs success/failure status.

Q36

Scenario 4: Write a script that parses an application log file, extracts all "ERROR" entries, and generates a formatted markdown report.

Q37

Scenario 5: Write a script that takes the target environment as an input argument (`sys.argv`) and runs environment-specific deployment commands.

Q38

Scenario 6: Write a script that creates timestamped daily backups, uploads them to AWS S3, and automatically purges old backups from the bucket that are older than 30 days.

Apurv Gujjar - DevOps & Cloud Engineer
Created by

Apurv Gujjar

DevOps & Cloud Engineer

Specialized in:DevOpsAWSGCPKubernetesTerraformDocker
View Portfolio