Questions That May Help You Land A Cloud or DevOps Job

Emmanuel
13 min readMay 10, 2024

--

INTRODUCTION

As businesses increasingly move towards cloud-based solutions, the role of Cloud and DevOps professionals becomes more crucial in ensuring efficient, scalable, and reliable IT infrastructure.

Mastery over various system-level and network tasks is essential for such roles. This includes a deep understanding of commands and tools that manage processes, monitor system health, and handle network communications effectively.

The questions below only give you an idea of what to expect when you interview for Cloud and DevOps roles.

I encourage you to expand on them to prepare fully for your next interview. They MAY or MAY NOT come up during your interview, but at least they will give you some solid foundation of what to expect.

Part One: Questions Related to AWS Concepts

What types of projects have you worked with using AWS? What AWS services did you use?

  • I’ve worked on e-commerce platforms using services like EC2, S3, DynamoDB, CloudFront, VPC, Lambda, and API Gateway for scalable, secure back-end operations.
  • Additional projects include mobile backends using AWS Amplify and data warehousing using Amazon Redshift, which are designed for analytics at scale.

What are the types of EC2?

  • EC2 types include General-Purpose, Compute-Optimized, Memory-Optimized, Storage-Optimized, Accelerated Computing, High-Memory Instances, and instances optimized for machine learning (Inferentia).
  • Each type caters to specific workload needs, like web servers for General Purposes or graphic-intensive applications for Accelerated Computing.

What are the various placement types in EC2?

  • Placement options are Cluster, Spread, and Partition, each serving a purpose such as achieving high availability, low latency, or regulatory compliance.
  • Cluster placement groups are ideal for applications needing low network latency, whereas partition groups provide multiple partitions within an AZ.

How can I access an EC2 instance from another AWS account?

  • Use cross-account roles and update the security group to allow access, ensuring both accounts are authenticated.
  • Establish IAM policies that grant necessary permissions to operate across accounts securely.

How can you SSH into an instance placed in a private subnet through an example in a public subnet?

  • SSH into a bastion host in the public subnet first, ensuring it has the necessary permissions and settings, then SSH into the private subnet instance.
  • Ensure the network ACLs and route tables allow appropriate routing between the bastion and private instances.

What are the steps to launch a load balancer?

  • Choose the type (ALB, NLB, CLB), configure listeners and target groups, set security settings, define health checks, enable deletion protection, and launch.
  • Further configuration may include setting up SSL/TLS certificates for HTTPS traffic and integrating AWS WAF for additional security.

What are S3 lifecycle rules?

  • Using the AWS Management Console or S3 API, automate object management by transitioning to cheaper storage classes or deleting after a certain period.
  • Use policies to automatically archive files to Glacier for long-term preservation or purge data that no longer meets corporate or regulatory requirements.

How do you secure CloudFront access to S3 content?

  • Use Origin Access Identity (OAI) and signed URLs or cookies to restrict access, ensuring only authenticated users can access content.
  • Employ AWS Shield and AWS WAF for comprehensive protection against DDoS attacks and malicious requests.

What are different cost-saving strategies in AWS?

  • Use Reserved Instances, Auto Scaling, Right-Sizing, turning off unused resources, Spot Instances, and AWS Cost Management tools.
  • Budget alerts and spending caps can prevent unexpected charges and help maintain financial control over your AWS resources.

What is an EC2 cost savings plan?

  • Purchase a Savings Plan for up to 72% savings compared to on-demand pricing, applying to any AWS region.
  • These flexible plans cover usage for EC2, Lambda, and some types of AWS Fargate, providing a broad range of options for cost optimization.

Part Two: Questions Related to DevOps Concepts

Why would I use Git?

  • Version control: Tracks and manages changes to code.
  • Collaboration: Enables multiple people to work on the same project.
  • Backup and Restore: Allows reverting files to a previous state.

What is the difference between Git rebase and Git merge?

  • Rebase: Integrates changes by moving the entire branch to the tip of another branch, creating a linear history.
  • Merge: Combines two branches while preserving the history of both branches.

What is the difference between Git pull and Git fetch?

  • Fetch: Downloads commits, files, and refs from a remote repository into your local repo without merging them.
  • Pull: Fetches changes from the remote server and integrates them into the current branch.

What is Git stash?

  • It temporarily shelves (or stashes) changes you’ve made to your working directory so you can work on something else and then return and re-apply them later.

What if I want to keep my changes and commit them later? How will I do it?

  • Use git stash to store your changes temporarily and
  • git stash pop to reapply them when ready to commit.

Write a Docker file.

FROM python:3.8-slim
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
CMD ["python", "app.py"]

Write your CI/CD pipeline file—it can be a GitLab, yaml, or Groovy file, depending on your expertise.

