Authentication

When you create an AWS account, AWS assigns your AWS access key identifiers, a pair of related credentials:

[Important]Important

Your Secret Access Key is a secret and should be known only by you and AWS. It is important to keep it confidential to protect your account. Never include it in your requests to AWS and never e-mail it to anyone. Do not share it outside your organization, even if an inquiry appears to come from AWS or Amazon.com. No one who legitimately represents Amazon will ever ask you for your Secret Access Key.

The Access Key ID uniquely identifies an AWS account. You include it in AWS service requests to identify yourself as the sender of the request.

To prove that you are the owner of the account making the request, you must include a signature. For all requests, you calculate the signature with your Secret Access Key. AWS uses the Access Key ID in the request to look up your Secret Access Key and then calculates a signature with the key. If the calculated signature matches the signature you sent, the request is considered authentic. Otherwise, the request fails authentication and is not processed.

Your Access Key ID and Secret Access Key are displayed when you create your AWS account. They are not e-mailed to you. If you need to see them again, you can view them at any time from your AWS account.

Your Access Key ID and Secret Access Key are displayed on the resulting AWS Access Identifiers page.

When accessing Amazon S3 using REST and SOAP, you must provide the following items so the request can be authenticated:

Following are the general steps for authenticating requests to AWS. It is assumed you have already created an AWS account and received an Access Key ID and Secret Access Key.

1

Construct a request to AWS.

2

Calculate a keyed-hash message authentication code (HMAC) signature using your Secret Access Key.

3

Include the signature and your Access Key ID in the request, and then send the request to AWS. AWS performs the next three steps.

4

AWS uses the Access Key ID to look up your Secret Access Key.

5

AWS generates a signature from the request data and the Secret Access Key using the same algorithm you used to calculate the signature you sent in the request.

6

If the signature generated by AWS matches the one you sent in the request, the request is considered authentic. If the comparison fails, the request is discarded, and AWS returns an error response.

HMAC request signatures must be Base64 encoded. Base64 encoding converts the signature into a simple ASCII string that can be attached to the request.

For examples of Base64 encoding, refer to the Amazon S3 code samples.