首先需要确保您的RDS实例已启用了SSL连接。可以通过登录到AWS控制台并选择您的RDS实例来确认。
通过以下方式创建AWS Glue连接,以启用SSL连接:
import boto3
glue = boto3.client('glue', region_name='your_region')
response = glue.create_connection(
ConnectionInput={
'Name': 'connection_name',
'ConnectionType': 'JDBC',
'JdbcConnection': {
'Url': 'jdbc:postgresql://your_rds_endpoint:5432/your_db_name?sslmode=require',
'Username': 'your_username',
'Password': 'your_password'
}
}
)
请注意,URL中的参数“sslmode=require”指示使用SSL连接。
希望这可以帮助您解决AWS Glue连接RDS PostgreSQL数据库启用SSL连接失败的问题。