INTERVIEW PREP
Interview questions
570 questions from real DevOps, SRE, platform engineering and MLOps interviews, with the answer an interviewer wants to hear. Try answering out loud first, then open the model answer.
Showing 271–285 of 490 questions
271.The state file is lost or corrupted. How do you recover?SeniorTerraform
Stop all applies for that stack first. Restore the last good version from backend versioning and run plan, which should show few or no changes. With no backup, rebuild state by writing import blocks for each resource (plan -generate-config-out helps) until the plan is clean.
272.Terraform or Ansible: what is the difference?SeniorTerraform
Terraform provisions infrastructure declaratively and tracks it in state: networks, clusters, databases, IAM. Ansible configures what runs inside machines: packages, files and services. They work together, for example Terraform builds the instance and Ansible or cloud-init sets it up.
273.Your single state has grown huge and slow. What do you do?SeniorTerraform
Split it into smaller stacks by how often things change and who owns them, such as network, data and apps. Move resources with moved blocks or state commands, share values through outputs and terraform_remote_state or a parameter store, and use Terragrunt or pipelines to run stacks in order.
274.Why use OpenTofu or HCP Terraform?SeniorTerraform
OpenTofu is an open-source fork with a community license and extras such as state encryption, and it uses the same HCL for most code. HCP Terraform is a managed service that runs plans and applies, stores and locks state, keeps history and runs policy. The choice depends on license, cost and how much you want to run yourself.
275.What are the signs that a Terraform state is too big?SeniorTerraform
Plans take many minutes, people wait for state locks, one mistake can touch unrelated systems, and teams need different access to different parts. These are the signs to split it into smaller stacks.
276.Someone applied from their laptop and broke prod. How do you stop it happening again?SeniorTerraform
Make CI the only path: the production write role can only be assumed by the pipeline through OIDC, the state bucket is locked down, and every change needs a reviewed merge request with a plan. Add drift detection so manual changes are spotted quickly.
277.What is the difference between a Region and an Availability Zone?BeginnerAWS
A Region is a geographic area, such as eu-west-1. It has several Availability Zones, which are separate data centers a short distance apart with their own power and network. Spreading across zones keeps your app up if one zone fails.
278.What is the shared responsibility model?BeginnerAWS
AWS secures the cloud itself: buildings, hardware and the base services. You secure what you put in it: your data, access rules, operating system settings and network rules.
279.Why should you not use the root user for daily work?BeginnerAWS
It can do everything and cannot be limited. Protect it with MFA, lock away its keys, and use an IAM Identity Center or IAM user with limited rights every day.
280.What is an IAM role and when do you use it?BeginnerAWS
A role is a set of permissions that something can take on for a short time, without a password or long-term key. Use roles for EC2, Lambda and containers, and for people through SSO.
281.How do S3 storage classes differ?BeginnerAWS
Standard is for frequent access. Infrequent Access is cheaper to store but charges to read. Glacier classes are very cheap for archives but take minutes to hours to get data back. Intelligent-Tiering moves objects for you.
282.What is the difference between a security group and a NACL?MidAWS
A security group belongs to an instance, is stateful and only has allow rules. A NACL belongs to a subnet, is stateless, and has numbered allow and deny rules. Most control is done with security groups.
283.How does a private subnet reach the internet?MidAWS
Through a NAT gateway in a public subnet. The private route table sends 0.0.0.0/0 to the NAT gateway, which sends it on through the internet gateway. Nothing from outside can start a connection in.
284.What is the difference between RDS Multi-AZ and read replicas?MidAWS
Multi-AZ keeps a standby copy in another zone for failover and is about availability. Read replicas are extra copies that serve reads and are about performance. They can be used together.
285.How does a DynamoDB table choose its keys?MidAWS
The partition key spreads data and finds items quickly. An optional sort key orders items inside one partition key. Design keys for your queries, because you cannot query well by other attributes without an index.