Why am I getting an HTTP 307 Temporary Redirect response from Amazon S3?

2 minute read
0

When I send requests to an Amazon Simple Storage Service (Amazon S3) bucket, Amazon S3 returns a “307 Temporary Redirect” response.

Resolution

After you create an Amazon S3 bucket, it can take up to 24 hours before the bucket name propagates across all AWS Regions. During this time, you might receive the 307 Temporary Redirect response for requests to Regional endpoints that aren't in the same Region as your bucket. For more information, see Temporary request redirection.

To avoid the 307 Temporary Redirect response, send requests only to the Regional endpoint that's in the same Region as your S3 bucket:

  • If you use the AWS Command Line Interface (AWS CLI) to access the bucket, configure the AWS CLI. Your AWS CLI must reside in the same Region as your Amazon S3 bucket.
    Note: If you receive errors when running AWS CLI commands, make sure that you're using the most recent AWS CLI version.
  • If you use an Amazon CloudFront distribution with an Amazon S3 origin, then CloudFront forwards requests to the default S3 endpoint (s3.amazonaws.com). The default S3 endpoint is in the us-east-1 Region. If you must access Amazon S3 within the first 24 hours from when you create the bucket, then change the distribution's origin domain name. The domain name must include the Regional endpoint of the bucket. For example, if the bucket is in us-west-2, then change the origin domain name from awsexamplebucketname.s3.amazonaws.com to awsexamplebucket.s3.us-west-2.amazonaws.com.

Tip: To reduce the number of DNS redirects and DNS propagation issues, specify the AWS Region of your bucket in all HTTP requests. For example, if you use the AWS CLI, then include the --region parameter in your request to specify the AWS Region.

Related information

AWS service endpoints

AWS OFFICIAL
AWS OFFICIALUpdated 9 months ago
2 Comments

Well, at first I thought "this is it", but then after checking my bucket's region (us-west-2) and then the CF's origin (...s3-website-us-west-2.amazonaws.com), this doesn't seem to be a valid answer.

Tony B
replied 9 months ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

profile pictureAWS
MODERATOR
replied 9 months ago