You need to configure a PrivateLink. In your databse settings under Heroku Postgres via PrivateLink
you can generate a private link to the vpc your AWS glue is running on. Once the link is established youll get some credentials you can use for your JDBC connection in Glue:
Heroku will give you a endpoint url
once the private link is established in this format:
psql://username:password@host:5432/databasename
you can parse out the username
and password
and then your jdbc url will be jdbc:postgresql://host:5432/databasename
If you are having an issue, make sure the aws role you are running the connection test through is configured in the heroku privatelink Allowed AWS Account IDs