Cloud Networking and VPC Design Questions
Designing networks inside a cloud provider: VPC/VNet topology, subnets, route tables, gateways, NAT, and peering, plus private connectivity through VPC endpoints and cloud load balancers. Covers segmentation, security groups and network ACLs, hybrid connectivity to on-premises data centers over VPN or dedicated links like Direct Connect and ExpressRoute, IP address planning across many VPCs and accounts, and how cloud network design differs from traditional data-center networking.
Explain AWS VPC endpoints and the differences between Interface Endpoints (PrivateLink) and Gateway Endpoints. Provide concrete examples: how would you grant private access to S3 and to a private API in your VPC without exposing traffic to the public internet?
Sample Answer
Direct answer
A VPC endpoint lets resources inside a Virtual Private Cloud (VPC) reach a supported service privately, over the provider's internal network, without the traffic ever crossing the public internet and without needing a NAT gateway or internet gateway at all. There are two kinds: a Gateway Endpoint, which works only for a small set of services (Amazon S3 and DynamoDB) and is implemented as a route-table entry with no additional cost, and an Interface Endpoint (built on AWS PrivateLink), which works for the vast majority of AWS services plus many third-party and customer-hosted services, and is implemented as an actual network interface with a private IP address inside your subnet, billed per Availability Zone-hour plus data processed.
Structured elaboration
| Dimension | Gateway Endpoint | Interface Endpoint (PrivateLink) |
|---|---|---|
| Supported services | Only S3 and DynamoDB | Most AWS services, many AWS Marketplace services, and any service a provider chooses to publish via PrivateLink, including services in your own other VPCs or accounts |
| How it works | A special target in your subnet's route table, pl-xxxx -> vpce-xxxx, that redirects traffic destined for the service's published IP ranges | An Elastic Network Interface (ENI) with a private IP address placed directly in your subnet; traffic reaches it exactly like any other resource in the subnet |
| Cost | No hourly or per-gigabyte charge from the endpoint itself | Hourly charge per Availability Zone the endpoint is deployed in, plus data processed |
| DNS | Private DNS is optional; without it, applications must use the service's endpoint-specific DNS name explicitly | Private DNS can be enabled so the service's normal public DNS name (e.g. an API's default hostname) automatically resolves to the interface endpoint's private IP inside the VPC, so no application code changes are needed |
| Reach | Limited to the VPC(s) whose route tables you add the entry to | Reachable from anywhere with network access to the ENI: the local VPC, and, with the right routing, from peered VPCs or on-premises networks over Direct Connect or VPN |
| Security control | Endpoint policy (which principals/actions are allowed through this endpoint) plus the target service's own resource policy | Endpoint policy, the target service's own policy, plus a security group directly on the ENI, giving you an extra network-layer control interface endpoints alone have |
Worked example
Private access to S3 without touching the public internet: a Gateway Endpoint. A data-processing application running in a private subnet needs to read training data from an S3 bucket. Without an endpoint, that traffic would need a NAT gateway to reach S3's public endpoint over the internet, incurring NAT data-processing charges and taking a path that leaves the provider's network. Adding an S3 Gateway Endpoint to the VPC and associating it with the private subnet's route table adds a route that sends traffic destined for S3's published IP prefix list directly to the endpoint instead of the NAT gateway, at no additional cost for the endpoint itself, and the traffic never leaves AWS's network. The bucket's own policy can then be tightened to require that requests arrive via this specific endpoint (using a condition on the endpoint's ID), which closes off the possibility of the same bucket being reached from some other, less trusted network path.
Private access to a private API in your VPC: an Interface Endpoint. A separate team owns an internal pricing API running behind a Network Load Balancer in its own VPC, and another team's application, in a different VPC, needs to call it without any public exposure and without a full VPC peering or Transit Gateway relationship (which would give broader network access than intended). The pricing team publishes their load balancer as a PrivateLink endpoint service; the consuming team creates an Interface Endpoint for that specific service in their own VPC, which places a private-IP network interface directly in their subnet. With private DNS enabled, the consuming application calls the pricing API using its normal hostname, which now silently resolves inside the VPC to that private IP instead of any public address, and the security group on the interface endpoint's network interface controls exactly which of the consumer's resources may even attempt the call. Crucially, the consuming team gets access to that one API and nothing else in the pricing team's VPC: there is no routed network path between the two VPCs at all, which is the isolation property a full peering connection would not have given them.
Trade-offs and pitfalls
The most common mistake is defaulting to an Interface Endpoint for S3 or DynamoDB out of habit, paying the per-Availability-Zone-hour charge for a case where the free Gateway Endpoint does the same job (Interface Endpoints for S3 do exist and are occasionally the right call, for example when you specifically need endpoint access from on-premises over Direct Connect or from a different VPC in a way a Gateway Endpoint cannot reach, but that is the exception, not the default). A second pitfall is enabling an Interface Endpoint but forgetting to enable its private DNS option, which leaves applications still resolving the service's public hostname to a public IP and routing out through the NAT gateway or internet gateway exactly as before, quietly defeating the entire point of adding the endpoint, since nothing is actually broken, it is just not being used. Finally, teams sometimes assume an endpoint alone is a complete security boundary and skip the endpoint policy, relying only on the target service's own resource policy; a scoped endpoint policy is what stops an over-permissioned identity from reaching services or resources it should not, even if it otherwise has valid credentials.
Design a multi-account VPC architecture for a large enterprise (50+ accounts) that needs centralized shared services (monitoring, logging, AD), workload isolation, low-latency intra-VPC connectivity, and centralized egress control. Provide a topology, recommended connectivity primitives (TGW/peering/DX), IP allocation approach, and governance controls to prevent accidental exposure.
Sample Answer
Direct answer
At 50-plus accounts, the shape that scales is a hub-and-spoke topology built on a Transit Gateway (TGW): one shared-services hub VPC (Virtual Private Cloud) holding centralized logging, monitoring, Active Directory (AD), and CI/CD (continuous integration and continuous delivery) tooling, with every workload account's VPC attached as a spoke, all inter-VPC and on-premises traffic riding the TGW instead of a mesh of point-to-point peerings. Isolation between workloads and between environments (staging versus production) is enforced with separate TGW route tables, not with separate physical topologies, and all outbound internet traffic is forced through a shared inspection point in the hub rather than being allowed to exit from each spoke independently.
Structured elaboration
Topology. A dedicated network/shared-services account owns the TGW, a hub VPC with the shared logging, monitoring, and directory services, and a Direct Connect (DX) or VPN (Virtual Private Network) attachment for on-premises connectivity. Every workload account attaches its VPC to the TGW as a spoke. Peering does not scale here: 50 VPCs peered pairwise would need up to 1,225 individual peering connections, each with its own route table entries, versus 50 single attachments to one TGW.
flowchart TB
DX[Direct Connect or VPN to on-prem] --> HUB
subgraph HUB[Shared-services account: hub VPC]
TGW[Transit Gateway]
NAT[Central NAT and egress inspection]
DNS[Shared DNS resolver]
LOG[Central logging]
CICD[Shared CI/CD tooling]
end
TGW --- SPOKE1
TGW --- SPOKE2
TGW --- SPOKE3
subgraph SPOKE1[Prod account A]
VPCA[Workload VPC]
end
subgraph SPOKE2[Prod account B]
VPCB[Workload VPC]
end
subgraph SPOKE3[Staging account]
VPCC[Workload VPC]
end
Connectivity primitives. TGW for the hub-and-spoke fabric itself (attachments per TGW default to a quota in the thousands, comfortably covering 50-plus accounts with room to grow); a Direct Connect Gateway (or a Site-to-Site VPN as a lower-committment or failover path) attached to the TGW for on-premises reach, rather than a separate virtual private gateway per VPC; VPC peering reserved only for the rare case of two spokes needing a private connection the hub shouldn't see.
IP allocation. Carve one supernet (for example 10.0.0.0/12) into fixed-size per-account blocks up front so growth never collides. A /12 splits cleanly into 512 blocks of /21 (2,048 addresses each), which comfortably covers 50-plus accounts today with headroom for hundreds more without ever having to resize an existing VPC's CIDR (Classless Inter-Domain Routing, the notation for an IP address range, like the /21 blocks above) after the fact.
Governance controls to prevent accidental exposure.
- Service control policies (SCPs) at the organizational-unit level deny the creation of internet gateways or public-facing load balancers in workload accounts, so any internet-bound path is forced through the hub's controlled egress.
- The hub is the only account that can attach a Direct Connect Gateway or manage the TGW's route tables; workload account administrators get attach permission only, via AWS Resource Access Manager (RAM), not route-table edit rights.
- Tag-enforced IP address management (IPAM), using AWS IPAM or an equivalent CIDR-tracking system, so a new account can only request a CIDR block from the pre-carved pool, never pick an arbitrary range.
- Automated drift detection (AWS Config rules or a scheduled Lambda) alerting when a spoke account's route table gains a route that bypasses the hub's inspection VPC.
Isolation angle: shared-services hub and staging-versus-production separation. The shared-services hub itself typically holds three functions worth naming explicitly: a logging sink (centralized CloudWatch Logs or an S3-based log lake that every spoke ships to, so no individual account can tamper with its own audit trail), a shared CI/CD hub (build and deploy tooling with cross-account IAM roles into each spoke, rather than duplicating pipeline infrastructure per account), and shared DNS (a Route 53 Resolver setup that every spoke inherits). Staging and production get separate TGW route tables associated with their respective spoke attachments: the production route table only propagates routes to other production spokes and the hub's shared services, and the staging route table is scoped the same way for staging, so a compromised staging workload has no route to a production spoke even though both ride the same physical TGW. Both route tables still send 0.0.0.0/0 through the same central egress-inspection VPC (typically a Gateway Load Balancer fronting a third-party or AWS Network Firewall appliance), so all outbound traffic, staging or production, gets the same inspection regardless of which environment it came from.
Worked example
Using the supernet above, 10.0.0.0/12 yields 10.0.0.0/21, 10.0.8.0/21, 10.0.16.0/21, 10.0.24.0/21, and so on, one per account, computed as 2(21−12)=512 available blocks. Account 1 (shared services) takes 10.0.0.0/21; account 2 (a production spoke) takes 10.0.8.0/21; account 3 (a staging spoke) takes 10.0.16.0/21. Because every block comes from the same never-touched allocation table, no two accounts can ever be assigned the same range even as new accounts are onboarded automatically by a script that just takes the next unused /21.
Trade-offs and pitfalls
The TGW hub becomes a single blast-radius point: a misconfigured route table there can affect every spoke at once, so changes to it need a stricter change process than changes inside any individual spoke. Centralizing egress inspection adds a real latency and throughput cost (every spoke's internet-bound packet now makes an extra hop through the inspection VPC), which is the right trade for compliance and visibility but is a genuine tax worth measuring, not assuming away. Finally, resist the temptation to let "just this one account" skip the hub and peer directly with another spoke for a special use case: every exception erodes the governance guarantee that all traffic, at least on paper, flows through a point you can audit.
Compare connectivity options for connecting on-premises data center to cloud: VPN over internet, dedicated private link (AWS Direct Connect / Azure ExpressRoute), and third-party SD-WAN. For each option describe bandwidth, latency, security, cost, and typical use-cases.
Sample Answer
Direct answer
For connecting an on-premises data center to the cloud, VPN over the internet is the cheapest and fastest to stand up but inherits the public internet's variable latency and has no cloud-provider service-level agreement (SLA) for the path outside the cloud; a dedicated private link (AWS Direct Connect or Azure ExpressRoute) gives consistent, high-bandwidth, low-latency connectivity backed by an SLA but costs more and takes longer to provision; third-party SD-WAN (software-defined wide area network) sits above either underlying transport and adds centralized policy, application-aware routing, and often automatic failover across multiple links, at the cost of another vendor and management layer. The right choice depends on what the workload actually needs: sporadic, low-volume, latency-tolerant traffic fits VPN; sustained, latency-sensitive, or compliance-bound traffic justifies a dedicated connection; and a multi-site organization managing many locations' connectivity centrally often layers SD-WAN over one or both.
Structured elaboration
| Dimension | VPN over internet | Direct Connect / ExpressRoute | Third-party SD-WAN |
|---|---|---|---|
| Bandwidth | Per-tunnel throughput is capped (roughly 1.25 Gbps per standard tunnel on AWS, up to 5 Gbps on a large-bandwidth tunnel); multiple tunnels can be aggregated with equal-cost multi-path (ECMP) routing for more | Dedicated ports from 1 Gbps up to 100 Gbps (with higher speeds available at a growing number of locations), or smaller hosted connections from a partner starting well under 1 Gbps | Depends entirely on the underlying transport it rides over (broadband, LTE/5G, or a dedicated circuit); SD-WAN itself adds no bandwidth |
| Latency | Variable, subject to internet routing and congestion ("internet weather") | Consistent and generally lower, since traffic stays on the provider's dedicated or partner backbone rather than the public internet | Depends on the underlying links; SD-WAN can steer latency-sensitive traffic onto the better-performing link in real time if more than one is available |
| Security | Encrypted (IPsec, a protocol suite that encrypts traffic between the two endpoints) by design, traveling over the public internet | Not encrypted by default (a private circuit, not automatically an encrypted tunnel); pair with MACsec (an encryption standard applied at the physical link itself) or an overlay VPN if encryption-in-transit is a requirement | Depends on configuration; most SD-WAN products layer their own encrypted overlay regardless of the underlying transport |
| Cost | Lowest: no dedicated circuit, pay for the VPN gateway and data transfer | Higher: a physical cross-connect, port-hour charges, and often a colocation or partner fee on top | Additional licensing and appliance cost on top of whatever transport it rides over |
| Provisioning time | Fast, often same-day, since it is purely a software/configuration change on both ends | Slow, commonly weeks, since it involves a physical cross-connect at a colocation facility or a partner's hosted connection process | Fast for the SD-WAN layer itself, bounded by however long the underlying transport takes to provision |
| Reliability commitment | No AWS/Azure SLA for the internet portion of the path, since neither provider controls the public internet in between | Backed by an SLA when deployed in a resilient configuration (multiple connections across multiple locations); a single connection has no SLA and is not recommended for production | Depends on the SD-WAN vendor's own SLA and on the underlying transport's SLA |
| Typical use case | Backup path, low-to-moderate traffic, development/test connectivity, or a bridge while a dedicated circuit is being provisioned | Production workloads needing predictable performance, large sustained data volumes, or a compliance requirement to avoid the public internet | Organizations with many branch sites needing centrally managed, policy-driven routing across a mix of link types |
Worked example
Migration framing. A retailer doing a lift-and-shift of its on-premises data center to the cloud initially connects over a Site-to-Site VPN to start moving non-critical workloads immediately, since the VPN can be live the same day and the migration timeline cannot wait weeks for a physical cross-connect. In parallel, they order a Direct Connect circuit at a colocation facility, which takes on the order of weeks to provision. Once Direct Connect is live, they configure Border Gateway Protocol (BGP) so the dedicated circuit is preferred for all cloud-bound traffic (achieved by advertising a shorter AS-path or a better local-preference value on the Direct Connect side) with the VPN kept active as an automatic failover path, giving the migration both a fast start and, once ready, a durable dual-path design rather than a one-time VPN that later has to be torn out and replaced. For cross-region resilience during the migration window, they also plan bandwidth headroom on both paths so a regional failover does not saturate whichever link absorbs the shifted traffic.
Cost-driven recommendation for a scheduled bulk-transfer workload. A different team runs a nightly batch job transferring a large, predictable volume of data (say, tens of terabytes) from an on-premises system to cloud storage during a fixed overnight window. Because the volume is large and the timing is predictable and recurring (not sporadic), the data-transfer economics favor Direct Connect as the primary path, sized to comfortably clear the nightly volume inside the batch window, with an IPsec VPN kept purely as a failover for the rare case the dedicated circuit is down during that window. Sizing the VPN failover path only needs to cover the batch's minimum acceptable throughput, not match Direct Connect's full capacity, since it exists to avoid a missed run, not to be the steady-state path.
Reliability comparison, concretely. An internet-path VPN carries no AWS or Azure commitment for the portion of the trip between the customer's router and the cloud provider's edge; if a transit provider somewhere on the public internet degrades, there is no SLA to invoke against the cloud provider for that. A Direct Connect connection, deployed as multiple connections terminating on separate devices across more than one physical location (the resiliency model AWS recommends for production), carries an SLA and a defined mean-time-to-repair (MTTR) commitment for the dedicated portion of the path; a single, non-redundant Direct Connect connection, by contrast, carries no SLA at all, which is a common and costly misunderstanding.
Trade-offs and pitfalls
The most common mistake is ordering a single Direct Connect connection and treating it as production-ready simply because it is "dedicated": without a second connection on a separate device, ideally at a second location, there is no SLA and no protection against a single device or facility failure, which defeats much of the point of choosing Direct Connect over VPN in the first place. A second pitfall is under-provisioning the VPN failover path's bandwidth on the theory that it will "rarely" be used, then discovering during an actual Direct Connect outage that the VPN cannot carry production traffic at an acceptable level either. Finally, teams evaluating SD-WAN sometimes expect it to fix underlying transport problems it cannot fix. SD-WAN can steer traffic intelligently across the links you give it and add centralized policy, but it does not manufacture bandwidth or eliminate the latency characteristics of a genuinely poor underlying link.
Before launching a new workload that needs to reach an internal database, a private object store, and one external SaaS API, what networking, DNS, egress, and reliability concerns would you validate, and how would you test them in staging?
Sample Answer
Direct Answer
Validate three distinct connectivity paths before launch, the internal database, the private object store, and the external SaaS (Software as a Service) API, because each has a different failure mode and a different fix. Then prove each one under actual failure, not just under a happy-path connection test, by deliberately breaking DNS, denying egress (blocking outbound traffic), and forcing a database failover in staging before trusting any of it in production.
Internal Database
Networking. Confirm the route from the new workload's subnet to the database subnet exists, and confirm the database's security group actually allows this specific new caller; a common miss is a security group still scoped to an old instance's identity that was never updated for the new workload.
DNS and reliability. Confirm the workload targets the database's durable endpoint, a cluster endpoint or a connection proxy that survives failover, rather than a specific instance's address; targeting an instance address directly means a failover breaks connectivity even though the database itself is still up. The reliability question that actually needs testing, not assuming, is what happens to in-flight connections and how quickly the client reconnects during a real failover.
Private Object Store
Networking and DNS. Confirm the VPC (Virtual Private Cloud) endpoint's route and, if scoped, its resource policy actually cover this subnet and this specific bucket. Confirm the workload is not accidentally resolving the public endpoint and routing through NAT (Network Address Translation) instead of the intended private path, which happens when an SDK's regional endpoint configuration does not match or a proxy setting overrides it.
Egress. Verify there is not also an accidental NAT or internet path available that would work today by coincidence and only reveal the private-path misconfiguration later, for example when NAT capacity is intentionally reduced for cost reasons.
External SaaS API
Egress. Confirm which NAT gateway or egress proxy this traffic will actually use, and confirm the SaaS provider's IP allowlist, many require allowlisting the caller's egress address, matches that NAT gateway's current address, not a stale address left over from a previous NAT gateway.
DNS. Confirm the API's hostname resolves consistently and is not served from a content delivery network that returns different addresses per query in a way that could break a static allowlist entry on the provider's side.
Reliability. Confirm what the workload does when the SaaS API times out or rate-limits it, retry and backoff behavior, since an external dependency's outage should degrade the new workload gracefully, not cascade into its own availability.
How to Test All of This in Staging
Confirming that each dependency connects successfully is not enough; deliberately break each one in staging and observe the actual behavior.
Block DNS temporarily. Drop or black-hole resolution for the SaaS hostname, or the whole subnet's resolver, and confirm the workload fails in an expected way, a clear timeout and an alert, rather than a silent hang or a crash loop.
Deny egress temporarily. Remove the path to the SaaS API, the NAT route, the security-group rule, or the VPC endpoint route, and confirm the workload's error handling and alerting actually fire; this catches the case where a workload silently degrades a feature instead of surfacing that the integration is down.
Exercise database failover. Trigger an actual staging failover, most managed database services support an on-demand test failover, while the workload is under light load, and measure how long reconnection genuinely takes and whether any requests are lost or duplicated. This is the only way to know the connection and retry logic is correct; reasoning about it without testing it is exactly the kind of unverified claim that does not hold up.
Worked Example
| Dependency | Primary concern | Staging fault-injection test | Pass criterion |
|---|---|---|---|
| Internal database | Security group allows the new caller; workload uses a failover-safe endpoint | Trigger an on-demand failover under light load | Workload reconnects within its own defined timeout, no data loss on idempotent operations |
| Private object store | Traffic actually uses the VPC endpoint, not NAT or a public path | Temporarily remove the NAT route, leaving only the endpoint | Requests still succeed, confirming the private path was really being used rather than silently falling back |
| External SaaS API | Correct egress address allowlisted; sane timeout and retry behavior | Deny egress to the SaaS API's address range | Workload surfaces a clear failure and alert within its timeout, rather than hanging or crash-looping |
Trade-offs and Pitfalls
Validating only that a connection succeeds and never validating what happens when it fails is the single biggest gap in most pre-launch checklists; a workload that works in a demo can still have completely unvalidated, and often terrible, failure behavior.
Allowlisting a NAT gateway's current address with an external provider and forgetting that recreating the NAT gateway, a fairly routine operational event, usually assigns a new address is a recurring, silent breakage. Prefer a stable mechanism, an explicitly associated static address preserved across recreation, or PrivateLink (a private connection straight to the provider's specific service, without routing through the public internet or a NAT gateway) to the provider where it is offered, over a one-time manual allowlist entry.
Testing database failover against a synthetic health check rather than the actual application's connection pool and retry logic misses exactly where reconnection bugs actually live.
Fault-injection testing in staging costs real time and coordination, especially triggering an actual failover, versus trusting the happy path. That cost is worth paying for dependencies the workload genuinely cannot function without, and can be lightened for optional, best-effort integrations.
Design a hardened bastion/access solution that eliminates inbound SSH from the internet, supports audit and session recording, and allows emergency access for on-call engineers. Compare options: AWS Systems Manager Session Manager, Azure Bastion, traditional bastion hosts with just-in-time (JIT) access, and third-party jump hosts. Describe IAM policies, ephemeral credentials, MFA, session logging, and a migration plan to roll out the safest option.
Sample Answer
Direct answer
Eliminate inbound SSH (Secure Shell) or RDP (Remote Desktop Protocol) entirely rather than trying to secure a bastion host that still has an open inbound port: use an agent-based, outbound-only connection broker (AWS Systems Manager Session Manager, Azure Bastion, or a comparable managed service) so the engineer authenticates through identity and access management (IAM) rather than a network path, and the target instance never has a listening port exposed to anything, including the "bastion" itself in the traditional sense.
Structured elaboration
| Option | Inbound port required | Session recording | Credential model | Emergency/on-call fit |
|---|---|---|---|---|
| AWS Systems Manager Session Manager | None (agent makes an outbound connection to the Systems Manager service) | Native: sessions can be logged to CloudWatch Logs or S3 | IAM policy grants session start on specific instances; no SSH key or password ever exists on the instance | Good: access is granted by adding an IAM policy, revocable instantly, no key distribution |
| Azure Bastion | None from the internet; Bastion is a managed PaaS (platform as a service) reachable only via the Azure portal or CLI over HTTPS | Native session logging available | Azure AD (Microsoft's identity and access management service, recently renamed Entra ID) authentication and role-based access control | Good: similarly identity-driven, no VM-level open port |
| Traditional bastion host with just-in-time (JIT) access | Yes, but only opened for a short, approved window per request | Depends on tooling layered on top (session recording usually bolted on via script or a proxy) | Often SSH keys or short-lived certificates issued per request | Workable, but the JIT approval step itself becomes a dependency during an incident |
| Third-party jump host / VPN appliance | Yes, generally always-open to authorized networks | Varies by vendor | Often a mix of shared credentials and MFA (multi-factor authentication), harder to keep fully per-user | Weakest fit here: usually the most operational overhead to keep current and audited |
IAM policies. Access is granted as an IAM policy statement scoping which instances (by tag or resource ARN, or Amazon Resource Name) a given role or user may start a session on, which replaces "who has the SSH key" with "who has the IAM permission," a model that's centrally auditable and instantly revocable by removing the policy, with no key rotation or distribution problem.
Ephemeral credentials. No long-lived SSH key ever needs to exist on the instance at all; the session broker (Systems Manager) authenticates the human via IAM and establishes the connection without a static credential ever being provisioned. This directly closes the most common real-world bastion failure mode: a leaked or never-rotated SSH private key granting standing access indefinitely.
Multi-factor authentication (MFA). Because access is gated by IAM sign-in rather than possession of a key, requiring MFA on the underlying identity (via an IAM policy condition or the organization's identity provider) applies uniformly to every session-broker connection, without needing a separate MFA integration bolted onto the bastion host itself.
Session logging. Every keystroke and output of a session can be streamed to CloudWatch Logs or an S3 bucket, giving a full audit trail per session, tied to the IAM identity that started it, which is materially stronger than a traditional bastion's SSH access log, which typically only shows that a connection happened, not what was done inside it.
Migration plan. Roll out in phases rather than a single cutover: install and validate the Systems Manager agent on a subset of instances first, grant IAM session-start permissions to a pilot group of engineers, and run the new path in parallel with the existing bastion for a defined period; once the pilot group confirms full workflow coverage (including any tooling that assumed direct SSH, like certain deployment scripts), remove inbound SSH/RDP security group rules for the migrated instances, and only then decommission the legacy bastion host itself, since removing it too early, before every workflow has an equivalent, forces engineers back to workarounds that reopen inbound access informally.
flowchart LR
Eng[On-call engineer] -->|IAM auth plus MFA| SSM[Session broker: Systems Manager Session Manager]
SSM -->|outbound-only agent connection, no open inbound port| Instance[Private EC2 instance]
SSM -->|session transcript| Log[CloudWatch Logs or S3]
SSM -->|session start and stop events| Audit[CloudTrail audit trail]
Worked example
An on-call engineer needs emergency access to a production database host at 2 a.m. With the session-broker model, they authenticate to the AWS console or CLI with their existing IAM identity (already requiring MFA), which already carries a break-glass IAM policy scoped to session-start on production instances tagged role=oncall-emergency, and start a session directly; no key to locate, no bastion IP to remember, no separate VPN client. The full session transcript lands in CloudWatch Logs automatically, and the security team's next-morning review shows exactly which commands were run, by whom, and for how long, without needing to correlate a bastion's SSH log against a separate change ticket.
Trade-offs and pitfalls
The session broker becomes a critical dependency itself: if the managed service or its agent has an outage, emergency access through that path is unavailable, so a genuine break-glass fallback (a tightly controlled, alarmed, rarely-used traditional path) is still worth keeping for that narrow case, rather than assuming the managed service is infallible. A second pitfall in migration: cutting over the humans but forgetting the automation, deployment scripts, configuration management tools, or monitoring agents that were quietly relying on direct SSH access, which breaks in ways that look unrelated to the bastion project until someone traces the failure back to the removed inbound rule.
Unlock Full Question Bank
Get access to all 49 Cloud Networking and VPC Design interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.