Scenario-Based Cloud Security Interview Questions (2027)

45 scenario-based cloud security interview questions on AWS, Azure, GCP and Kubernetes: leaked keys, public buckets, IAM, incidents and guardrails.

Sep 18, 2025 - 12:54
Nov 9, 2026 - 02:27
 0  224
Scenario-Based Cloud Security Interview Questions (2027)

Scenario-based cloud security interview questions describe an incident or a risky design, such as a public storage bucket, a leaked access key, an over-privileged role or an exposed Kubernetes dashboard, and ask how you would contain it, investigate it and stop it from happening again. Strong answers start from the asset and the identity involved, then name specific AWS, Azure or Google Cloud controls.

This page collects 45 defensive scenarios across AWS, Azure, Google Cloud and Kubernetes, grouped by experience level. It sits in our cloud security interview series next to the advanced cloud security questions (architecture and design depth) and the CDN-focused Akamai and cloud security interview guide. Every scenario is about detection, response and hardening. Service names were checked against vendor documentation in November 2026.

Key takeaways

  • Use the same order for every incident: contain, preserve evidence, investigate, recover, then fix the root cause and add a guardrail.
  • Most cloud breaches in interview scenarios trace back to identity: long-lived keys, over-broad roles or missing MFA. Lead with IAM in your answer.
  • Know the native detection service on each cloud: Amazon GuardDuty, Microsoft Defender for Cloud and Google Security Command Center.
  • Audit logs (AWS CloudTrail, Azure Activity Log and Entra sign-in logs, Google Cloud Audit Logs) answer "who did what, when". Make sure they are on and stored where an attacker cannot delete them.
  • Preventive guardrails beat cleanup: AWS service control policies, Azure Policy and Google organization policies stop whole classes of mistakes.
  • The shared responsibility model decides who fixes what. The provider secures the platform; you secure your configuration, identities and data.

A framework for answering cloud security scenarios

StepWhat you sayExample controls
1. ScopeWhich asset, which identity, which account or projectAsset inventory, tags, resource graph
2. ContainStop the bleeding without destroying evidenceDisable keys, isolate security groups, block public access
3. PreserveKeep logs and snapshots before changing moreDisk snapshots, log export to a locked bucket
4. InvestigateBuild a timeline from audit and network logsCloudTrail, Activity Log, Cloud Audit Logs, flow logs
5. RecoverRotate secrets, rebuild from known-good imagesKey rotation, IaC redeploy
6. PreventAdd a guardrail and a detection ruleSCPs, Azure Policy, org policy, alerts

NIST SP 800-61, the US government's incident response guide, uses similar phases. Mentioning it shows you know a recognised process.

Scenarios for freshers

1. A storage bucket with customer files is publicly readable. What do you do first?

Remove public access immediately: on AWS turn on S3 Block Public Access for the bucket (and the account), on Azure disable anonymous blob access on the storage account, on Google Cloud enforce public access prevention on the bucket. Then check access logs for downloads during the exposure window, tell the security team, and find out how the setting was changed so a policy can block it next time.

2. A developer committed an AWS access key to a public GitHub repository. What are your steps?

Deactivate the key in IAM right away, then delete it once dependent systems are moved to a new credential. Review CloudTrail for every API call made with that key ID since the commit, and look for new users, keys, roles or instances an attacker may have created. Removing the commit is not enough because the key is already public. Long term, replace static keys with IAM roles or OIDC federation and turn on secret scanning in the repository.

3. What is the shared responsibility model, and how does it change your response to a vulnerability?

The provider secures the underlying infrastructure; the customer secures what they configure and run. If the vulnerability is in the hypervisor of a managed service, the provider patches it. If it is in your EC2 operating system, container image or application code, you patch it. On fully managed services such as serverless functions, your share shrinks to code, configuration, identities and data. Our post on the AWS shared responsibility model has examples.

4. Several admin accounts do not use MFA. How do you fix this without locking people out?

Announce a deadline, help admins register phishing-resistant methods such as FIDO2 security keys or passkeys, then enforce MFA. On AWS, move people to IAM Identity Center with MFA and use an IAM policy condition to deny actions without MFA for any remaining IAM users. On Azure, use Conditional Access policies for admin roles. On Google Cloud, enforce 2-Step Verification in Cloud Identity or Google Workspace. Keep two break-glass accounts with strong MFA, stored securely and monitored.

5. A security group allows SSH (port 22) from 0.0.0.0/0. What do you change?

