I setup AWS S3 acceleration in one of my buckets, mybioinformaticsm and use S3 acceleration to upload a big file from local to S3, as in a following command;
aws s3 cp /Volumes/Documents/R/BM/bm.int s3://myawsbioinfo/bm.int --region us-east-2 --endpoint-url https://myawsbioinfo.s3-accelerate.amazonaws.com
It used to work until recently. When I use this command, it failed with a following error message;
Host override cannot be combined with Dualstack, FIPS, or S3 Accelerate
I have not set up Dualstak and am not sure about FIPS. At this point, I would really appreciate any input on this.
2
Answers
I would suggest removing your bucket name from
--endpoint-url
and try just the following.aws s3 cp /Volumes/Documents/R/BM/bm.int s3://myawsbioinfo/bm.int --region us-east-2 --endpoint-url https://s3-accelerate.amazonaws.com
AWS is likely (wrongly) determining your endpoint as a custom endpoint. It seems the direction of the various sdk’s is to dynamically determine endpoints based on profiles and options. Another option would be to turn accelerate on by default and do not include the
--endpoint-url
at all.See https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration-examples.html
To use S3 accelerate, I would suggest to not use the
--endpoint-url
argument. Instead, set thes3.use_accelerate_endpoint
configuration totrue
. You can do this either with the commandaws configure set default.s3.use_accelerate_endpoint true
as documented here or by editing the config file directly. The CLI will then determine the correct endpoint to use. Based on the error message you report, you may already have thes3.use_accelerate_endpoint
setting enabled.Some additional context and a method for debugging which setting is causing the error message:
The AWS CLI v2 updated its logic for endpoint resolution in version 2.9.0 which was released on November 18, 2022. AWS CLI v1 received the same update earlier in version 1.26.0 on October 24, 2022. Endpoint resolution is the process by which the correct hostname for a given service and operation is determined based on inputs such as the region name and configuration settings. The new versions use endpoint ruleset files that are shared between AWS SDKs in different languages. For example, the S3 endpoint ruleset file is here. The error
Host override cannot be combined with Dualstack, FIPS, or S3 Accelerate
is defined in this file.For low level debugging purposes, it is possible to see what parameters the endpoint ruleset was invoked with by adding the
--debug
flag to the command:When run on a system with default configuration settings, the debug output contains these two lines:
Note that
'UseFIPS': False
,'UseDualStack': False
, and'Accelerate': False
and that an endpoint is returned and not an error. The reported error appears if one of these parameters is notFalse
. The ruleset contains this error condition because, in the general case, it is impossible to know whether the value of--endpoint-url
should take precedence over the S3 transfer acceleration setting, or vice versa. Of course, in this specific case the outcome would be the same.Enabling the S3 transfer acceleration setting and dropping the
--endpoint-url
argument results in these lines:Note that this is the correct endpoint for using S3 transfer acceleration.