A company is using Amazon API Gateway to deploy a private REST API that will provide access to sensitive data. The API must be accessible only from an application that is deployed in a VPC. The company deploys the API successfully. However, the API is not accessible from an Amazon EC2 instance that is deployed in the VPC. Which solution will provide connectivity between the EC2 instance and the API?
Select one answer.
Marked answer: B
Community Discussion
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
1
B is correct Creating an interface VPC endpoint for API Gateway allows the EC2 instance to access the API without having to traverse the internet. Attaching an endpoint policy that allows the execute-api:Invoke action enables the EC2 instance to invoke the API, but only if it has the necessary permissions and credentials. Enabling private DNS naming for the VPC endpoint ensures that the EC2 instance can use the endpoint's DNS name to access the API. Configuring an API resource policy that allows access from the VPC endpoint enables the EC2 instance to access the API without having to authenticate again.