3.
At a command prompt, specify the connection information by using either command line parameters
or a connection information string. To use parameters:
psql -h
<endpoint>
-U
<userid>
-d
<databasename>
-p
<port>
Where:
•
<endpoint>
is the Endpoint you recorded in the previous step.
•
<userid>
is a user ID with permissions to connect to the cluster.
•
<databasename>
is the Database Name you recorded in the previous step.
•
<port>
is the Port you recorded in the previous step.
For example:
psql -h examplecluster.
<XXXXXXXXXXXX>
.us-east-1.redshift.amazonaws.com -U
masteruser -d dev -p 5439
4.
At the psql password prompt, enter the password for the
<userid>
user.
You are connected to the cluster, and you can interactively enter commands.
Connect by Using a Certificate
To control whether psql authenticates the service using a certificate, you must use a connection information
string to specify connection information, and specify the
sslmode
keyword. By default, psql operates
with
sslmode=prefer
. To specify that psql opens an encrypted connection and uses an Amazon Redshift
certificate to verify the service, download an Amazon Redshift certificate to your computer, specify
sslmode=verify-ca
, and specify
sslrootcert
with the location of the certificate.
For more information about connection information string parameters, see
http://www.postgresql.org/docs/8.4/static/libpq-connect.html
To connect by using a certificate
1.
Save the public key from
https://s3.amazonaws.com/redshift-downloads/redshift-ssl-ca-cert.pem
as
a .pem file to your computer. If you do a File\Save as using Internet Explorer, specify the file type
as Text file (*.txt) and delete the .txt extension. For example, save it as the file
C:\MyDownloads\redshift-ssl-ca-cert.pem
.
2.
In the Amazon Redshift console, select the cluster to display the Cluster Database Properties.
Record the values displayed in the Endpoint, Port, and Database Name fields.
3.
At a command prompt, specify the connection information using a connection information string:
API Version 2012-12-01
104
Amazon Redshift Management Guide
Connect by Using a Certificate