Remove the open rule. For admin access use AWS Systems Manager Session Manager, Azure Bastion or Google Cloud IAP TCP forwarding so no inbound SSH port is needed at all. If SSH must stay, limit it to a known corporate range and log connections. Add a detection rule (AWS Config, Azure Policy or Security Command Center findings) that alerts on future open admin ports.

6. How do you know if CloudTrail or the equivalent is actually recording?

Check that an organization-wide trail exists in all regions, that it writes to a bucket in a separate logging account, and that log file validation is on. On Azure, confirm diagnostic settings send the Activity Log and Entra logs to a Log Analytics workspace. On Google Cloud, confirm Admin Activity logs (always on) and any Data Access logs you need are enabled, with an aggregated sink to a central project.

7. An application stores database passwords in environment variables in plain text. What do you recommend?

Move them to a secrets manager: AWS Secrets Manager, Azure Key Vault or Google Secret Manager. Grant the workload's identity read access to that one secret, fetch it at runtime, and turn on rotation where the service supports it. Avoid printing configuration in logs. Our guide on keeping secrets out of Git covers the repository side.

8. Your manager asks whether data in a storage account is encrypted. How do you answer?

All three major providers encrypt data at rest by default with provider-managed keys. The real questions are whether you need customer-managed keys in a key management service (AWS KMS, Azure Key Vault, Cloud KMS) for control over rotation and access, and whether data in transit is forced over TLS. Check the bucket or account policy for HTTPS-only access.

9. A new joiner was added to the cloud Owner or AdministratorAccess role "just to get started". What is wrong, and what do you do?

It breaks least privilege. Replace it with a role that matches their job, granted through a group, and use time-bound elevation for rare admin tasks (for example Microsoft Entra Privileged Identity Management on Azure). Review who holds admin roles on a schedule.

10. An alert says a VM is talking to a known cryptomining pool. What are your first actions?

Isolate the instance by moving it to a quarantine security group or firewall rule that blocks outbound traffic, take a disk snapshot for forensics, and check how it was compromised (exposed service, weak SSH, leaked key, vulnerable image). Look for the same indicators on other instances. Rebuild from a clean image rather than cleaning the infected machine, and fix the entry point.

11. How would you find all resources that are publicly reachable in an account?

Use native tools first: AWS IAM Access Analyzer for externally shared resources and Security Hub findings, Microsoft Defender for Cloud recommendations and Azure Resource Graph queries, and Google Security Command Center findings. Add a cloud security posture management tool if you run multiple clouds. Our list of cloud security tools for DevOps engineers compares options.

12. A colleague wants to disable a noisy security alert. How do you respond?

Investigate why it is noisy before changing anything. Tune it with suppression rules scoped to the known-good pattern (a specific scanner, IP range or resource), document the reason, and set a review date. Disabling a detection outright removes visibility for real attacks of the same kind.

13. How do you protect the root or global admin account?

Use it only for tasks that require it. Enable hardware MFA, remove any access keys from the AWS root user, store credentials in a secured vault with restricted access, and alert on every sign-in to that account. In AWS Organizations you can centrally manage root access for member accounts so they have no standing root credentials.

14. A penetration test is planned against your cloud environment. What do you check first?

Read the provider's penetration testing policy, since each one publishes what is allowed without prior approval and what is prohibited (such as denial-of-service testing). Agree written scope, accounts, dates and contacts, tell the monitoring team, and make sure findings go into the normal remediation process.

15. Why are flow logs useful in an investigation?

VPC flow logs (AWS and Google Cloud) and Azure virtual network flow logs record accepted and rejected connections with source, destination, port and bytes. They show which hosts a compromised instance talked to and whether data left the network, which audit logs alone do not show.

Scenarios for 2 to 5 years of experience

16. GuardDuty reports credentials from an EC2 instance role being used from an outside IP address. What does that mean, and what do you do?

The role's temporary credentials were probably stolen from the instance, often through an application flaw that let someone read the instance metadata service. Revoke active sessions for the role (the IAM console offers "Revoke active sessions", which adds a deny policy for older tokens), isolate the instance, review CloudTrail for what the credentials did, and require IMDSv2 on all instances, which uses session tokens and is harder to abuse through request forgery.

17. An IAM role used by a Lambda function has "Action": "*". How do you right-size it safely?

