- Le plus récent
- Le plus de votes
- La plupart des commentaires
Hi,
The principle here is that there much be network connectivity between the Notebook Instance and the DB Instance, and the security groups on the DB Instance should allow in-bound traffic from the Notebook Instance
One example of such as setup is
-
RDS DB Instance is VPC vpc-a and Subnet subnet-b.
-
SageMaker Notebook is launched in VPC vpc-a, Subnet subnet-b, with Security Group sg-c with DirectIntenetAccess "Disabled"
-
In the RDS DB Instance's Security Group rules, you can add an Inbound Rule to allow inbound traffic from the SageMaker Notebook security group "sg-c"
-- Type - Protocol - Port Range - Source
-- MYSQL/Aurora - TCP - 3306 - sg-c
Sample Code:
! pip install mysql-connector
import mysql.connector
mydb = mysql.connector.connect(
host="$RDS_ENDPOINT",
user="$RDS_USERNAME",
passwd="$RDS_PASSWORD"
)
cursor = mydb.cursor()
cursor.execute("SHOW DATABASES")
Thanks for using Amazon SageMaker and let us know if there's anything else we can help with!
Edited by: JaipreetS-AWS on May 6, 2019 3:04 PM
Contenus pertinents
- demandé il y a un an
- demandé il y a 6 mois
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a un an