access key and using the credential scope string to create a series of hash-based message
authentication codes (HMAC-SHA256).
Example Signature Calculation
The following example walks you through the details of creating a signature for CreateCluster request.
You can use this example as a reference to check your own signature calculation method. Other reference
calculations are included in the Signature Version 4 Test Suite of the Amazon Web Services Glossary.
You can use a GET or POST request to send requests to Amazon Redshift.The difference between the
two is that for the GET request your parameters are sent as query string parameters. For the POST
request they are included in the body of the request.The example below shows a POST request.
The example assumes the following:
• The time stamp of the request is Fri, 07 Dec 2012 00:00:00 GMT.
• The endpoint is US East (Northern Virginia) Region, us-east-1.
The general request syntax is:
https://redshift.us-east-1.amazonaws.com/
?Action=CreateCluster
&ClusterIdentifier=examplecluster
&MasterUsername=masteruser
&MasterUserPassword=12345678Aa
&NumberOfNode=2
&NodeType=dw.hs1.xlarge
&Version=2012-12-01
&x-amz-algorithm=AWS4-HMAC-SHA256
&x-amz-credential=AKIAIOSFODNN7EXAMPLE/20121207/us-east-1/redshift/aws4_re
quest
&x-amz-date=20121207T000000Z
&x-amz-signedheaders=content-type;host;x-amz-date
The canonical form of the request calculated for Task 1: Create a Canonical Request (p. 124) is:
POST
/
content-type:application/x-www-form-urlencoded; charset=utf-8
host:redshift.us-east-1.amazonaws.com
x-amz-date:20121207T000000Z
content-type;host;x-amz-date
55141b5d2aff6042ccd9d2af808fdf95ac78255e25b823d2dbd720226de1625d
The last line of the canonical request is the hash of the request body.The third line in the canonical
request is empty because there are no query parameters for this API.
The string to sign for Task 2: Create a String to Sign (p. 124) is:
AWS4-HMAC-SHA256
20121207T000000Z
API Version 2012-12-01
125
Amazon Redshift Management Guide
Example Signature Calculation