Skill 4.3.6: Create VPCs, subnets, and security groups to securely isolate ML and AI systems
| Question | Answer & Explanation |
|---|---|
| ### Question 1 - SageMaker Private Subnet S3 Access An ML engineering team is building a SageMaker training pipeline that processes highly confidential patient data. Compliance rules mandate that all compute resources must reside in a private subnet with no direct or indirect internet access (no NAT Gateway). The SageMaker notebook instances and training jobs need to download training scripts and read datasets from an Amazon S3 bucket located in the same AWS Region. Which solution meets these requirements with the least operational overhead while maintaining strict network isolation? (Select ONE) - A) Configure a VPC Gateway Endpoint for Amazon S3. - B) Attach an Internet Gateway to the VPC and use security groups to block all outbound internet traffic except S3. - C) Set up an AWS Site-to-Site VPN to route S3 traffic through the corporate data center. - D) Deploy a NAT Gateway in the public subnet and route S3 traffic through it. |
Correct Answer: A Correct Option Analysis: - A is Correct: A VPC Gateway Endpoint for Amazon S3 allows resources in a private subnet to access S3 securely over the AWS private network backbone without requiring an Internet Gateway or NAT Gateway. It provides the lowest operational overhead and maintains strict network isolation. Distractor Analysis: - B is Incorrect: Attaching an Internet Gateway violates the compliance requirement of having no direct internet access, and using security groups to manage S3 traffic is not feasible as S3 is a public service. - C is Incorrect: Routing S3 traffic through a corporate data center via a VPN introduces unnecessary operational complexity, higher latency, and increased costs compared to a VPC Endpoint. - D is Incorrect: Deploying a NAT Gateway violates the strict compliance rule of having no indirect internet access, and it incurs ongoing operational costs. > Key Takeaway: VPC Gateway Endpoints are the standard, low-overhead solution for private subnet access to Amazon S3 and DynamoDB without internet connectivity. |
| ### Question 2 - Isolating a SageMaker Inference Endpoint A retail company is deploying a SageMaker real-time inference endpoint to serve product recommendation models. The endpoint must be invoked by an internal application running on Amazon EC2 instances within the same VPC. The security team has mandated that the SageMaker endpoint must not be accessible from the public internet under any circumstances. Which TWO steps should the ML engineer take to meet these security requirements? (Select TWO) - A) Deploy the SageMaker endpoint in VPC mode by specifying private subnets. - B) Configure a security group for the SageMaker endpoint that only allows inbound traffic on port 443 from the EC2 instances' security group. - C) Attach an Internet Gateway to the VPC and restrict inbound traffic using Network ACLs. - D) Create an Application Load Balancer in a public subnet to proxy traffic to the SageMaker endpoint. - E) Use SageMaker notebook instances to invoke the endpoint directly over the public SageMaker API. |
Correct Answers: A and B Correct Options Analysis: - A is Correct: Deploying the endpoint in VPC mode (using private subnets) ensures the endpoint does not get a public IP address and is not routable from the internet. - B is Correct: Configuring the endpoint's security group to only accept traffic from the EC2 application's security group enforces strict least-privilege network access at the instance level. Distractor Analysis: - C is Incorrect: Attaching an Internet Gateway exposes the VPC to the public internet, which violates the security mandate, even with Network ACLs. - D is Incorrect: Placing an ALB in a public subnet exposes the endpoint to the internet, directly violating the requirements. - E is Incorrect: Invoking the endpoint over the public SageMaker API contradicts the requirement to keep the endpoint off the public internet. > Key Takeaway: To securely host a SageMaker endpoint, deploy it in private subnets (VPC mode) and use security groups to restrict inbound traffic only to known, internal callers. |
| ### Question 3 - Security Group Configuration for EFA Distributed Training A deep learning research team is training a massive Large Language Model (LLM) on SageMaker using distributed training across multiple GPU instances with Elastic Fabric Adapter (EFA) enabled. The training job is launched in a custom VPC. The instances need to communicate with each other efficiently for gradient updates, but the current security group configuration is blocking the necessary EFA traffic, causing the job to hang. Which action will enable distributed training while maintaining least privilege network access? (Select ONE) - A) Add an inbound rule to the security group allowing all traffic from the security group itself. - B) Add an inbound rule to the security group allowing TCP traffic on port 443 from 0.0.0.0/0. - C) Attach an Internet Gateway to the subnets to allow unrestricted inter-node communication. - D) Configure a VPC peering connection between the training subnets. |
Correct Answer: A Correct Option Analysis: - A is Correct: For distributed training with EFA, instances must communicate with each other. The standard AWS best practice for inter-node communication within a tightly coupled cluster is to allow all inbound traffic from the same security group. This ensures only instances within the same cluster can communicate, adhering to least privilege. Distractor Analysis: - B is Incorrect: Opening port 443 to the entire internet (0.0.0.0/0) is a massive security violation and does not facilitate the specific EFA protocol communication required. - C is Incorrect: Attaching an Internet Gateway does not resolve inter-node communication issues within a VPC and exposes the subnet to the internet. - D is Incorrect: VPC peering is used to connect different VPCs, not to facilitate communication between instances in the same VPC/subnets. > Key Takeaway: When configuring Security Groups for tightly coupled distributed ML training (like EFA), reference the security group itself in the inbound rules to allow seamless inter-node communication without exposing ports to the outside. |
| ### Question 4 - SageMaker Studio in VPC-Only Mode An enterprise data science team uses Amazon SageMaker Studio for developing ML models. Due to strict data governance policies, the Studio environment must be completely isolated from the public internet. The team needs to ensure that Studio can communicate with required AWS services like SageMaker APIs and Amazon S3 without traversing the internet. Which TWO steps should be taken to create the most secure and operationally efficient architecture? (Select TWO) - A) Enable VPC-only mode for the SageMaker Studio domain. - B) Create VPC Interface Endpoints for SageMaker API, SageMaker Runtime, and SageMaker Notebooks. - C) Deploy Studio in public subnets and use Security Groups to block all outbound internet traffic. - D) Use a NAT Gateway to route all SageMaker Studio outbound traffic to the AWS private backbone. - E) Configure an AWS Direct Connect link to route Studio traffic to AWS services. |
Correct Answers: A and B Correct Options Analysis: - A is Correct: Enabling VPC-only mode forces SageMaker Studio to route all traffic through your VPC, preventing it from accessing the public internet directly. - B is Correct: Creating VPC Interface Endpoints (AWS PrivateLink) for the specific SageMaker APIs and S3 (Gateway Endpoint) allows the isolated Studio environment to securely communicate with these required AWS services over the private AWS network. Distractor Analysis: - C is Incorrect: Deploying in public subnets violates the requirement for complete isolation from the public internet. - D is Incorrect: A NAT Gateway routes traffic over the public internet, which violates the data governance policy. Also, AWS does not guarantee NAT traffic stays on the private backbone. - E is Incorrect: Direct Connect connects an on-premises network to AWS; it is not the solution for isolating an already AWS-hosted Studio environment from the public internet. > Key Takeaway: VPC-only mode combined with VPC Interface Endpoints is the standard architecture for completely internet-isolated SageMaker Studio environments. |
| ### Question 5 - Amazon Bedrock Private Access A financial services company is building a generative AI application using Amazon Bedrock. The application runs on Amazon ECS tasks within a private subnet. The company's security policy strictly prohibits any AWS service API calls from traversing the public internet. The ECS tasks must invoke the Bedrock InvokeModel API securely.How can the ML engineer configure the network to meet the security requirements? (Select ONE) - A) Create a VPC Gateway Endpoint for Amazon Bedrock. - B) Create a VPC Interface Endpoint for Amazon Bedrock using AWS PrivateLink. - C) Configure a NAT Gateway in the public subnet to route traffic to the Bedrock API. - D) Attach an Internet Gateway to the VPC and allow outbound HTTPS traffic to the Bedrock API. |
Correct Answer: B Correct Option Analysis: - B is Correct: Amazon Bedrock supports AWS PrivateLink. Creating a VPC Interface Endpoint allows the ECS tasks in the private subnet to invoke the Bedrock API entirely over the private AWS network, satisfying the strict no-internet-traversal policy. Distractor Analysis: - A is Incorrect: VPC Gateway Endpoints are only supported for Amazon S3 and DynamoDB, not for Amazon Bedrock. Bedrock requires an Interface Endpoint. - C is Incorrect: A NAT Gateway routes traffic over the public internet, violating the security policy. - D is Incorrect: Attaching an Internet Gateway exposes the VPC to the internet, directly violating the policy of prohibiting API calls from traversing the public internet. > Key Takeaway: To securely access Amazon Bedrock from a private subnet without internet access, use a VPC Interface Endpoint (AWS PrivateLink). |
| ### Question 6 - Custom Container Image in Private Subnet A machine learning team is running a SageMaker Processing job in a private subnet with no internet access. The processing container uses a custom Docker image stored in Amazon ECR within the same AWS account. The job fails to start, and the CloudWatch logs indicate an error pulling the Docker image. Which action will resolve the issue with the least operational overhead while maintaining network isolation? (Select ONE) - A) Create a VPC Interface Endpoint for Amazon ECR. - B) Move the processing job to a public subnet with an Internet Gateway. - C) Pre-load the Docker image onto the SageMaker instances using a lifecycle configuration. - D) Create a VPC Gateway Endpoint for Amazon S3 to store the Docker images. |
Correct Answer: A Correct Option Analysis: - A is Correct: Amazon ECR supports AWS PrivateLink. Creating a VPC Interface Endpoint for ECR allows the SageMaker Processing job in the private subnet to securely pull the Docker image over the private AWS network without requiring internet access. Distractor Analysis: - B is Incorrect: Moving the job to a public subnet violates the requirement to maintain network isolation and introduces security risks. - C is Incorrect: Pre-loading images via lifecycle configurations is not a standard or supported practice for SageMaker Processing jobs and introduces high operational overhead. - D is Incorrect: ECR stores Docker images, but it is accessed via API, not via S3 Gateway Endpoints (unless utilizing a specific private registry pull-through cache, but standard ECR requires Interface Endpoints). > Key Takeaway: When running SageMaker jobs in private subnets with custom containers, you must configure VPC Interface Endpoints for Amazon ECR (and CloudWatch) to allow the service to pull the image without internet access. |
| ### Question 7 - Accessing External APIs from SageMaker Training An ML engineer is training a model that requires augmenting the dataset with real-time currency exchange rates fetched from a third-party, internet-facing API. The training job runs in a private subnet in a VPC. The VPC currently has VPC endpoints configured for SageMaker and S3, but no route to the internet. Which solution provides the training job access to the third-party API with the least operational overhead while keeping the subnet private? (Select ONE) - A) Configure a NAT Gateway in a public subnet and update the private subnet route table to route internet-bound traffic to the NAT Gateway. - B) Use AWS Lambda in a public subnet to fetch the data periodically and write it to S3 before starting the SageMaker training job. - C) Create a VPC Interface Endpoint for the third-party API using AWS PrivateLink. - D) Set up an AWS Site-to-Site VPN to the third-party API provider's network. |
Correct Answer: A Correct Option Analysis: - A is Correct: To allow resources in a private subnet to access the public internet (for third-party APIs) while remaining private (not accepting inbound connections), deploying a NAT Gateway in a public subnet is the standard, lowest operational overhead AWS architecture. Distractor Analysis: - B is Incorrect: While this works, it requires writing custom orchestration code, managing Lambda functions, and altering the training pipeline, introducing significant operational overhead. - C is Incorrect: AWS PrivateLink (VPC Interface Endpoints) can only be used for AWS services or services explicitly hosted by a provider that supports PrivateLink. A standard third-party internet API cannot be accessed this way. - D is Incorrect: Setting up a VPN to a third-party is extremely complex, high-overhead, and generally unsupported by public API providers. > Key Takeaway: If an isolated ML workload requires access to external public internet APIs, a NAT Gateway is the standard AWS pattern to provide outbound-only internet access. |
| ### Question 8 - Security Groups for ALB to SageMaker Endpoint A healthcare startup is hosting a SageMaker real-time endpoint inside a VPC to process patient records. The endpoint is deployed in private subnets. An Application Load Balancer (ALB) is placed in public subnets to receive traffic from users over HTTPS and forward it to the SageMaker endpoint. The endpoint must only accept traffic originating from the ALB. How should the security groups be configured to ensure least privilege access? (Select ONE) - A) Configure the endpoint's security group to allow inbound TCP port 443 from the ALB's security group. - B) Configure the endpoint's security group to allow inbound TCP port 443 from the ALB's private IP addresses. - C) Configure the ALB's security group to allow outbound traffic to the SageMaker endpoint's security group. - D) Configure the endpoint's security group to allow all inbound traffic from the VPC CIDR block. |
Correct Answer: A Correct Option Analysis: - A is Correct: The most secure way to restrict traffic between AWS resources is by referencing security groups. The SageMaker endpoint's security group should allow inbound traffic on the required port (443) specifically from the ALB's security group. This guarantees only the ALB can reach the endpoint. Distractor Analysis: - B is Incorrect: Referencing IP addresses is less secure and harder to maintain than referencing security groups, especially in auto-scaling or dynamic environments where ALB IPs can change. - C is Incorrect: While the ALB's security group must allow outbound traffic, the primary security enforcement to ensure the endpoint only accepts ALB traffic must be on the endpoint's security group inbound rules. - D is Incorrect: Allowing traffic from the entire VPC CIDR block is overly permissive and violates the principle of least privilege. > Key Takeaway: Always use security group references (rather than IP CIDR blocks) for AWS resource-to-resource communication to maintain least privilege and dynamic scalability. |
| ### Question 9 - SageMaker HyperPod Network Isolation A research institute is setting up an Amazon SageMaker HyperPod cluster for training foundation models. The cluster nodes are distributed across multiple Availability Zones to ensure high availability. The network must be configured to allow seamless internode communication while keeping the cluster completely isolated from the public internet. Which TWO steps are required to create the most secure network isolation with high availability? (Select TWO) - A) Deploy the cluster nodes in private subnets across multiple Availability Zones. - B) Configure Security Groups to allow all necessary internode traffic (e.g., SSH, EFA) from within the same security group. - C) Deploy the cluster nodes in public subnets to ensure fast EFA networking. - D) Attach an Internet Gateway to the VPC to allow the cluster to download dependencies. - E) Use a single public subnet for the orchestration node and private subnets for compute nodes. |
Correct Answers: A and B Correct Options Analysis: - A is Correct: Deploying nodes in private subnets across multiple AZs ensures the cluster is not accessible from the internet and provides high availability. - B is Correct: Configuring the security group to allow necessary traffic (like SSH for management and all ports for EFA) from the security group itself ensures nodes can communicate for distributed training while blocking external access. Distractor Analysis: - C is Incorrect: Public subnets expose the nodes to the internet, violating the isolation requirement. EFA works perfectly well in private subnets. - D is Incorrect: An Internet Gateway violates the complete isolation requirement. Dependencies should be fetched via VPC Endpoints or pre-baked into the AMI. - E is Incorrect: Placing the orchestration node in a public subnet introduces a potential attack vector and violates the strict isolation mandate. > Key Takeaway: High availability and network isolation for ML clusters (like SageMaker HyperPod) are achieved by utilizing multi-AZ private subnets and strictly controlled inter-node security group rules. |
| ### Question 10 - VPC Endpoints for Bedrock Knowledge Bases An enterprise is building a RAG application using Amazon Bedrock Knowledge Bases. The source documents are in Amazon S3, and the vector store is an Amazon OpenSearch Serverless collection deployed in a VPC. The Bedrock Knowledge Base ingestion process must not traverse the public internet. Which network configuration meets these network isolation requirements? (Select ONE) - A) Create VPC Interface Endpoints for Amazon Bedrock and Amazon S3, and ensure the OpenSearch Serverless collection is deployed within the VPC. - B) Deploy a NAT Gateway to route OpenSearch Serverless traffic through a public IP address. - C) Configure an Internet Gateway and use Network ACLs to block all non-Bedrock traffic. - D) Use a VPN connection from the VPC to the Bedrock service endpoint. |
Correct Answer: A Correct Option Analysis: - A is Correct: To ensure the entire Bedrock Knowledge Base pipeline (S3 to Bedrock, Bedrock to Embeddings, Bedrock to OpenSearch) is private, you must use VPC Interface Endpoints (PrivateLink) for Bedrock and S3, and host the OpenSearch Serverless collection within the VPC using VPC endpoints for OpenSearch. Distractor Analysis: - B is Incorrect: A NAT Gateway routes traffic over the public internet, violating the network isolation requirement. - C is Incorrect: An Internet Gateway exposes the VPC to the internet. NACLs cannot distinguish Bedrock traffic from other HTTPS traffic reliably enough for strict isolation. - D is Incorrect: VPNs are used to connect on-premises networks to AWS, not to connect an AWS VPC to an AWS service like Bedrock. > Key Takeaway: Fully private RAG ingestion pipelines with Bedrock require VPC Interface Endpoints for all AWS services involved (Bedrock, S3, OpenSearch). |