Amazon S3: Region is not configurable

Advertisement

cyberbit
Joined:
Posts:
1

Amazon S3: Region is not configurable

See attachment for error. The region key is not correct, and there is no way for me to specifiy it. Note that this occurs when using AWS GovCloud, which is isolated from normal AWS services.

Text of screenshot:
The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-gov-west-1'

Extra Details: Region: us-gov-west-1, RequestId: AB3CB4671E441F7A, HostId: <...>
Connection failed.

Description: Screenshot of error

aws region error.png

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
30,693
Location:
Prague, Czechia

Re: Amazon S3: Region is not configurable

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, enable logging, log in to your server and do the operation and only the operation that causes the error. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Guest

steps to replicate

1) Turn on session logging
2) Connect to the regular AWS S3 service
3) search the session log for the line (near the top of the file): "S3: Default region: us-east-1"

Update WinSCP so we can configure the Default Region variable. Receive donation.

Reply with quote

Marko
Joined:
Posts:
3

Using the latest version (5.13.4), I've tried overriding the default region with the "S3DefaultRegion" raw session setting (as noted in changelog for version 5.12.1):
open ... -rawsettings S3DefaultRegion=eu-central-1

According to the log, the setting is applied, however I get the same error when trying to connect via scripting (see attached log #1).

When I use a stored session (with Hostname set to another region, e.g., "s3.eu-central-1.amazonaws.com"), no error appears and I connect successfully (see attached log #2).

Note that I am using the portable version of WinSCP.
  • 2.log (36.35 KB, Private file)
Description: Log with successful connection (using stored session)
  • 1.log (7.7 KB, Private file)
Description: Log with error

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
30,693
Location:
Prague, Czechia

Your stored session has the bucket set as initial remote directory. While the other script tries to access a root folder (bucket list).
Add the bucket to URL:
open s3://***:***@s3.eu-central-1.amazonaws.com/bucket/ -rawsettings S3DefaultRegion="eu-central-1"

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
30,693
Location:
Prague, Czechia

Re: Amazon S3: Region is not configurable

This issue has been added to the tracker:
https://winscp.net/tracker/1695

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

Reply with quote

Gaurav
Joined:
Posts:
1

Not working for s3 c# assembly

Hi I am using winscp 5.13.7 in c# code.

I have tried multiple options but it keeps giving me the error. I need to connect to us-west-2 region with initial bucket. It keeps giving me the bucket issue.
1.
SessionOptions sessionOptions = new SessionOptions
                {
                    Protocol = WinSCP.Protocol.S3,
                    HostName = bucketName + ".s3-us-west-2.amazonaws.com" ,
                    PortNumber = 443,
                    UserName = ConfigurationManager.AppSettings["AWSAccessKey"],
                    Password = ConfigurationManager.AppSettings["AWSSecretKey"]
                };
                using (Session session = new Session())
                {
                    sessionOptions.AddRawSettings("S3DefaultRegion", "us-west-2");
                    // Connect
                    session.Open(sessionOptions);
2. using ParseUrl method but with s3.region
sessionOptions.ParseUrl("s3://user:pwd@s3.us-west-2.amazonaws.com/bucket/");
                    sessionOptions.AddRawSettings("S3DefaultRegion", "us-west-2");
                    // Connect
                    session.Open(sessionOptions);

3. using ParseUrl method but with s3-region
sessionOptions.ParseUrl("s3://user:pwd@s3-us-west-2.amazonaws.com/bucket/");
                    sessionOptions.AddRawSettings("S3DefaultRegion", "us-west-2");
                    // Connect
                    session.Open(sessionOptions);
4. 3. using ParseUrl method
sessionOptions.ParseUrl("s3://user:pwd@bucket.s3-us-west-2.amazonaws.com");
                    sessionOptions.AddRawSettings("S3DefaultRegion", "us-west-2");
                    // Connect
                    session.Open(sessionOptions);

It always throws an error about us-east-1 being used instead of us-west-2.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
30,693
Location:
Prague, Czechia

Re: Not working for s3 c# assembly

Gaurav wrote:

I have tried multiple options but it keeps giving me the error. I need to connect to us-west-2 region with initial bucket. It keeps giving me the bucket issue.
1) Don't change hostname.
2) Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

luissousa
Guest

S3 region error on Scaleway

Hello there,

Using Scaleway's S3 I get the same wrong region error.
Error: The autorhization header is malformed; the region 'us-east-1' is wrong; expecting 'nl-ams'.
Hostname: s3.nl-ams.scw.cloud

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
30,693
Location:
Prague, Czechia

Re: S3 region error on Scaleway

luissousa wrote:

Using Scaleway's S3 I get the same wrong region error.
Error: The autorhization header is malformed; the region 'us-east-1' is wrong; expecting 'nl-ams'.
Hostname: s3.nl-ams.scw.cloud
Please start a new thread for your problem and attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, enable logging, log in to your server and do the operation and only the operation that causes the error. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum