Pxctl doesn't see S3 buckets in regions other than us-east-1

Following the documentation I tried both, have pxctl create a new bucket or use an existing one in us-west-2. In the former case I get:

$ kubectl exec $PX_POD -n kube-system -- /opt/pwx/bin/pxctl credentials create --provider s3  --s3-access-key xxx --s3-secret-key xxx --s3-endpoint s3.amazonaws.com --s3-region us-west-2 my-s3-credentials 
createCred: error validating credential during create:
 AuthorizationHeaderMalformed: The authorization header is malformed; the region 'us-west-2' is wrong; expecting 'us-east-1'
 status code: 400 ...

and in the latter case I get:

kubectl exec $PX_POD -n kube-system -- /opt/pwx/bin/pxctl credentials create --provider s3  --s3-access-key xxx --s3-secret-key xxx --s3-endpoint s3.amazonaws.com --s3-region us-west-2 --bucket xxx my-s3-credentials 
createCred: error validating credential during create:
 BucketRegionError: incorrect region, the bucket is not in 'us-west-2' region
 status code: 301

$ aws s3api get-bucket-location --bucket xxx
{
    "LocationConstraint": "us-west-2"
}

1 Like

@kzidane The endpoint needs to point to the correct region too. For us-west-2 it should be s3.us-west-2.amazonaws.com. AWS S3 endpoints can be found here: https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

2 Likes

D’oh! That worked. Thanks!