Getting Amazon S3 Request IDs for AWS Support - Amazon Simple Storage Service

Getting Amazon S3 Request IDs for AWS Support

Whenever you need to contact AWS Support due to encountering errors or unexpected behavior in Amazon S3, you will need to get the request IDs associated with the failed action. Getting these request IDs enables AWS Support to help you resolve the problems you're experiencing. Request IDs come in pairs, are returned in every response that Amazon S3 processes (even the erroneous ones), and can be accessed through verbose logs. There are a number of common methods for getting your request IDs including, S3 access logs and CloudTrail events/data events.

After you've recovered these logs, copy and retain those two values, because you'll need them when you contact AWS Support. For information about contacting AWS Support, see Contact Us.

Using HTTP to Obtain Request IDs

You can obtain your request IDs, x-amz-request-id and x-amz-id-2 by logging the bits of an HTTP request before it reaches the target application. There are a variety of third-party tools that can be used to recover verbose logs for HTTP requests. Choose one you trust, and run the tool, listening on the port that your Amazon S3 traffic travels on, as you send out another Amazon S3 HTTP request.

For HTTP requests, the pair of request IDs will look like the following examples.

x-amz-request-id: 79104EXAMPLEB723 x-amz-id-2: IOWQ4fDEXAMPLEQM+ey7N9WgVhSnQ6JEXAMPLEZb7hSQDASK+Jd1vEXAMPLEa3Km

HTTPS requests are encrypted and hidden in most packet captures.

Using a Web Browser to Obtain Request IDs

Most web browsers have developer tools that allow you to view request headers.

For web browser-based requests that return an error, the pair of requests IDs will look like the following examples.

<Error><Code>AccessDenied</Code><Message>Access Denied</Message> <RequestId>79104EXAMPLEB723</RequestId><HostId>IOWQ4fDEXAMPLEQM+ey7N9WgVhSnQ6JEXAMPLEZb7hSQDASK+Jd1vEXAMPLEa3Km</HostId></Error>

For obtaining the request ID pair from successful requests, you'll need to use the developer tools to look at the HTTP response headers. For information about developer tools for specific browsers, see Amazon S3 Troubleshooting - How to recover your S3 request IDs in the AWS Developer Forums.

Using AWS SDKs to Obtain Request IDs

The following sections include information for configuring logging using an AWS SDK. While you can enable verbose logging on every request and response, you should not enable logging in production systems since large requests/responses can cause significant slowdown in an application.

For AWS SDK requests, the pair of request IDs will look like the following examples.

Status Code: 403, AWS Service: Amazon S3, AWS Request ID: 79104EXAMPLEB723 AWS Error Code: AccessDenied AWS Error Message: Access Denied S3 Extended Request ID: IOWQ4fDEXAMPLEQM+ey7N9WgVhSnQ6JEXAMPLEZb7hSQDASK+Jd1vEXAMPLEa3Km

Using the SDK for PHP to Obtain Request IDs

You can configure logging using PHP. For more information, see How can I see what data is sent over the wire? in the FAQ for the AWS SDK for PHP.

Using the SDK for Java to Obtain Request IDs

You can enable logging for specific requests or responses, allowing you to catch and return only the relevant headers. To do this, import the class. Afterwards, you can store the request in a variable before performing the actual request. Call getCachedResponseMetadata(AmazonWebServiceRequest request).getRequestID() to get the logged request or response.

PutObjectRequest req = new PutObjectRequest(bucketName, key, createSampleFile()); s3.putObject(req); S3ResponseMetadata md = s3.getCachedResponseMetadata(req); System.out.println("Host ID: " + md.getHostId() + " RequestID: " + md.getRequestId());

Alternatively, you can use verbose logging of every Java request and response. For more information, see Verbose Wire Logging in the Logging AWS SDK for Java Calls topic in the AWS SDK for Java Developer Guide.

Using the AWS SDK for .NET to Obtain Request IDs

You can configure logging in AWS SDK for .NET using the built-in System.Diagnostics logging tool. For more information, see the Logging with the AWS SDK for .NET AWS Developer Blog post.


By default, the returned log contains only error information. The config file needs to have AWSLogMetrics (and optionally, AWSResponseLogging) added to get the request IDs.

Using the SDK for Python (Boto3) to Obtain Request IDs

With SDK for Python (Boto3), you can log specific responses, which enables you to capture only the relevant headers. The following code shows you how to log parts of the response to a file:

import logging import boto3 logging.basicConfig(filename='logfile.txt', level=logging.INFO) logger = logging.getLogger(__name__) s3 = boto3.resource('s3') response = s3.Bucket(bucket_name).Object(object_key).put()"HTTPStatusCode: %s", response['ResponseMetadata']['HTTPStatusCode'])"RequestId: %s", response['ResponseMetadata']['RequestId'])"HostId: %s", response['ResponseMetadata']['HostId'])"Date: %s", response['ResponseMetadata']['HTTPHeaders']['date'])

You can also catch exceptions and log relevant information when an exception is raised. For details, see Discerning useful information from error responses in the Boto3 developer guide

Additionally, you can configure Boto3 to output verbose debugging logs using the following code:

import boto3 boto3.set_stream_logger('', logging.DEBUG)

For more information, see set_stream_logger in the Boto3 reference.

Using the SDK for Ruby to Obtain Request IDs

You can get your request IDs using either the SDK for Ruby - Version 1, Version 2, or Version 3.

  • Using the SDK for Ruby - Version 1– You can enable HTTP wire logging globally with the following line of code.

    s3 = =>$stdout), :http_wire_trace => true)
  • Using the SDK for Ruby - Version 2 or Version 3– You can enable HTTP wire logging globally with the following line of code.

    s3 = =>$stdout), :http_wire_trace => true)

Using the AWS CLI to Obtain Request IDs

You can get your request IDs in the AWS CLI by adding --debug to your command.