Look at what it actually uses. IAM Access Analyzer can generate a policy based on CloudTrail activity, and last-accessed information shows unused services. Deploy the narrower policy to a test environment, watch for access denied errors, then roll it out. Add a policy check in CI so wildcard actions are flagged before merge. Our post on preventing IAM policy misconfigurations goes further.

18. A Kubernetes pod is running as root with a privileged security context. How do you stop this across the cluster?

Turn on Pod Security Admission and label namespaces to enforce the restricted or at least baseline Pod Security Standard. PodSecurityPolicy was removed in Kubernetes 1.25, so do not suggest it. For custom rules, add a policy engine such as OPA Gatekeeper or Kyverno. Fix the workload by setting runAsNonRoot: true, dropping capabilities and using a read-only root filesystem.

apiVersion: v1
kind: Namespace
metadata:
  name: payments
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/warn: restricted

19. The Kubernetes dashboard or API server is reachable from the internet. What do you change?

Restrict the API server endpoint to private access or to authorised IP ranges (EKS public endpoint CIDR restrictions, AKS authorized IP ranges or private cluster, GKE private endpoint or authorized networks). Remove or lock down the dashboard, require Entra ID, IAM or Google identity for access, and review RBAC for any bindings to system:anonymous or system:unauthenticated. Our Kubernetes security best practices list the full set.

20. A container image in production has a critical CVE. What is your process?

Confirm the vulnerable package is actually in the image and reachable, check whether a fixed version exists, rebuild the image with the patched base or library, run tests and redeploy through the normal pipeline. Meanwhile, consider compensating controls such as a WAF rule or network restriction. Make scanning a pipeline gate and rescan images in the registry regularly, since new CVEs appear after build.

21. Developers need production read access to debug, but auditors object to standing access. What do you design?

Just-in-time access: a request and approval flow that grants a time-limited role and logs it. Options include Microsoft Entra PIM on Azure, temporary elevated access with IAM Identity Center on AWS, and Privileged Access Manager on Google Cloud. Pair it with session logging and read-only roles by default.

22. A CI/CD pipeline uses a long-lived cloud admin key stored as a secret. How do you improve it?

Replace the key with OIDC federation: GitHub Actions, GitLab CI and Azure Pipelines can all exchange a short-lived OIDC token for cloud credentials (AWS IAM roles with a web identity provider, Azure workload identity federation, Google Workload Identity Federation). Scope the trust to the specific repository and branch, and give each pipeline a narrow role per environment. Then delete the old key.

23. Terraform plans keep opening security groups and making buckets public. How do you catch this before apply?

Add policy-as-code checks in the pipeline: static scanners such as Checkov, tfsec (now part of Trivy) or KICS on the code, and OPA or Sentinel policies on the plan output. Fail the pipeline on high-severity findings and require a reviewed exception for anything that must stay. Back it with preventive cloud guardrails so a manual change is also blocked.

24. A KMS key used for production database encryption was scheduled for deletion by mistake. What do you do?

Cancel the deletion while it is still in the waiting period (AWS KMS requires a waiting period of 7 to 30 days; Azure Key Vault soft delete and Cloud KMS scheduled destruction also give a recovery window). Then restrict who can schedule key deletion, add an alert on that API call, and turn on purge protection in Azure Key Vault.

25. An Azure storage account SAS token was shared in a support ticket. How do you contain it?

If it is an account SAS signed with an account key, rotate the key that signed it, which invalidates every SAS from that key. If it is tied to a stored access policy, revoke or change the policy. A user delegation SAS can be revoked by revoking user delegation keys. Prefer short-lived user delegation SAS and Entra ID access going forward, and consider disabling shared key access on the account.

26. Logs show many failed sign-ins followed by a success for one user. How do you investigate?

Treat it as possible password spraying or credential stuffing. Check source IPs, location and device, what the account did after signing in, and whether MFA was satisfied. Reset the password, revoke sessions and refresh tokens, and check for new MFA methods, mailbox rules or app consents the attacker may have added. Enforce MFA and risk-based sign-in policies.

27. How do you make sure audit logs cannot be deleted by an attacker who gets admin access to a workload account?

Send logs to a dedicated logging account or project that workload admins cannot access. Use S3 Object Lock or bucket retention policies (Google Cloud bucket lock, Azure immutable blob storage) and protect the trail itself with an SCP or policy that denies stopping or deleting it.

28. A third-party SaaS vendor needs access to read your AWS bills and resource inventory. How do you grant it?

