This error appears to be passed directly from the redshift/postgres driver, and generally would indicate trouble in traversing the network between your machine and the redshift cluster itself. If this is your local machine, it might be worthwhile testing connectivity using dbeaver or another redshift client. If on a cloud virtual machine, can you check firewall rules to make sure outbound traffic is allowed on port 5439?
https://docs.aws.amazon.com/redshift/latest/gsg/rs-gsg-prereq.html