Interview Prep/DevOps Fundamentals/Security basics for DevOps

What is the principle of least privilege?

BeginnerConceptSecurity basics for DevOps
Answer

In one line: Least privilege means every person, service and pipeline gets only the minimum permissions it needs to do its job — and only for as long as it needs them.

Why it matters:

  • If an account, key or server is compromised, the attacker can only do what that identity was allowed to do. Small permissions = small damage (a small "blast radius").
  • It also prevents accidents: a developer can't delete the production database if they don't have permission to.

Examples in DevOps:

  1. IAM roles — a CI pipeline that only deploys to one ECS service gets permission for that service and its ECR repository, not AdministratorAccess.
  2. Kubernetes RBAC — the payments team can manage the payments namespace only; Argo CD gets only the permissions it needs.
  3. Service accounts — each microservice has its own identity (IRSA on EKS, Workload Identity on AKS/GKE) with access only to the AWS/Azure resources it uses.
  4. Databases — the app user can read/write its tables but can't drop the database or create users.
  5. Humans — read-only access to production by default; elevated access only when needed (just-in-time access with approval and expiry).
  6. Short-lived credentials — OIDC tokens and temporary roles instead of long-lived access keys.

Bad vs good IAM:

// Bad
{ "Effect": "Allow", "Action": "*", "Resource": "*" }

// Better
{ "Effect": "Allow",
  "Action": ["s3:GetObject", "s3:PutObject"],
  "Resource": "arn:aws:s3:::invoices-prod/*" }

How to apply it in practice:

  • Start with no permissions and add what's needed.
  • Use tools like IAM Access Analyzer to find unused permissions.
  • Review access regularly and remove what's no longer needed (for example when people change teams).
  • Separate accounts/subscriptions for dev, staging and prod.

Tip for interviews: give one concrete example of tightening a permission — such as replacing a pipeline's admin role with a scoped deploy role.

All DevOps Fundamentals questions

More on Security basics for DevOps