Create a cross-account IAM role with read-only permissions limited to what the vendor needs, with a trust policy that names the vendor's account and requires an external ID to prevent the confused deputy problem. Do not hand over IAM user access keys. Review the role's activity in CloudTrail.

29. Your WAF blocks a lot of traffic, and the business says real users are being blocked. What do you do?

Look at the WAF logs for the rule IDs triggering on legitimate requests. Put that rule in count or detection mode, write a scoped exclusion for the specific path or parameter, then return it to block mode. Test changes in a staging environment first and keep managed rule sets up to date.

30. A serverless function has a public URL and no authentication. What do you change?

Require authentication at the platform: AWS Lambda function URLs support AWS_IAM auth, Azure Functions support function keys and built-in Entra authentication, and Cloud Run functions can require IAM invoker permissions. For public APIs, put an API gateway in front with authentication, rate limiting and a WAF.

Scenarios for senior engineers

31. You are asked to design guardrails for 50 new AWS accounts. What do you put in place?

Use AWS Organizations with organizational units for prod, non-prod, security and sandbox. Apply SCPs that deny leaving the organization, disabling CloudTrail, GuardDuty or Config, and using unapproved regions. Centralise CloudTrail, Config and Security Hub in a security account, use IAM Identity Center for human access, and create accounts through a pipeline (for example AWS Control Tower account factory) so the baseline is identical.

32. How would you apply zero trust to a cloud application that currently relies on a VPN?

Make every request prove identity and device state rather than trusting the network. Put the app behind an identity-aware proxy (Google Cloud IAP, Microsoft Entra application proxy or AWS Verified Access), require MFA and device compliance, use service identities with mTLS between services, and segment the network so a compromised host cannot reach everything. Our post on zero trust in DevSecOps covers the principles.

33. Sensitive data must not leave approved projects even if someone steals valid credentials. What do you design?

On Google Cloud, VPC Service Controls perimeters block API access from outside the perimeter. On AWS, combine VPC endpoint policies, resource policies with aws:PrincipalOrgID and aws:SourceVpce conditions, and SCPs (a data perimeter). On Azure, use private endpoints, disable public network access on data services and apply Azure Policy. Add DLP scanning to find where sensitive data lives.

34. A security finding backlog has 8,000 items. How do you prioritise?

