@@ -74,6 +74,58 @@ Basic Example
74
74
print (result)
75
75
>> ([' One Hundred Years of Solitude' , ' Gabriel García Márquez' ], [' A Brief History of Time' , ' Stephen Hawking' ])
76
76
77
+ Example using IAM Credentials
78
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79
+ IAM Credentials can be supplied directly to ``connect(...) `` using an AWS profile as shown below:
80
+
81
+ .. code-block :: python
82
+
83
+ import redshift_connector
84
+
85
+ # Connects to Redshift cluster using IAM credentials from default profile defined in ~/.aws/credentials
86
+ conn = redshift_connector.connect(
87
+ iam = True ,
88
+ database = ' dev' ,
89
+ db_user = ' awsuser' ,
90
+ password = ' ' ,
91
+ user = ' ' ,
92
+ cluster_identifier = ' examplecluster' ,
93
+ profile = ' default'
94
+ )
95
+
96
+ .. code-block :: bash
97
+
98
+ # ~/.aws/credentials
99
+ [default]
100
+ aws_access_key_id=" my_aws_access_key_id"
101
+ aws_secret_access_key=" my_aws_secret_access_key"
102
+ aws_session_token=" my_aws_session_token"
103
+
104
+ # ~/.aws/config
105
+ [default]
106
+ region=us-west-2
107
+
108
+ If a region is not provided in `~/.aws/config ` or you would like to override its value, `region ` may be passed to ``connect(...) ``.
109
+
110
+ Alternatively, IAM credentials can be supplied directly to ``connect(...) `` using AWS credentials as shown below:
111
+
112
+ .. code-block :: python
113
+
114
+ import redshift_connector
115
+
116
+ # Connects to Redshift cluster using IAM credentials from default profile defined in ~/.aws/credentials
117
+ conn = redshift_connector.connect(
118
+ iam = True ,
119
+ database = ' dev' ,
120
+ db_user = ' awsuser' ,
121
+ password = ' ' ,
122
+ user = ' ' ,
123
+ cluster_identifier = ' examplecluster' ,
124
+ access_key_id = " my_aws_access_key_id" ,
125
+ secret_access_key = " my_aws_secret_access_key" ,
126
+ session_token = " my_aws_session_token" ,
127
+ region = " us-east-2"
128
+ )
77
129
78
130
Integration with pandas
79
131
~~~~~~~~~~~~~~~~~~~~~~~
@@ -178,6 +230,17 @@ Connection Parameters
178
230
+-------------------------+--------------------------------------------------------------------------------------------+---------------+----------+
179
231
| app_name | String. The name of the IdP application used for authentication | None | No |
180
232
+-------------------------+--------------------------------------------------------------------------------------------+---------------+----------+
233
+ | access_key_id | String. The The access key for the IAM role or IAM user configured for IAM database | None | No |
234
+ | | authentication | | |
235
+ +-------------------------+--------------------------------------------------------------------------------------------+---------------+----------+
236
+ | secret_access_key_id | String. The The secret access key for the IAM role or IAM user configured for IAM database | None | No |
237
+ | | authentication | | |
238
+ +-------------------------+--------------------------------------------------------------------------------------------+---------------+----------+
239
+ | session_token | String. The The access key for the IAM role or IAM user configured for IAM database. | None | No |
240
+ | | authentication. Not required unless temporary AWS credentials are being used. | | |
241
+ +-------------------------+--------------------------------------------------------------------------------------------+---------------+----------+
242
+ | profile | String. The name of a profile in a AWS credentials file that contains AWS credentials. | None | No |
243
+ +-------------------------+--------------------------------------------------------------------------------------------+---------------+----------+
181
244
182
245
Logging
183
246
~~~~~~~~~~~~
0 commit comments