An enterprise has an existing workload running on Amazon EC2 instances in a private subnet of VPC A. The application on these instances must access Amazon DynamoDB and must also assume a cross-account IAM role in Account B to write data to a partner API. Currently, all outbound traffic from the private subnet is routed through a NAT Gateway to the internet. To strengthen network and identity security, a solutions architect must ensure that traffic to DynamoDB does not traverse the public internet, and the IAM role in Account B can only be assumed if the request originates from VPC A.
Which combination of actions should the solutions architect take to meet these requirements? (Select TWO.)
- Create a gateway VPC endpoint for DynamoDB in VPC A, and associate it with the route table of the private subnet.Answer
- Create an interface VPC endpoint for AWS STS in VPC A. In Account B, update the trust policy of the IAM role to allow assumption by the application's IAM principal with a condition restricting aws:sourceVpc to the VPC ID of VPC A.Answer
- CCreate an interface VPC endpoint for DynamoDB in VPC A, and associate it with a Route 53 private hosted zone to resolve DynamoDB service endpoints.
- DAttach a Service Control Policy (SCP) at the root of the AWS Organization that restricts sts:AssumeRole to the IAM role in Account B, with a condition allowing access only when the principal's VPC ID matches VPC A.
- ECreate an AWS Transit Gateway to route STS traffic directly to Account B, and configure a Customer Managed Key (CMK) policy in Account B to restrict the kms:ViaService condition to AWS STS.
Answer
Create a gateway VPC endpoint for DynamoDB in VPC A and associate it with the route table of the private subnet, and create an interface VPC endpoint for AWS STS in VPC A, updating the target IAM role's trust policy in Account B with an aws:sourceVpc condition for VPC A.
To secure the network path to DynamoDB, a gateway VPC endpoint is created and added to the private subnet's route table. This redirects DynamoDB traffic from the NAT Gateway directly to the AWS internal network. To restrict cross-account role assumption to requests originating from the VPC, an interface VPC endpoint for AWS STS must be created in VPC A. When the application calls sts:AssumeRole through this VPC endpoint, the request carries the source VPC ID. The trust policy of the role in Account B can then validate this with the aws:sourceVpc condition key, blocking any calls from outside the VPC.
Step-by-Step Solution
Key Concept
VPC endpoints allow private routing to AWS services, and interface endpoints preserve VPC context (such as VPC ID) for IAM policy condition evaluations.