Rank by exposure and impact, not raw count: internet-facing resources with critical vulnerabilities, identities with admin rights and no MFA, public data stores and exploitable known vulnerabilities (CISA's Known Exploited Vulnerabilities catalogue helps). Fix root causes in templates and base images so whole groups of findings close at once, and set SLAs by severity.

35. A multi-cloud company wants one view of security posture. What do you recommend?

Keep native detections on each cloud (GuardDuty, Defender for Cloud, Security Command Center) because they see the provider's telemetry best, then send findings and logs to one SIEM such as Microsoft Sentinel, Google Security Operations or Splunk. Add a CSPM or CNAPP tool if you need cross-cloud configuration checks against CIS Benchmarks.

36. How do you secure the software supply chain for container workloads?

Build in a controlled CI system, generate an SBOM, sign images (for example with Sigstore cosign), store them in a private registry with scanning, and enforce at deploy time that only signed images from that registry run (Binary Authorization on GKE, admission policies with Kyverno or Gatekeeper, or AWS Signer with EKS). The SLSA framework describes levels for build integrity.

37. A regulator requires encryption keys to be under your control. How do you design key management?

Use customer-managed keys in the cloud KMS with separation of duties: key administrators cannot use the keys, and application roles can use but not manage them. Turn on rotation, log every key use, and if the requirement is stricter, use hardware-backed options (CloudHSM, Azure Managed HSM, Cloud HSM) or external key management where the provider supports it.

38. Write an incident response runbook outline for a compromised cloud account.

Detection and triage criteria, who to call, containment actions (disable credentials, revoke sessions, isolate resources), evidence preservation (export logs, snapshot disks, keep copies in a separate account), investigation queries, eradication and recovery (rotate all secrets, rebuild from IaC), communication and legal notification steps, and a blameless review with tracked actions. Practise it with game days.

39. How do you prevent privilege escalation through IAM itself?

Limit who can create or modify roles, policies and trust relationships. Use permission boundaries on AWS so delegated admins cannot grant more than the boundary, restrict iam:PassRole to specific roles, and on Google Cloud restrict who can impersonate service accounts or create keys (with the organization policy that disables key creation). Monitor policy changes in audit logs.

40. Leadership asks you to report cloud security risk each quarter. What do you measure?

Choose measures tied to exposure: share of identities with MFA, number of long-lived access keys, public resources, critical vulnerabilities open past SLA, mean time to detect and contain incidents, and coverage of logging and detection services across accounts. Show trends rather than single numbers.

Incident scenarios

41. A ransomware note appears in an S3 bucket and objects are encrypted with an unknown KMS key. How do you respond?

Contain by disabling the credentials used (find them in CloudTrail), and restrict the bucket policy. Check whether versioning was on, because previous object versions may be intact; restore from versions or from backups held in a separate account with AWS Backup vault lock or Object Lock. Report through the incident process. Going forward, enable versioning, Object Lock for critical data and cross-account backups.

42. Cloud costs jumped overnight with hundreds of GPU instances in a region you never use. What happened, and what do you do?

This is a common sign of stolen credentials used for cryptomining. Terminate the instances after snapshotting one for evidence, find and disable the credentials in audit logs, look for persistence such as new IAM users, roles or access keys, and open a case with the provider. Prevent it with region restriction policies, budget alerts and anomaly detection.

43. An employee's laptop was stolen and it had cloud CLI credentials cached. What do you do?

Revoke the user's sessions and refresh tokens in the identity provider, deactivate any access keys or PATs tied to them, and review audit logs for activity after the theft time. Wipe the device remotely if it is managed. Long term, use short-lived SSO credentials for CLI access (for example aws sso login, az login with Entra, gcloud auth login) instead of stored keys.

44. A public-facing app is leaking other users' data through an API. How do you contain and investigate?

Disable the affected endpoint or put a WAF rule in front of it, preserve application and gateway logs, and work with developers to find the authorization flaw (often a missing object-level check). Measure what data was exposed and to whom, involve legal and privacy teams for notification duties, fix the code with tests, and add authorization tests to the pipeline. The OWASP API Security Top 10 lists this class of issue.

45. During an investigation you find a new IAM user named like a system account with admin rights created at 03:00. What next?

Treat it as attacker persistence. Disable the user and its keys, keep a record of its policies, find the identity that created it in CloudTrail, and investigate that identity's activity. Search for other persistence: new roles with external trust, Lambda functions, modified SCPs, new SSH keys. Alert on IAM user creation in production accounts going forward.

How to prepare

  1. Pick one cloud and build a small lab with logging, a detection service and a few misconfigured resources, then find and fix them using only the native tools.
  2. Write a one-page incident runbook and practise talking through it in under five minutes.
  3. Learn the CIS Benchmark for your chosen cloud and Kubernetes at a high level.
  4. If you want a certification, look at AWS Certified Security - Specialty, Microsoft Certified: Azure Security Engineer Associate or Google Professional Cloud Security Engineer, and check each provider's certification page for current exam details.

Our DevSecOps training covers pipeline security, secrets, scanning and cloud guardrails, and the CKS training covers cluster hardening, both available in the Kharadi, Pune classroom or live online.

FAQ

What are scenario-based cloud security interview questions?

They present a realistic incident or risky configuration, such as a leaked key or a public bucket, and ask how you would contain, investigate and prevent it. They test practical judgment more than definitions.

What should I do first when an access key is leaked?

Deactivate the key immediately, then review audit logs for everything done with it, look for persistence the attacker may have created, and move the workload to short-lived credentials such as roles or OIDC federation.

Which cloud services detect threats natively?

Amazon GuardDuty on AWS, Microsoft Defender for Cloud on Azure and Security Command Center on Google Cloud. Each analyses provider telemetry such as audit logs, DNS and network data to raise findings.

Is PodSecurityPolicy still used in Kubernetes?

No. PodSecurityPolicy was removed in Kubernetes 1.25. Use Pod Security Admission with the Pod Security Standards, and add a policy engine such as Gatekeeper or Kyverno for custom rules.

How do you protect audit logs from tampering?

Send them to a separate logging account or project, apply immutability such as S3 Object Lock or bucket retention locks, and use organization policies to deny disabling or deleting the logging configuration.

What is the shared responsibility model?

It splits security duties between provider and customer. The provider secures the physical infrastructure and managed service platform; the customer secures identities, configuration, data and anything they run on top.

How is this page different from the advanced cloud security questions?

This page is built around incidents and hands-on fixes grouped by experience level. The advanced page focuses on architecture and design questions for senior roles.

Official references

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.