Which solution will meet these requirements with the FEWEST changes to the code?
Add an X-API-Key header in the HTTP header for authorization.
Use an interface endpoint.
Use a gateway endpoint.
Add an Amazon Simple Queue Service (Amazon SQS) queue between the two REST APIs.
Explanations:
Adding an X-API-Key header is primarily for authorization and does not change the routing of API calls. The BuyStock API will still route the request to CheckFunds over the internet unless a VPC endpoint is used.
Using an interface endpoint allows for private connectivity between the APIs within the same VPC. This ensures that the API calls are made directly through the AWS network, preventing the traffic from going over the internet and reducing latency.
A gateway endpoint is designed for specific AWS services like S3 and DynamoDB, not for REST APIs. Thus, it would not enable communication between the two REST APIs in the VPC.
Introducing an Amazon SQS queue would require significant code changes to handle message queuing and retrieval, which does not meet the requirement of making the fewest changes to the existing code for direct communication between the APIs.