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.
Perform a threat modeling exercise for a large-scale streaming pipeline (e.g., Kafka or managed equivalent). Identify the highest-risk attack vectors across the producer, broker, and consumer layers, and propose mitigations and detection controls for each.
Sample Answer
Direct answer
A large-scale streaming pipeline (Kafka or a managed equivalent) has three layers with genuinely different threat profiles, producers (where data enters), brokers (where it is held and distributed), and consumers (where it is read and acted on), and the highest-risk vectors at each layer are different in kind, not just in severity: producer risk centers on what gets written, broker risk centers on who can reach and control the cluster itself, and consumer risk centers on what a compromised or malicious reader can do with what it consumes.
Structured elaboration
Producer layer: highest-risk vectors.
- Data poisoning. A compromised or malicious producer writes malformed, false, or adversarially-crafted records into a topic; because downstream consumers and stream-processing jobs generally trust that a message came from a legitimate producer once it is in the topic, poisoned data can propagate through every downstream system before anyone notices the source was compromised. Mitigation: schema validation enforced at write time (a schema registry rejecting a record that does not conform), and per-producer identity so a specific compromised producer's writes can be traced and, if needed, the topic partition it wrote to can be examined for the exact time range of compromise.
- Producer credential compromise. A leaked producer credential (an API key, a client certificate) lets an attacker write directly to the cluster with the legitimate producer's own authorization. Mitigation: short-lived, frequently-rotated producer credentials rather than long-lived static ones, and per-producer authorization scoped to only the specific topics that producer legitimately writes to, so a compromised producer credential cannot write to an unrelated, more sensitive topic.
Broker layer: highest-risk vectors.
- Unauthorized administrative access to the broker cluster itself. Broker administrative access (creating or deleting topics, modifying retention or replication configuration, or the underlying host access to a self-managed cluster) is the highest-leverage compromise in the entire pipeline, since it can affect every topic and every producer/consumer relationship at once, not just one data flow. Mitigation: the narrowest possible administrative access, scoped by role and audited continuously, following the same least-privilege discipline used throughout this domain, with a managed broker service (reducing the host-level attack surface entirely) preferred over self-managed brokers where the operational trade-off allows it.
- Inter-broker and client-broker traffic left unencrypted or unauthenticated. Traffic between brokers, and between clients and brokers, that does not enforce Transport Layer Security (TLS) and mutual authentication is interceptable or spoofable on the underlying network. Mitigation: TLS for all broker-to-broker and client-to-broker traffic, with mutual TLS (mTLS) or an equivalent strong authentication mechanism (Simple Authentication and Security Layer (SASL) with a strong mechanism) required for every client connection, not an optional configuration.
Consumer layer: highest-risk vectors.
- Over-broad consumer authorization. A consumer granted read access to more topics than its actual function requires can read data (including sensitive data flowing through an unrelated topic) it has no legitimate need to see; this is the consumer-side mirror of the producer-side scoping issue, and it matters specifically at scale, where consumer group sprawl over time tends to accumulate broader access than any individual consumer was originally provisioned with. Mitigation: per-consumer, per-topic least-privilege authorization, reviewed periodically rather than granted once and left unexamined.
- Replay and offset manipulation. A consumer (or an attacker who has compromised a consumer's credentials) can manipulate its own committed offset to re-read historical data it should only have consumed once, or, in a system that treats message consumption as a trigger for a side effect (a payment being processed, for instance), replay old messages to trigger that side effect again. Mitigation: idempotent consumer-side processing (designing the downstream action to be safe even if the same message is processed twice), and monitoring for anomalous offset resets or backward-jumping consumer positions as a detection signal independent of the idempotency safeguard.
Cross-layer detection controls
Beyond the per-layer mitigations above, two detection controls span all three layers: continuous audit logging of every administrative action (topic creation/deletion, access-control changes, offset resets) shipped to a centralized, separate log destination, consistent with the centralized-logging pattern used throughout this domain; and per-identity behavioral baselining (a specific producer's typical write volume and topic set, a specific consumer's typical read volume and topic set), flagging a deviation, a producer suddenly writing to a topic it has never written to before, or a consumer's read volume spiking well beyond its established baseline, as an anomaly worth investigating regardless of which specific layer or vector caused it.
Worked example
A financial services streaming pipeline processes transaction events. A compromised producer credential (a leaked API key from a misconfigured logging pipeline) is used to write malformed transaction records directly into the transactions topic. Schema validation at write time rejects most of the malformed records outright, but a subset that happens to satisfy the schema's structural requirements while carrying adversarially-incorrect values passes through; per-producer behavioral baselining flags the anomaly within minutes, since this producer's typical write volume is a small fraction of the burst the compromised credential generated. The security team isolates the compromised credential, and because producer authorization was scoped to only the transactions topic specifically (not broader), the attacker's reach never extended to the pipeline's other topics even during the window before detection.
Trade-offs and pitfalls
- Schema validation catches structurally malformed data but not adversarially valid data (values that pass every schema check while being substantively false or malicious), which is exactly the residual risk the worked example's "subset that passes through" represents. Schema validation and behavioral baselining are complementary, not redundant, precisely because they catch different halves of the same producer-layer risk.
- Broker administrative access is the single highest-leverage compromise in this entire threat model, and it is also the layer most often under-scrutinized relative to producer and consumer access, since day-to-day attention tends to focus on data flowing through the system rather than on who can reconfigure the system itself. The mitigation here deserves proportionally more rigor than either the producer or consumer layer alone, given its blast radius.
- Idempotent consumer-side processing is the correct architectural response to replay risk, but it requires deliberate design at the point every downstream side effect is implemented, not a bolt-on fix; a system built without idempotency in mind from the start is a materially larger retrofit than one designed for it from the beginning, which is why this needs to be a day-one architectural decision, not a response to a discovered replay incident.
- Per-consumer and per-producer authorization scoping tends to erode gradually over time as new consumers and producers are added under delivery pressure, each individually granted "just this one topic, temporarily broader than ideal"; periodic access review, not a one-time provisioning decision, is what keeps the least-privilege posture this threat model depends on actually real over the pipeline's operational lifetime.
Perform threat modeling for a multi-region, active-active cloud application that uses cross-region replication for databases and object storage. Identify top threats introduced by replication and cross-region trust (for example: misconfigured replication permissions, key compromise, data-leak during transit), enumerate attack surfaces, and prioritize mitigations by impact and likelihood.
Sample Answer
Direct answer
Cross-region replication for a multi-region active-active application introduces threats that a single-region threat model simply does not have, since replication means a second region now trusts and receives whatever the primary region sends, and that trust relationship itself, not just each region's own individual security posture, becomes new attack surface: a misconfigured replication permission, a compromised replication credential, or data-in-transit exposure during the cross-region hop can each turn a single-region compromise into a two-region one.
Structured elaboration
Attack surfaces introduced by replication and cross-region trust.
- The replication identity itself. The role or service principal performing the actual cross-region copy (for databases and object storage alike) necessarily has write access to the destination region, making it a uniquely privileged identity that exists nowhere in a single-region design; its compromise is the one event that could affect both regions simultaneously.
- Replication permission scope. A replication role or bucket-replication configuration scoped more broadly than the specific data it needs to replicate (a role permitted to write to the entire destination bucket rather than the specific prefix replication actually targets) widens what a compromise of that one identity could reach in the destination region beyond just the replicated data itself.
- Key custody across regions. If encryption keys are shared or replicated alongside the data (rather than each region holding its own key and the replication process re-encrypting on arrival), a key compromise in either region compromises both regions' data.
- Data-in-transit exposure. The cross-region hop itself, even when using the cloud provider's own backbone rather than the public internet, needs encryption in transit enforced explicitly, not assumed, since a provider's internal network being generally private is not the same guarantee as the specific replication traffic being encrypted end to end.
Top threats, with impact and likelihood.
- Misconfigured replication permissions granting broader-than-needed write access to the destination region. Impact: high (a compromise of the replication identity reaches beyond just the replicated dataset). Likelihood: medium (a common configuration oversight, since scoping replication permissions precisely takes more deliberate effort than a broad grant).
- Compromise of the replication identity/credential itself. Impact: high (the one identity that legitimately bridges both regions). Likelihood: medium (requires a separate compromise vector to obtain the credential in the first place, but the impact justifies treating this identity with disproportionate scrutiny regardless of likelihood).
- Shared or improperly-isolated encryption keys across regions. Impact: high (a single key compromise affects both regions' data at once, defeating the entire point of regional isolation). Likelihood: low to medium if the organization has already adopted per-region key isolation as a baseline practice, higher if it has not.
- Data-in-transit exposure during the cross-region hop. Impact: medium to high depending on data sensitivity. Likelihood: low if the provider's own encrypted backbone is correctly used and explicitly verified, higher if this was assumed rather than confirmed.
- Replication lag creating a consistency window an attacker could exploit (reading stale data from the secondary region, or a race condition where a security-relevant change, an access revocation, has not yet propagated to the secondary region). Impact: medium. Likelihood: medium, and specific to active-active architectures where both regions genuinely serve live traffic simultaneously rather than one being a passive standby.
Prioritized mitigations
Scope the replication identity to the exact minimum: specific source and destination resource, specific action (write, not broader), with no standing access beyond what the replication mechanism itself requires, addressing threats 1 and 2 together, since the same narrow-scoping discipline defends against both a misconfiguration and a compromise of that identity. Maintain per-region key isolation with a narrowly-scoped, audited re-encryption step at the replication boundary rather than shared keys, addressing threat 3 directly. Explicitly verify and enforce encryption in transit for the specific replication mechanism in use, rather than assuming the provider's general network privacy covers it, addressing threat 4. For threat 5, ensure security-relevant state changes (access revocations specifically) either replicate with a stronger consistency guarantee than general application data, or that both regions independently re-check revocation status against a source of truth rather than relying solely on replicated state that could lag.
Worked example
An active-active application replicates its object storage and database across two regions. The replication role, initially configured with write access to the entire destination bucket rather than the specific prefix replication actually populates, is scoped down to exactly that prefix, closing the gap where a compromise of this one role could otherwise write anywhere in the destination bucket, not just where legitimate replicated data lands. Each region's database holds its own KMS key, with the replication process explicitly re-encrypting data under the destination region's key on arrival, rather than the destination trusting or holding a copy of the source region's key. A security-relevant example of threat 5: a user's access is revoked in the primary region at a specific moment; because access-control state is treated with a stronger, synchronous consistency requirement (rather than the same eventually-consistent replication used for general application data), the secondary region's own access check reflects the revocation within seconds, not whatever the general data-replication lag would otherwise have been, closing the specific window where a revoked user might otherwise retain access in the secondary region briefly after being cut off from the primary.
Trade-offs and pitfalls
- The replication identity's scrutiny needs to be disproportionate to how routine it might otherwise seem, since it is a genuinely new class of privileged identity a single-region architecture never has to reason about at all, and teams that apply the same, ordinary IAM (identity and access management) review rigor to it as any other service role under-invest relative to what its actual blast radius warrants.
- Treating security-relevant state (access revocations) with the same eventual-consistency replication guarantee as general application data is the specific, easy-to-miss gap the worked example's fifth threat addresses, since it is tempting to assume "replication is replication" and apply one uniform consistency model everywhere, when a security-critical state change genuinely needs a stronger guarantee than a routine data update does.
- Assuming the cloud provider's internal backbone is inherently secure for replication traffic, without explicitly verifying and enforcing encryption in transit for the specific replication mechanism, is a common and consequential assumption to leave unverified; "the provider's network is private" and "this specific replication traffic is encrypted end to end" are related but not the same guarantee, and only the second one is the actual control this threat model depends on.
- Per-region key isolation with a re-encryption step at the replication boundary adds real operational complexity (the re-encryption process itself becomes a component that needs its own monitoring and failure handling) compared to simply replicating a shared key, and that added complexity is precisely the cost of the stronger regional-isolation guarantee, not an avoidable inefficiency.
You're asked to implement automated misconfiguration detection and reporting for a multi-account AWS environment. Propose an architecture that uses native services (AWS Config, Security Hub, GuardDuty), IaC scanning (Checkov, tfsec), and policy engines (OPA/Sentinel). Explain how findings flow to a central dashboard, how you would prioritize issues, and strategies for automated remediation versus human-reviewed remediation.
Sample Answer
Direct answer
Automated misconfiguration detection for a multi-account AWS environment layers three native services and two external tool categories into one pipeline, AWS Config and Security Hub for continuous configuration and finding aggregation, GuardDuty for behavioral threat detection, IaC (infrastructure-as-code) scanning (Checkov/tfsec) for pre-deployment prevention, and policy engines (OPA/Sentinel) for plan-time enforcement, feeding one central dashboard; the design decision that matters most is not which tools to use, all of these are reasonably standard choices, it is which findings get automated remediation versus which get routed to a human, since that boundary determines whether the system is trustworthy or dangerous.
Structured elaboration
Native service roles. AWS Config continuously evaluates every resource's configuration against managed and custom rules across every account, the primary source of configuration-drift and misconfiguration findings. Security Hub aggregates findings from Config, GuardDuty, and any third-party integrated tool into one normalized finding format and one dashboard, serving as the central aggregation point rather than each source having its own separate view. GuardDuty adds behavioral, threat-intelligence-driven detection (an unusual API call pattern, a known-malicious IP contacted) that configuration-based Config rules structurally cannot provide, since Config checks state, not behavior over time.
IaC scanning role. Checkov or tfsec run in the CI (continuous integration) pipeline against every infrastructure-as-code change before it merges, catching a misconfiguration before it is ever deployed, the cheapest point in the whole pipeline to catch a finding, since it requires no live cloud resource to exist yet.
Policy engine role. OPA/Sentinel evaluates the fully-resolved terraform plan output (or an equivalent for another IaC tool) at plan time, catching a misconfiguration that only resolves once variables and modules are fully computed, which static IaC scanning alone can miss; this is a preventive gate specifically for changes that go through the IaC pipeline, distinct from Config's detective, always-on coverage of the account regardless of how a resource got there.
How findings flow to a central dashboard
Every source (IaC scanning, policy-engine plan-time checks, Config, GuardDuty) emits findings in, or normalized into, the AWS Security Finding Format, feeding into Security Hub, which serves as Aggregation account's own delegated-administrator view across every member account in the AWS Organization, consistent with the delegated-administrator pattern used for centralized security tooling throughout this domain. From Security Hub, findings route into the organization's existing ticketing system (via an EventBridge rule triggering a Lambda function or a native integration), so the dashboard is not the only place a finding lives, it also becomes tracked, assigned work in the tool the responsible team already uses daily.
Prioritization
Findings are scored by a combination of severity (the source tool's own rating), exploitability (is the affected resource internet-reachable right now), and business context (is the account tagged as production, does the resource hold sensitive data), rather than a flat severity list that would treat a critical finding on an isolated development resource the same as an identical finding on an internet-facing production one.
Automated remediation versus human-reviewed remediation
Automated remediation is reserved for a narrow, explicitly reviewed list of finding types where the fix is unambiguous and reversible (re-enabling S3 Block Public Access, closing a security-group rule matching a known-bad pattern with no legitimate business justification ever recorded for it), triggered directly from a Config rule's non-compliant state via an automated remediation action (a Systems Manager Automation document, or an equivalent), with the remediation action itself logged as its own auditable event. Everything else routes to human review: a finding whose "correct" fix depends on context the automated system cannot evaluate (an unusually broad but potentially legitimate permission grant, a resource whose configuration might be intentional for a specific business reason) becomes a ticket with a severity-based service-level agreement (SLA), not an automatic action, since auto-remediating a context-dependent finding risks breaking a legitimate configuration the automated system had no way to distinguish from a genuine misconfiguration.
Worked example
A developer's Terraform pull request adding a new S3 bucket without Block Public Access enabled is caught by Checkov at the IaC-scanning stage, blocking merge before any resource is created, the cheapest possible catch. A separate, unrelated change made directly through the console (bypassing IaC entirely) opens a security-group rule to 0.0.0.0/0 on port 22; AWS Config's continuous evaluation flags this within its next scheduled evaluation cycle, and because this exact pattern (SSH open to the world, no recorded business justification) is on the narrow auto-remediation list, an automated remediation action reverts the rule within minutes, logging the action and notifying the resource's owning team after the fact. A third finding, a database security group permitting inbound access from a broader internal CIDR range than the organization's general policy prefers, does not match any auto-remediation pattern (the "correct" fix depends on whether a specific application dependency actually needs that broader range), so it routes to a ticket with a 7-day SLA for the owning team to review and either narrow the rule or document the justification.
Trade-offs and pitfalls
- The auto-remediation list is the single highest-stakes design decision in this architecture, and it needs to stay narrow and under continuous review, not grow opportunistically every time a new "obviously safe" pattern is proposed; the worked example's SSH-open-to-the-world case is genuinely unambiguous, but a broader or more context-dependent pattern added to the same list without the same scrutiny risks an automated action breaking a legitimate configuration.
- GuardDuty's behavioral detection and Config's configuration-state detection catch fundamentally different things, and a design that treats them as redundant (or worse, only implements one) misses half of what this layered approach is built to catch; Config would never flag an unusual API call pattern, and GuardDuty would never flag a static, unchanging misconfiguration that was simply never actually exploited.
- IaC scanning and Config together still leave a real gap: a change made entirely outside the IaC pipeline, caught only by Config's own continuous, out-of-band evaluation, not prevented at merge time. The worked example's console-made security-group change demonstrates this directly; the design's real strength is that Config's detective coverage exists specifically because IaC scanning's preventive coverage cannot see everything.
- Routing every finding to Security Hub and then to a ticketing system only delivers real value if the ticket routing correctly identifies the owning team via resource tagging; a finding routed to the wrong team, or to no team at all because tagging was incomplete, sits unactioned regardless of how well the detection and aggregation layers themselves are working.
Compare security and operational trade-offs between using a managed database service (e.g., Amazon RDS) and running a self-managed database on cloud VMs for a regulated workload. Focus on patching, encryption, auditability, network isolation, and incident response.
Sample Answer
Direct answer
For a regulated workload, a managed database (such as Amazon RDS) trades some operational control for a materially smaller and more consistently maintained security surface, since the provider absorbs patching and much of the encryption and network-isolation configuration into a well-tested default path; a self-managed database on cloud virtual machines gives full control at the cost of the team having to build and sustain every one of those controls themselves, correctly, indefinitely. For most regulated workloads the managed option is the safer default, but "safer" is not "risk-free," and each of the five named dimensions has a real trade-off, not just a clean win for the managed side.
Structured elaboration
| Dimension | Managed (RDS) | Self-managed (VMs) |
|---|---|---|
| Patching | Engine and underlying OS patches are applied automatically within a configurable maintenance window; consistent and low-effort, but the window's timing may not perfectly align with a regulated workload's own change-control process | Full control over exactly when and how a patch is applied and tested, which matters if a regulated environment requires patches to pass a formal change-approval process before applying; the real cost is that this control depends entirely on the team's own discipline to actually apply patches promptly, and a missed patch cycle is a common self-managed failure mode |
| Encryption | At-rest encryption is a configuration flag backed by the provider's key management service (KMS), and in-transit encryption uses well-tested, provider-maintained Transport Layer Security (TLS) configuration; less flexibility to use a non-standard encryption scheme a specific regulation might require | Full control over the encryption implementation and key management approach, useful if a regulation requires a specific certified module or a key-management pattern the managed offering does not support; the cost is that the team is now responsible for correctly implementing and maintaining that encryption themselves, a place self-managed deployments have historically gotten wrong |
| Auditability | Provider-native audit logging (database activity streams, or an equivalent) integrates directly with the cloud's centralized logging and is switched on by a configuration flag, with the provider responsible for the logging pipeline's own integrity | Full control over what is logged and how, which can be tailored precisely to an auditor's specific requirement; the cost is that the team has to build, secure, and maintain the logging pipeline itself, including protecting the logs from tampering by someone with root access to the same host being audited |
| Network isolation | Managed database instances are provisioned inside the customer's own Virtual Private Cloud (VPC) and controlled by the same security-group and subnet model as any other resource, but the underlying management-plane access (how the provider's own operators reach the instance for maintenance) is outside the customer's direct visibility | The team fully controls every layer of network isolation, including exactly what management access exists to the host, since there is no provider-operated management plane at all; the cost is that the team must build and operate every layer of that isolation correctly themselves, including host-level firewalling most self-managed deployments under-invest in |
| Incident response | The provider's control-plane incident response (an infrastructure-level event) is the provider's responsibility; the customer's own database-level incident response (a suspicious query pattern, a credential compromise) is unaffected by which model is used, since that responsibility never moved | The team owns incident response at every layer, including host-level forensics that a managed service's abstraction would not even expose access to; this can be an advantage for the deepest possible investigation, but only if the team has actually built the capability to do that host-level forensics in advance |
Worked example
A healthcare company evaluates hosting patient-record data subject to strict regulatory controls. Choosing RDS: the provider handles OS and engine patching (removing "was the OS patched" from the team's own audit burden), at-rest encryption is a KMS-backed configuration flag, and database activity logging streams directly to the company's centralized logging account. The team's actual security work narrows to configuring network isolation correctly (private subnet, no public endpoint, security group scoped to the application tier), managing IAM-based database authentication instead of long-lived passwords, and reviewing the provider's own compliance attestations for the control-plane portion of the shared responsibility line. Choosing self-managed on virtual machines instead: the same team would additionally need to build and operate patch management, implement and validate encryption-at-rest correctly (a task with a real history of being done wrong: unencrypted volumes, or encryption enabled but with keys stored alongside the data), stand up and secure a logging pipeline resistant to tampering by anyone with host access, and build host-level network isolation and incident-response tooling from nothing. For a team without deep, dedicated database-operations staffing, the self-managed path meaningfully increases the number of places a regulated control can silently fail.
Trade-offs and pitfalls
- "Managed" reduces the number of things the team must get right, but does not reduce the team's own responsibility to zero on any of these five dimensions. Network isolation and access-policy correctness remain entirely the customer's job even with RDS; a team that assumes "managed" means "the provider handles security" will still fail an audit on exactly the controls that never moved.
- Self-managed is the right choice in a narrow but real set of cases: a specific regulatory or contractual requirement for a non-standard encryption module, a database engine or version the managed offering does not support, or a genuine need for host-level forensic access the abstraction removes. Choosing self-managed for general "more control is always better" reasoning, without one of these specific drivers, usually just adds operational burden without a corresponding security benefit.
- The patching dimension has a real tension for regulated environments that require formal change approval before any patch. RDS's automated patching window can conflict with that process; the mitigating pattern is to use RDS's ability to defer non-critical patches to a controlled window while still keeping critical security patches on the provider's faster cycle, rather than disabling automated patching entirely to preserve change control.
- Auditability is the dimension most often underestimated on the self-managed side. Building a tamper-resistant audit log when the same host has root-level access available to potentially compromise it is a genuinely hard problem (typically requiring shipping logs off-host immediately, to a destination the database host itself cannot modify); a self-managed design that logs only to local disk has not actually solved this, even if logging is technically switched on.
Design a secure network segmentation strategy for a multi-account cloud environment that hosts public web front-ends, internal application services, and sensitive databases. Explain the roles and differences between security groups (or NSGs), network ACLs, cloud firewalls, and centralized WAF/proxy. Describe how you would use subnetting, route tables, transit gateways, and flow logs to prevent lateral movement and support incident investigations.
Sample Answer
Direct answer
A multi-account segmentation strategy for a public web front-end, internal application services, and sensitive databases needs two things working together: account-level separation (so a compromise cannot cross the account boundary through identity and access management (IAM) alone) and, within that, a consistent set of network-layer controls, security groups (or Network Security Groups (NSGs)), network access control lists (NACLs), a cloud firewall, and a centralized web application firewall (WAF) or proxy, each doing a genuinely different job so that lateral movement is stopped at multiple independent points and an incident investigation has the flow-log evidence to reconstruct exactly what happened.
Structured elaboration
Roles and differences between the four control types.
| Control | Scope | Statefulness | Primary role in this design |
|---|---|---|---|
| Security groups / NSGs | Per-instance or per-resource | Stateful | The fine-grained east-west control: which specific service may reach which other specific service, referenced by group ID rather than IP range |
| Network ACLs | Per-subnet | Stateless | The coarse, subnet-wide guardrail: broad allow/deny by Classless Inter-Domain Routing (CIDR) range at the network edge of each tier |
| Cloud firewall (a managed network firewall service, or an equivalent inspection appliance) | Per-VPC (Virtual Private Cloud) or centralized in a hub | Typically stateful, content-aware for some offerings | Deep inspection of traffic crossing account or region boundaries, and enforcement of organization-wide egress policy (blocking known-bad destinations, for instance) that individual account teams should not need to reimplement themselves |
| Centralized WAF/proxy | Fronting the public tier specifically | Application-layer aware | The only layer inspecting actual HTTP request content, catching an application-layer attack (injection, malformed payload) the other three structurally cannot see |
Subnetting, route tables, and transit gateways for lateral-movement prevention. Each trust tier, public web front-end, internal application services, sensitive databases, sits in its own subnet type, replicated within each workload account; the database tier's subnet has no default route to the internet at all, a routing-layer guarantee independent of any security-group configuration. Cross-account connectivity (an application-tier service in one account legitimately needing to reach a shared service in another account) routes through a transit gateway, which becomes the single, auditable chokepoint for all inter-account traffic, rather than direct account-to-account VPC peering relationships that would each need to be individually tracked and reviewed as the number of accounts grows.
Flow logs for lateral-movement prevention and incident investigation. Virtual Private Cloud (VPC) flow logs, enabled on every subnet across every account, capture connection-level metadata (source, destination, port, bytes, accept/reject) and ship continuously to a centralized, separate log-archive account that the originating accounts themselves have no delete access to. This serves two distinct purposes: as a near-real-time input to lateral-movement detection (an unexpected flow between two accounts that the transit gateway's routing should not have permitted, or an unusual volume between the application and database tiers), and as the forensic record an incident investigation depends on after the fact, one that remains trustworthy even if the account where the incident occurred is itself compromised.
Worked example
A compromised instance in the public web-tier account attempts to reach the sensitive-database account directly. Because the two accounts have no direct peering relationship, only a transit-gateway attachment each with its own explicit route table, the attempted connection has no path to the database account at all, it is rejected at the routing layer before any security group or NACL is even evaluated. The attacker's activity is nonetheless visible: the attempted connection (and its rejection) appears in the web-tier account's own flow logs, already streaming continuously to the centralized log-archive account, giving the incident-response team a record of the lateral-movement attempt independent of what the attacker does next inside the still-compromised web-tier account, including any attempt to disable that account's own local logging configuration.
Trade-offs and pitfalls
- Direct VPC peering between accounts, added ad hoc as specific integration needs arise, is the most common way this design's transit-gateway chokepoint benefit erodes over time. Each individual peering relationship might be reasonably justified on its own, but the accumulated effect is a set of undocumented, hard-to-audit direct paths that bypass the single auditable chokepoint the transit-gateway design was built around; new cross-account connectivity needs should route through the transit gateway by policy, not by convenience.
- The cloud firewall and the centralized WAF address different layers and are easy to conflate as redundant. The cloud firewall inspects and enforces policy on network-layer traffic crossing account or region boundaries; the WAF inspects application-layer request content at the public tier specifically. Treating one as covering the other's job leaves a real gap, an application-layer attack the cloud firewall cannot see, or an unauthorized cross-account network flow the WAF, sitting only at the public edge, never observes.
- Flow logs shipped to a centralized account only deliver their forensic value if that centralized account's own logs cannot be deleted or modified by the accounts that generated them, the same immutability principle that makes centralized logging trustworthy elsewhere in multi-account design; a log-archive account whose retention policy permits deletion by a sufficiently privileged principal in the source account undermines the worked example's core claim that the investigation remains possible even if the source account is compromised.
- A common wrong turn is treating account-level separation alone as sufficient and under-investing in the network-layer controls within each account, on the reasoning that "the account boundary already protects us." The account boundary limits IAM-based blast radius specifically; it does nothing to stop lateral movement between the application and database tiers within the same account if the subnet-level and instance-level controls inside that account are weak.
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.