stages:
- build
- test
- deploy


build_job:
stage: build
script:
- echo "Building the application..."
- build_command


test_job:
stage: test
script:
- echo "Running tests..."
- test_command


deploy_job:
stage: deploy
script:
- echo "Deploying application..."
- deploy_command

Write down the deployment stage of your project.

deploy_job:
stage: deploy
script:
- deploy_command

Explain K8s architecture.

  • It comprises a master node (controls and manages the cluster) and worker nodes (runs the applications).
  • Includes components like etcd (storage), kube-apiserver (frontend), kube-scheduler (schedules pods), kube-controller-manager (manages lifecycle), and kubelet (runs on nodes, manages containers).

What is the difference between stateful sets and daemonsets?

  • StatefulSets manages deploying and scaling a set of Pods and guarantees their ordering and uniqueness.
  • DaemonSets: Ensures that all (or some) Nodes run a copy of a Pod.

How will I achieve isolation of a pod? What are the different ways?

  • Use namespaces to separate pods logically.
  • Implement network policies to restrict communications.

Explain Kubernetes commands.

  • kubectl get pods: Lists all pods in the namespace.
  • kubectl create -f filename.yaml: Creates a resource specified in a YAML file.
  • kubectl apply -f filename.yaml: Applies changes to a resource from a YAML file.

If a pod in my replica sets fails, what will happen? How will I check it?

  • Kubernetes will automatically replace the failed pod with a new one to maintain the desired state.
  • Check using kubectl to get pods and see their status.

How will you handle autoscaling in Kubernetes?

  • Use Horizontal Pod Autoscaler (HPA) to automatically scale the number of pods in a deployment based on observed CPU utilization or other application-provided metrics.

What is pod affinity?

  • A set of rules allows you to specify how pods should be co-located in the same node or spread across nodes based on specific criteria.

What are GitLab runners? How many types do you know? Which one are you using?

  • GitLab Runners are agents that run your jobs and send the results back to GitLab.
  • Types include Shared, Specific, and Group Runners.
  • The type used depends on your project's setup and requirements.

Explain how you deploy your application in a pod.

  • Write a deployment YAML file specifying the Docker image and other configurations.
  • Use kubectl apply -f deployment.yaml to create the deployment in Kubernetes.

How do you package the K8s application?

  • Typically, it is packaged using Helm charts, which provide templating syntax for Kubernetes YAML manifests, making it easier to package and deploy Kubernetes applications.

How do you initiate a rollback on your application?

  • Use kubectl rollout undo to roll back to a previous deployment state.

How do you test a manifest without executing it?

  • Use kubectl apply — dry-run=client -f filename.yaml to simulate the deployment without actually performing it.

If a Kubernetes job should finish in 40 seconds, but on a rare occasion, it takes 10 minutes, how can I stop the application if it exceeds 45 seconds?

  • Set an activeDeadlineSeconds value in the job’s YAML to limit execution time.

Explain the types of Autoscalers in Kubernetes.

  • Horizontal Pod Autoscaler (HPA): Scales the number of pods in a deployment based on observed CPU utilization.
  • Vertical Pod Autoscaler (VPA): Adjusts pods' CPU and memory reservations in a deployment.
  • Cluster Autoscaler: Scales the number of nodes in the cluster.

Explain Kubernetes to a non-technical person/child/old man.

  • Kubernetes is like a train conductor who ensures that each train car (pod) is in the right place at the right time and that if one car breaks, it’s quickly replaced with a new one.

You’re working on a feature branch and then realize your changes are incorrect and need removal. How can you remove those commits from the Git history?

  • Use git reset — hard HEAD~n to revert to a specific commit, removing all subsequent commits.

Write a service/pod/deployment yaml file for Kubernetes.

apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deployment
spec:
replicas: 3
selector:
matchLabels:
app: example
template:
metadata:
labels:
app: example
spec:
containers:
- name: example-container
image: example/image
ports:
- containerPort: 80

Explain the difference between expose and port-forward in Kubernetes.

  • Expose: Makes a service accessible from outside the cluster.
  • Port-forward: Creates a temporary direct connection from a local port to a port on a pod.

Explain port binding.

  • Linking a port on a host to a port on a container so that traffic to the host port reaches the container port.

How can you solve this problem, as microservices deployment can create more problems for DevOps people than the deployment of a monolithic app?

  • Implement robust monitoring and automated deployments and ensure proper service orchestration to handle the complexities of microservices.

What is the difference between Docker Swarm and Kubernetes?

  • Docker Swarm is simpler and integrated into Docker, which is ideal for smaller workloads. Kubernetes is more complex but provides more features and is suitable for larger, more dynamic environments.

