Cloud Security Architecture Questions
Designing and reasoning about the security posture of cloud and hybrid infrastructure: the shared responsibility model, network segmentation and boundary design, multi-account and multi-region security architecture, workload identity as an architectural choice, threat modeling a cloud architecture, cloud-specific attack vectors and mitigations, defense-in-depth control selection, secure cloud deployment patterns, and continuous cloud risk assessment and posture. IAM policy authoring, role/trust-policy mechanics, and secrets/credential lifecycle belong to identity-and-access-management; logging-pipeline design and SIEM/detection-rule engineering belong to security-monitoring-and-detection; encryption-key-management mechanics (KMS/CMK/BYOK) belong to data-protection-and-encryption; compliance-framework mapping (SOC2, PCI-DSS, HIPAA, GDPR) belongs to compliance-frameworks-and-certification-standards. This topic keeps identity, logging, or encryption content only when it is one ingredient inside a genuinely multi-control cloud-hardening question, not as a standalone ask.
Explain the concept of 'hub-and-spoke' network topology in enterprise cloud networking. What are two security benefits and one potential single point of failure you must mitigate?
Sample Answer
Direct answer
Hub-and-spoke is a network topology where a central "hub" virtual network hosts shared services (a transit gateway or equivalent, centralized firewall/inspection, logging, VPN or Direct Connect termination) and every workload "spoke" network connects only to the hub, never directly to another spoke; the two clearest security benefits are centralized enforcement and reduced east-west exposure between workloads, and the one significant single point of failure to mitigate is the hub itself, since every spoke's connectivity, and every spoke's security enforcement, now depends on it.
Structured elaboration
Security benefit 1: centralized policy enforcement and inspection. Because every spoke's traffic to another spoke, or to the internet, or to an on-premises network passes through the hub, a single centralized firewall or inspection appliance in the hub can enforce one consistent policy for every workload, rather than each spoke team independently configuring and maintaining its own egress and inter-spoke rules, which in practice drift out of consistency over time.
Security benefit 2: default isolation between spokes. Spokes do not connect directly to each other by default in a hub-and-spoke design; two spokes can only reach each other by explicit route through the hub, which is itself a chokepoint the hub's own policy can restrict or deny. This means a compromise in one spoke does not automatically have a network path to another spoke, unless the hub's routing and policy explicitly permit it, a meaningfully smaller default blast radius than a flat, fully-meshed network where every workload can reach every other workload unless specifically blocked.
The single point of failure: the hub itself. Every spoke's connectivity to every other spoke, to the internet, and to on-premises infrastructure routes through the hub; an outage or a misconfiguration in the hub's transit gateway, its centralized firewall, or its own network path affects every spoke simultaneously, which is a materially larger blast radius for an availability failure than a flat topology would have (even though the security posture is generally better). The hub is also a concentrated target: a compromise of the hub's own centralized firewall or transit component potentially exposes the routing decisions for every spoke it serves.
Mitigating the hub's single-point-of-failure risk. Redundant hub infrastructure (a highly-available transit gateway configuration, redundant firewall appliances across multiple Availability Zones rather than a single instance) is the direct availability mitigation. For the security-concentration risk specifically, the hub's own administrative access needs tighter controls than any individual spoke (since compromising hub administration is a strictly worse outcome than compromising one spoke), and the hub's own configuration changes should go through a more deliberate change-control process than a typical spoke, given the blast radius of a mistake made there.
Worked example
An enterprise with 12 application spokes routes all inter-spoke and internet-bound traffic through a hub containing a redundant, multi-Availability-Zone firewall cluster and a highly-available transit gateway. A compromised workload in Spoke 3 attempts to reach a database in Spoke 7; because spokes do not connect directly, this traffic must route through the hub, where the centralized firewall's policy (permitting only the specific inter-spoke flows that have been explicitly approved) denies the connection, since Spoke 3 and Spoke 7 were never granted a route to each other. Separately, when one of the hub's two firewall appliances fails during a maintenance window, the redundant second appliance continues serving all 12 spokes without an availability interruption, which is the concrete payoff of the redundancy investment described above; without it, that same failure would have been a total outage for every spoke simultaneously, not just the one undergoing maintenance.
Trade-offs and pitfalls
- The security benefit and the availability risk come from the exact same architectural property, and treating them as separate concerns misses that they trade off against each other. The same centralization that makes policy enforcement consistent and blast radius small during a compromise is what makes an outage or a misconfiguration in the hub itself catastrophic across every spoke at once; a hub-and-spoke design is only a net improvement if the redundancy investment in the hub is genuinely made, not merely intended.
- A common wrong turn is under-investing in hub redundancy specifically because the hub "isn't a workload," so it does not get the same operational rigor (monitoring, on-call ownership, change review) that individual application spokes receive. The hub is infrastructure every spoke depends on, and it deserves at least the operational rigor of the most critical spoke it serves, not less.
- A hub-and-spoke design still allows a spoke-to-spoke path if the hub's policy explicitly permits it, and over time, as more legitimate integration needs accumulate, the hub's policy can gradually grow permissive enough to erode the default-isolation benefit. Periodic review of the hub's actual permitted spoke-to-spoke flows against what is still genuinely needed keeps this benefit real rather than nominal.
- A concentrated administrative-access risk at the hub is easy to overlook because the hub is infrastructure, not a customer-facing workload, and infrastructure access reviews sometimes receive less scrutiny than application access reviews. Given the hub's blast radius, its administrative access should receive at least as much scrutiny as the most sensitive spoke it serves, arguably more.
You are reviewing an infrastructure-as-code repository (Terraform/CloudFormation) for a production cloud environment. List the most common high-risk misconfigurations you would look for across IAM, storage, networking, and compute. Also explain how you would automate detection of these misconfigurations in CI/CD before changes reach production.
Sample Answer
Direct answer
A production infrastructure-as-code (IaC) review should walk the same four surfaces every time: identity and access management (IAM), storage, networking, and compute, because that is the order in which a real breach typically chains (a broad credential finds an open door, and an open door leads to unencrypted data). Catching these at review time is necessary but not sufficient: the same checks need to run automatically on every pull request, not just when a human remembers to look.
Structured elaboration
| Category | High-risk misconfiguration to look for | Why it matters |
|---|---|---|
| IAM | Wildcard actions or resources ("Action": "*", "Resource": "*"); trust policies allowing AssumeRole from "Principal": "*"; missing multi-factor authentication (MFA) condition on privileged roles; static long-lived access keys checked into the repository | Turns any single compromised identity into an account-wide foothold |
| Storage | Bucket ACLs or policies allowing public read/write; Block Public Access disabled; missing default encryption; missing versioning on buckets holding data that must survive accidental deletion | Direct data exposure or irreversible data loss, often the visible symptom of a breach even when the entry point was elsewhere |
| Networking | Security groups with ingress from 0.0.0.0/0 on management ports (22, 3389); overly permissive network access control lists (NACLs); VPC (Virtual Private Cloud) flow logs disabled; resources placed in a public subnet with no clear reason | Widens the reachable surface for the earlier two categories to be exploited from the internet |
| Compute | Instances with unnecessary public IPs; hard-coded credentials in user-data or launch templates; instance metadata service left without http_tokens = "required" (IMDSv2 (Instance Metadata Service version 2) not enforced); containers configured to run as a privileged user | Gives an attacker who reaches a compute resource a path to the temporary IAM credentials or secrets on that host |
Worked example
The Terraform snippet below intentionally seeds one misconfiguration from each category; it is syntax-valid HashiCorp Configuration Language (HCL) against the AWS provider (validated with terraform validate), and each block is annotated with what a reviewer, or an automated check, should flag:
# IAM: wildcard action + wildcard resource
resource "aws_iam_policy" "too_wide" {
name = "app-policy"
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Action = "*" # flag: no wildcard actions
Resource = "*" # flag: no wildcard resources
}]
})
}
# Storage: bucket has no Block Public Access resource attached
resource "aws_s3_bucket" "app_data" {
bucket = "example-app-data-bucket"
# flag: missing aws_s3_bucket_public_access_block, missing
# aws_s3_bucket_server_side_encryption_configuration
}
# Networking: SSH open to the entire internet
resource "aws_security_group" "app" {
name = "app-sg"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"] # flag: should be a bastion/VPN CIDR only
}
}
# Compute: IMDSv2 not enforced (http_tokens left at its default "optional")
resource "aws_instance" "app" {
ami = "ami-0123456789abcdef0"
instance_type = "t3.micro"
metadata_options {
http_endpoint = "enabled"
# flag: http_tokens = "required" is missing
}
}
Automating detection in CI/CD
- Static analysis on every pull request. A policy-as-code scanner (Checkov, tfsec, or Terrascan) runs against the raw HCL before a human ever reviews it, catching exactly the four patterns above by pattern-matching the resource configuration, not by executing anything.
- Plan-time policy gate. Beyond static patterns, evaluate the actual
terraform planJSON output with a policy engine (Open Policy Agent (OPA)/Conftest, or a managed equivalent such as HashiCorp Sentinel) so the check sees the fully resolved configuration, including values coming from variables or modules that a purely static scan might miss. - Secret scanning on the IaC repository itself. A tool such as gitleaks or truffleHog run in the same pipeline catches a credential accidentally committed into a
.tffile or aterraform.tfvars. - Post-deploy drift detection. A pipeline gate only catches what goes through the pipeline; a scheduled cloud-native check (AWS Config managed rules, or an equivalent cloud security posture management (CSPM) tool) catches the same four categories of misconfiguration when they are introduced through the console instead of through IaC.
Trade-offs and pitfalls
- A pipeline gate that only runs against production IaC misses the source of the problem. Misconfigurations are frequently written first in a development or staging module and then copied into production later; the same static and policy-as-code checks need to run against every environment's plan, not just the one that matters most.
- Over-strict gates get bypassed. If a policy-as-code check blocks a legitimate, reviewed exception (a genuinely public documentation bucket, for instance) with no override path, teams learn to route around the pipeline instead of fixing the finding; a documented, time-boxed exception mechanism keeps the gate credible.
- Static analysis alone cannot see values resolved at plan time from a module or a data source, which is why the plan-time policy gate is a separate, necessary layer rather than a duplicate of the static scan.
A customer asks whether they should use network-based controls (VPC endpoints, NGFW) or identity-based controls (IAM, service accounts) to protect access to cloud-managed storage. As a solutions architect, explain how you would combine both approaches and provide one example attack each approach prevents that the other does not.
Sample Answer
Direct answer
Network-based controls (Virtual Private Cloud (VPC) endpoints, a next-generation firewall (NGFW)) and identity-based controls (identity and access management (IAM), service accounts) protect cloud-managed storage against two different classes of threat, and combining them means neither one has to be stretched to cover what the other is actually better suited for: network controls restrict where a request can originate from, identity controls restrict who or what the request claims to be and what it is authorized to do, and a genuinely secure design needs both, since an attacker who satisfies one but not the other should still be stopped.
Structured elaboration
How to combine them. Require every request to storage to originate from an approved network path (a VPC endpoint, never the public internet-facing version of the service) as a baseline, structural restriction; layer identity-based scoping on top of that, so that even a request originating from the approved network path must also present a valid, narrowly-scoped credential authorized for the specific action and resource it is requesting. Neither control is sufficient alone: network restriction without identity scoping means anyone who reaches the approved network path (an insider, or an attacker who has pivoted onto that network) can act with whatever broad permissions exist; identity scoping without network restriction means a leaked, valid credential can be used from anywhere on the internet.
Attack example 1: what network-based controls prevent that identity-based controls do not. A developer's valid, correctly-scoped storage credential is accidentally committed to a public code repository (a classic, common leak). With identity-based controls alone, an attacker who finds the leaked credential can use it from anywhere, since the credential itself is what identity controls check, and it is entirely valid. With a network-based control also in place (the storage bucket's own policy or the VPC endpoint's own restriction requiring the request to originate from the VPC), the leaked credential is useless from the attacker's own external network, since the request never satisfies the network-origin requirement regardless of how valid the credential presented is. The network control catches exactly the failure mode where the credential itself is compromised but the network path is not.
Attack example 2: what identity-based controls prevent that network-based controls do not. A compromised, low-privilege application server sits inside the approved VPC and has network-level reachability to the storage service through the VPC endpoint. With network-based controls alone, this compromised server could reach the storage service, since it satisfies the network-origin requirement; whether it can then read or modify data depends entirely on what identity it presents. With identity-based scoping in place (the compromised server's own service account holding only narrow, resource-specific permissions), the compromised server's network reachability does not translate into broad data access, since its identity is scoped to only the specific bucket or objects its own legitimate function requires, not the organization's entire storage estate. The identity control catches exactly the failure mode where the network path is legitimate but the requesting identity should not be trusted with broad access.
Worked example
A retail company's storage architecture requires both: the storage bucket's policy denies any request not originating from the company's VPC endpoint (network control), and every service account with access to the bucket holds a narrowly-scoped policy limited to the specific prefix that service's own function needs (identity control). A payment-processing service's credential is accidentally exposed in a misconfigured logging pipeline; an external attacker who finds it cannot use it, since their request originates outside the VPC and the network control rejects it before identity is even evaluated. Separately, an unrelated internal reporting service, compromised through a vulnerable dependency, does satisfy the network-origin requirement (it genuinely runs inside the VPC) but its own service account's identity-based permissions are scoped only to the reporting bucket's own prefix, so the compromise cannot be used to read the separate payment-processing bucket even though both are reachable over the same VPC endpoint.
Trade-offs and pitfalls
- A design that implements only the network control and treats identity scoping as secondary is the single most common gap, because the network control is often easier to configure once and forget, while identity scoping requires ongoing per-service discipline as the organization's services and their access needs evolve. The worked example's second scenario, a legitimately-network-present but compromised service, is exactly what this gap leaves open.
- Network-based controls can create a false sense of completeness specifically because "it's all inside our VPC" sounds secure, even though everything inside a VPC is not equally trustworthy, a compromised internal service is still a real threat the network boundary alone does nothing to contain once the attacker is already inside it.
- The two controls need to be evaluated in the right order to be efficient, not just both present: rejecting a request that fails the network-origin check before spending any effort evaluating its identity is both a performance optimization and a security benefit, since it avoids leaking any information (such as a specific permission-denied reason) to a request that should never have reached the storage service's identity-evaluation logic in the first place.
- Combining both controls raises real operational cost: every new service needs both a correctly-scoped network path and a correctly-scoped identity, and a team under delivery pressure that gets one right and shortcuts the other has only partially implemented the design's actual security guarantee, even though the deployment may appear complete and functional in every other respect.
Walk through a threat model for a compromised dependency in the IaC toolchain that injects malicious resources during deployment. Identify the entry vectors and potential impact, then propose preventive and detective controls across the build, registry, and deployment stages.
Sample Answer
Direct answer
A compromised dependency in the infrastructure-as-code (IaC) toolchain that injects malicious resources during deployment is a supply-chain threat model with the same shape as a compromised application-code dependency, but with a categorically worse blast radius, since the "code" being tampered with does not just run in an application, it directly provisions and modifies cloud infrastructure, meaning a successful compromise here can create a persistent, infrastructure-level backdoor rather than a bounded application-level one. Controls need to exist at build, registry, and deployment, since a compromise at any single stage that goes unchecked at the next stage still reaches production.
Structured elaboration
Entry vectors. A malicious or hijacked third-party Terraform provider or module pulled from a public registry, its own maintainer account compromised, or a legitimate-looking but never-actually-reviewed new module; a compromised upstream dependency of a provider plugin itself (the provider binary's own build chain being tampered with, several supply-chain layers removed from the IaC author's own code); and a compromised internal module registry (if the organization runs its own private module registry, a compromise there could tamper with a module every internal team trusts by default, a single point of leverage across the whole organization).
Potential impact. A tampered module or provider can silently inject additional resources beyond what the visible Terraform configuration describes (a hidden IAM (identity and access management) role with broad permissions, a backdoor security-group rule, an additional compute resource under attacker control), modify the behavior of resources the configuration does appear to describe (weakening an encryption setting, widening a network rule), or exfiltrate the plan/apply's own state (which frequently contains sensitive values, credentials, connection strings) to an external destination during execution.
Preventive controls, by stage.
- Build stage: pin every provider and module to an exact, hash-verified version (never a floating version range), and generate and review a dependency inventory (a Software Bill of Materials (SBOM)-equivalent for the IaC toolchain itself) so a compromise of any specific dependency version is a known, trackable event rather than silently absorbed into "whatever the latest version happened to be" at build time.
- Registry stage: for any module sourced from a public registry, mirror it into an internally-controlled, reviewed registry rather than pulling directly from the public source on every build, so a compromise of the public registry after the organization's own review does not automatically propagate; for an internal module registry, apply the same access-control and change-review discipline used for any other production-critical system, since it is now exactly that.
- Deployment stage: run
terraform planoutput through a policy-as-code check before anyapply, specifically looking for resources or attributes not accounted for in the visible configuration diff, catching an injected resource even if the module or provider that introduced it was not independently caught at the build or registry stage.
Detective controls, by stage.
- Build stage: continuous re-scanning of pinned dependency versions against newly-disclosed vulnerability and compromise databases, since a dependency that was clean when pinned can be revealed as compromised later.
- Registry stage: monitoring for any change to a mirrored or internal module's content hash, flagging drift from the last-reviewed version even if the change technically came through an otherwise-legitimate update path.
- Deployment stage: post-apply drift detection (the same continuous, out-of-band comparison against the pipeline's own last-known-good state), catching a resource that was injected during an apply and does not match what the reviewed configuration describes, the layer that catches what a plan-time-only check could still miss if the tampering happened during the apply execution itself rather than being visible in the plan.
Worked example
An organization's Terraform configuration depends on a popular, publicly-sourced module for provisioning a standard networking pattern. The module's maintainer account is compromised, and a new version is published that looks functionally identical but silently adds an additional, broadly-permissioned IAM role to every deployment using it. Because the organization pins module versions to an exact, hash-verified reference rather than a floating range, this specific compromised version is never automatically pulled into an existing pipeline, closing the entry vector for currently-deployed infrastructure. A separate team, onboarding a new service and pulling the module fresh, would have picked up the compromised version had the build-stage dependency-scanning not flagged the version's hash mismatch against a subsequently-published community advisory, catching it before that team's own apply ever ran. For a hypothetical case where the compromised version had been pulled and applied before detection, the deployment-stage drift-detection control would separately have flagged the unexpected, undocumented IAM role appearing in the account, a second, independent layer that does not depend on the build-stage scan having caught it first.
Trade-offs and pitfalls
- Pinning to exact, hash-verified versions is the single highest-leverage control in this entire threat model, and it is also the control most often weakened for convenience, since floating version ranges reduce the maintenance burden of manually bumping pinned versions; the worked example's "closes the entry vector for currently-deployed infrastructure" outcome depends entirely on this discipline being followed consistently, not adopted once and eroded later.
- Mirroring public modules into an internally-controlled registry adds real process overhead (someone has to review and promote each update) and is easy to treat as a bottleneck worth removing under delivery pressure, but it is precisely the layer that stops a compromise of the public source from automatically propagating the moment it happens, rather than only after the organization's own next scheduled review.
- A plan-time policy-as-code check that only looks for known-bad resource patterns (a public bucket, a wildcard IAM policy) will miss a genuinely novel, unexpected resource injected by a compromised dependency, since the injected resource may not itself match any previously-known-bad pattern; the check needs to specifically flag resources or attributes NOT accounted for in the reviewed configuration's own diff, a different and complementary detection logic from pattern-matching known-bad configurations.
- Detective controls at the deployment stage (drift detection) are the safety net for everything the preventive controls at build and registry might miss, and treating them as optional once build and registry controls are in place underestimates how a sophisticated, targeted compromise could specifically be designed to evade exactly those two earlier layers; the three-stage design's real strength is that each stage's detection does not depend on the prior stage having caught the compromise first.
How would you architect network segmentation and access control in a high-regulation environment where data residency and regional compliance requirements differ per customer? Explain account design, VPC placement, routing, and how to enforce region-specific controls.
Sample Answer
Direct answer
Network segmentation and access control for a high-regulation environment with per-customer data residency means the account boundary, not just the network boundary, has to carry the residency guarantee: each customer's data lives in an account (or a set of accounts) scoped to their specific regulatory region, and region-specific controls are enforced through both account placement and Service Control Policies (SCPs) that make the residency rule structurally difficult to violate, not just documented as a design intent.
Structured elaboration
Account design. One account (or a small set of accounts, following the base multi-account pattern of separating production, security, and shared services) per customer per region, rather than a shared multi-tenant account serving customers with different residency requirements. This is a stronger commitment than the base multi-account design used for a single-region product, since here the account boundary is doing double duty: blast-radius isolation between customers, and legal/regulatory boundary enforcement between regions.
VPC placement. Each customer's account provisions its virtual private cloud (VPC) only in the region their contractual and regulatory requirement specifies; an SCP attached at the organizational-unit level for that customer's regulatory grouping denies the creation of any resource, not just a VPC, but any regional resource generally, outside the approved region list, so a resource cannot be accidentally provisioned in the wrong region even by an authorized administrator acting in good faith but working from a stale runbook.
Routing. No default cross-region, cross-customer routing exists; if a shared service genuinely needs to reach multiple customers' regions (a centralized billing system, for instance, which does not itself hold regulated customer data), that service's own account has narrowly-scoped, individually-reviewed connectivity to each customer account, rather than customer accounts being able to reach each other or a broad shared network directly.
Enforcing region-specific controls. Beyond the resource-creation SCP, use the organization's account-vending process (an automated account factory) to bake the correct region restriction into every new customer account at creation time, rather than relying on a human to correctly configure it manually for each new customer; a per-region-grouped organizational unit structure, with SCPs attached at the organizational-unit level rather than per-account, means the restriction is inherited automatically as new customer accounts are added to the correct group, and a misclassification (a new customer account accidentally placed in the wrong organizational unit) is itself a detectable, auditable event rather than a silent gap.
Worked example
A SaaS platform onboards a new customer in the European Union (EU) whose data must remain in the EU under a General Data Protection Regulation (GDPR)-driven contractual requirement, alongside an existing customer in Asia-Pacific (APAC) with a similar but regionally distinct requirement. The account-vending process creates the EU customer's account inside an "EU-regulated-customers" organizational unit, which carries an SCP denying resource creation outside EU regions; the APAC customer's account sits in a separate "APAC-regulated-customers" organizational unit with its own region-restricting SCP. A platform engineer, following a runbook written for the APAC customer, accidentally attempts to apply the same Terraform module to the EU customer's account, specifying an APAC region; the SCP denies the resource creation outright, regardless of the engineer's own IAM permissions, which would otherwise have been sufficient to create the resource had the account not carried this specific organizational guardrail. The mistake is caught structurally, at the moment of the attempted action, rather than discovered later during an audit.
Trade-offs and pitfalls
- Per-customer, per-region account provisioning does not scale for free; it multiplies the number of accounts that need consistent baseline security configuration (logging, guardrails, patching) proportional to the number of customers, not just the number of regions. This is exactly why the account-vending automation matters as much as the account-design decision itself: manually configuring dozens or hundreds of per-customer accounts consistently is not realistic at any meaningful customer count, and inconsistency in that baseline is where a residency guarantee actually breaks down in practice.
- A shared cross-customer service (billing, in the worked example) is a deliberate, narrow exception to the isolation model, and its own access needs more scrutiny, not less, precisely because it is the one component with legitimate reach into multiple regulatory boundaries at once. Treating it as "just infrastructure" and under-scoping its access undermines the isolation the rest of the design carefully enforces.
- SCPs enforce where a resource CAN be created; they do not, on their own, guarantee that data already correctly placed never gets copied or replicated somewhere else by an application-level process (a cross-region backup misconfigured to target the wrong destination, for instance). The account and SCP design is the structural foundation, but application-level data-flow review is still needed to confirm nothing inside the correctly-placed account itself creates an unintended cross-region copy.
- Organizational-unit-level SCP inheritance is powerful specifically because it removes per-account configuration as a point of failure, but it depends entirely on new accounts being correctly classified into the right organizational unit at creation time; a misclassification at that one step (unlike a subsequent attempted region violation, which the SCP catches) is not itself caught by this design and needs a separate validation step in the account-vending process.
Unlock Full Question Bank
Get access to all Cloud Security Architecture interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.