When I try to connect to an AWS service from my Amazon SageMaker notebook, I get the following error: "Connect timeout on endpoint URL: "https://athena.ap-southeast-2.amazonaws.com/".
Resolution
To connect to AWS services, the notebook instance's subnet must have a virtual private cloud (VPC) endpoint for the service that you connect to. Or, the subnet must be able to access the internet.
Use one of the following options to resolve Connect timeout on endpoint URL errors.
Add a VPC endpoint for the service to the notebook instance's subnet
Many AWS services offer either an interface endpoint or a gateway endpoint. For more information, see AWS PrivateLink concepts. If the AWS service that you're connecting to doesn't offer an endpoint, then you must create a new notebook instance to add a VPC endpoint.
Create a new notebook instance
With direct internet access
The default option is to create a new notebook instance with direct internet access, regardless of whether you create the notebook instance in a VPC.
SageMaker provides a network interface that allows the notebook to communicate with the internet through a SageMaker managed VPC. For more information, see Understanding Amazon SageMaker notebook instance networking configurations and advanced routing options.
Without direct internet access
Add a NAT gateway to the subnet. The NAT gateway allows traffic to reach the public endpoint for the service that you're connecting to.
Related information
Connect a notebook instance in a VPC to external resources