Is Kubernetes the only container management tool that I can use? If Not, why not? What is the difference between Kubernetes and those tools?

  • No, other tools like Docker Swarm, Mesos, and OpenShift exist. They vary in complexity, scalability, and features.
  • Kubernetes is generally more feature-rich and widely adopted for larger-scale operations.

Part Three: Questions Related to Terraform Concepts

Writing a Terraform Module:

  • Define a reusable collection of Terraform resources in a local directory.
  • Include variables.tf for input variables and outputs.tf for output values.
  • Use the source parameter in your main configurations to call the module.

Terraform File for AWS Infrastructure:

  • Define resources for a VPC, one public subnet, two private subnets, and a route table.
  • Include an Internet Gateway for the public subnet and a NAT Gateway for private subnets.

Behavior of Terraform After Console Changes:

  • Terraform does not automatically recognize changes made outside its configuration.
  • On the next terraform apply, it attempts to revert the resources to the state defined in the .tf files unless terraform refresh or import is used to update the state file.

Managing Team Work on Terraform:

  • Use a version control system for the Terraform scripts.
  • Implement Terraform workspaces or use remote state files in shared storage like S3 to manage the state concurrently.

Avoiding Changes to the State File:

  • Use terraform plan to preview changes without affecting the state.
  • Set the state file to read-only mode or use backend configurations with locking to prevent accidental changes.

Terraform Script for EKS Cluster:

  • Define an EKS cluster using the aws_eks_cluster resource.
  • Include node groups using aws_eks_node_group.

Modules for Deploying EKS:

  • EKS cluster module, VPC module, and possibly a security group module.
  • Use community modules like terraform-aws-modules/eks/aws for more comprehensive configurations.

Passing Sensitive Information Securely:

  • Use the aws_secretsmanager_secret resource to create and manage secrets.
  • Reference secrets in your Terraform scripts without exposing them as plain text.

Storing Sensitive Information in Terraform:

  • Store sensitive values using Terraform’s sensitive variable attribute to prevent it from being displayed in the plan or output.
  • Use external secret management tools like AWS Secrets Manager or HashiCorp Vault.

Behavior When Resource Deleted from Console:

  • If it still exists in the Terraform configuration, Terraform will try to recreate the deleted resource in the next application.
  • Use Terraform Refresh to update the state file before applying it to reflect only new changes.

Excluding Specific Updates in Terraform Apply:

  • Use the -target option with terraform apply to apply changes to selected resources only specifically.

Incorporating Console Changes into Terraform:

  • Use terraform import to bring existing infrastructure into Terraform management according to the current configuration.

Step-by-Step Deployment with Terraform:

  • Run terraform init to initialize the directory.
  • Run terraform plan to preview changes.
  • Execute terraform apply to apply the changes.

Common Terraform Commands:

terraform init
terraform plan
terraform apply
terraform destroy
terraform import
terraform taint
terraform untaint

Terraform Init Command:

  • Initializes a Terraform working directory, installs modules, and prepares the backend.

Terraform Taint Command:

  • Marks a Terraform-managed resource to be destroyed and recreated on the next apply.

Defining Multiple Regions in Terraform:

  • Use provider aliases to manage resources in multiple AWS regions within the same Terraform configuration.

Launching Instances with Multiple AMIs:

  • Use count or for_each to create multiple instances from different AMIs, specifying each AMI ID.

Concurrent Terraform Plan Operations:

  • Concurrent terraform plan operations will run independently without issues, but concurrent applies need state locking.

Authentication in Terraform for AWS:

  • Use environment variables to set up the AWS provider with the necessary credentials or configure them directly in the provider block. Use IAM roles and policies for fine-grained access control.

Part Four: Questions Related to Python Concepts

Monkey Patching:

  • Technique to modify or extend the behavior of libraries or classes during runtime without changing the source code.

Decorators:

  • Python functions that modify another function's behavior without permanently changing it are often used for logging, access control, or performance measurements.

Generators:

  • Functions that yield a sequence of results lazily, allowing iteration over potentially infinite sequences without storing the entire sequence in memory.

Python Script for EC2 to S3 Backup:

import boto3

def backup_file_to_s3(ec2_file_path, bucket_name, s3_file_name):
s3 = boto3.resource('s3')
try:
s3.meta.client.head_bucket(Bucket=bucket_name)
except:
s3.create_bucket(Bucket=bucket_name)
s3.Bucket(bucket_name).upload_file(ec2_file_path, s3_file_name)

# Usage: backup_file_to_s3('path/to/file', 'bucket-name', 'backup-file-name')

Python Program to Reverse Words:

def reverse_words_and_strip_spaces(input_string):
return ' '.join(input_string.strip().split()[::-1])

# Example usage
print(reverse_words_and_strip_spaces(" Python is my favourite language "))

Timer Decorator:

import time

