When I send requests to an Amazon Simple Storage Service (Amazon S3) bucket, Amazon S3 returns a response similar to:
<Error><Code>TemporaryRedirect</Code><Message>Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests.</Message><RequestId>A4DBBEXAMPLE2C4D</RequestId>
Why am I receiving this error?
After you create an Amazon S3 bucket, it can take up to 24 hours for the bucket name to propagate 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 the S3 bucket. For more information, see Temporary Request Redirection.
To avoid the 307 Temporary Redirect response within 24 hours of creating the bucket, send requests only to the regional endpoint that's in the same Region as the bucket:
- If you're using the AWS Command Line Interface (AWS CLI) to access the bucket, you can configure the default region of your AWS CLI to be the same Region that the bucket is in. For more information, see Configuring the AWS CLI.
- If you're using an Amazon CloudFront distribution with an Amazon S3 origin, CloudFront forwards requests to the default S3 endpoint (s3.amazonaws.com), which is in the us-east-1 Region. If you must access Amazon S3 within the first 24 hours of creating the bucket, you can change the Origin Domain Name of the distribution to include the regional endpoint of the bucket. For example, if the bucket is in us-west-2, you can change the Origin Domain Name from bucketname.s3.amazonaws.com to bucketname.s3-us-west-2.amazonaws.com.
Tip: As a best practice, include the AWS Region of your bucket in your HTTP requests when possible. Specifying the AWS Region reduces the number of DNS redirects and potential DNS propagation issues. For example, if you're using the AWS CLI, include the --region parameter in your request to specify the AWS Region.