def timer(func):
def wrapper(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
end = time.time()
print(f"Time taken: {end - start}s")
return result
return wrapper

Anagram Problems:

  • Anagrams are words or phrases that contain the same letters in a different order.

Intersection of Two Lists:

def intersect_lists(a, b):
from collections import Counter
counts = Counter(a)
intersection = [x for x in b if counts[x] > 0 and (counts[x] := counts[x] - 1) is None]
return intersection

Reverse Alphabets Only:

def reverse_alphabets(input_string):
import re
chars = re.findall(r'[a-zA-Z]', input_string)
return re.sub(r'[a-zA-Z]', lambda m: chars.pop(), input_string)

Longest Unique Substring:

  • Find the maximum length of a substring with all unique characters.

Find Missing Number:

  • Compute the missing number in a sequence using mathematical formulas or comparing it to an entire sequence.

Count of 9’s from 1 to 100:

  • There are 20 occurrences of the digit ‘9’ between 1 and 100.

Python Code for Planting Flowers:

def plant_flowers(bed):
plantable = 0
for i in range(len(bed)):
if bed[i] == 0 and (i == 0 or bed[i-1] == 0) and (i == len(bed)-1 or bed[i+1] == 0):
bed[i] = 1
plantable += 1
return plantable

Difference between Go and Python:

  • Go is statically typed, compiled, and designed for system-level and concurrent programming.
  • Python is dynamically typed, interpreted, and favored for rapid development and ease of use.

Python Script for EC2 Instances Management:

  • Manage AWS EC2 instances; start stopped ones and stop running ones.

Convert JSON to Python:

  • Use Python’s JSON module to load JSON data into a Python dictionary.

Explain Given Code:

  • Provide explanations for specific Python code snippets.

Happy Number Problem:

  • Identify if a number is happy, which means replacing the number by the sum of the squares of its digits repeatedly leads to 1.

Script to Move Objects Between S3 Buckets:

  • Write a script that moves objects from one AWS S3 bucket to another.

Boto3 Command without Waiter:

  • Implement custom wait logic using sleep intervals and checks until a desired state is achieved.

Part Five: Questions Related to Linux and Networking

Top Command:

  • Displays real-time system summary and a list of processes running on the system.
  • Shows CPU usage, memory usage, swap memory, cache size, and process details like PID, user, priority, and more.

Finding a Keyword in File:

  • Use the grep command in Unix/Linux, e.g., grep “keyword” filename to search for “keyword” in “filename”.

Changing Ownership:

  • Use the chown command, e.g., chown user:group filename, to change the ownership of “filename” to “user” and group to “group”.

Changing User:

  • Use the su command to switch user in a terminal, e.g., su — username switches to “username”.

Zombie Process:

  • A process that has completed execution but still has an entry in the process table to report to its parent process.

Difference Between TCP/UDP:

  • TCP is connection-oriented and reliable, ensuring data delivery by checking errors.
  • UDP is connection-less, faster, and used where speed is preferred over reliability.

Investigating Traffic on TCP/UDP:

  • Use tools like tcpdump or wireshark to capture and analyze network packets over TCP/UDP.

Default Protocol for HTTP:

  • HTTP uses TCP as its default transport protocol.

Checking if an IP is Reachable:

  • Use the ping command, e.g., ping ip_address, to check network connectivity to an IP address.

Difference Between Process and Thread:

  • A process is an independent execution unit with its own memory space.
  • A thread is a lightweight process with the same memory space as its parent process.

DNS (Domain Name System):

  • Translates domain names like www.mydomain.com into IP addresses.
  • Hierarchical, distributed database system with different levels of DNS servers (Root, TLD, and authoritative).

Difference Between HTTP GET and POST Method:

  • GET requests data from a server and should not affect data on the server.
  • POST sends data to a server and can create or update data.

Handling Task Spillover:

  • Prioritize tasks based on importance and deadlines.
  • Delegate tasks to others if possible or split larger tasks into manageable parts.

Daemon Process:

  • A background service process in Unix/Linux operating systems, typically initiated at boot.

Load Average in Top Command:

  • Indicates the average system load over 1, 5, and 15 minutes.
  • Helps assess CPU demand and system response time.

In Conclusion

I hope the interview questions above helped you prepare for your next role as a Cloud and DevOps professional. Again, they will not guarantee that you will surely get the job. However, look at them as a guide to build your cheatsheet that will prepare you for your next interview. lastly, use every interview you do as a learning opportunity, whether successful or not. All the best, and God bless you on your next adventure!

--

--

Emmanuel
Emmanuel

Written by Emmanuel

Certified Cloud Solutions Architect passionate about Cloud & DevOps, Technology Evangelism, Pastoral Ministry, Educator and Mentor, and World Travel.

No responses yet