Unable to perform SSH cases - HTTP 401 from POST https://ec2.us-east-1.amazonaws.com/

69 views
Skip to first unread message

vasugi...@gmail.com

unread,
Dec 13, 2016, 12:32:34 AM12/13/16
to Simian Army Users
Hello Everyone,

I've been stuck with this issue for a week now. I've looked around all the threads related to this issue and apparently it's an open issue and there is no definitive solution yet.

The issue is - even though I have the region to use (in my client config) is "us-west-2", my SSH cases are failing with a HTTP 401 at a wrong region. 
I scanned through the entire code and replaced all the "us-east-1" references to "us-west-2", but still I'm unable to get around this issue. I believe the code as got to be making an AWS SDK call to fetch the current region via API and somehow getting "us-east-1" retuned and overrides my config.
This has absolutely baffled me for days now.

Please, anyone who had resolved this earlier or can think of a better solution, help me resolve this. Following is the error log. Thank you!

2016-12-13 05:24:05.356 - INFO  BasicChaosInstanceSelector - [BasicChaosInstanceSelector.java:65] Randomly selecting 2 from 2 instances, excluding null

2016-12-13 05:24:07.084 - WARN  ChaosInstance - [ChaosInstance.java:105] Error making SSH connection to instance

org.jclouds.rest.AuthorizationException: POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1 -> HTTP/1.1 401 Unauthorized

.
.
.
.

2016-12-13 05:24:07.089 - WARN  ScriptChaosType - [ScriptChaosType.java:61] Strategy disabled because SSH credentials failed

2016-12-13 05:24:07.089 - WARN  BasicChaosMonkey - [BasicChaosMonkey.java:124] No chaos type was applicable to the instance: i-009863xxxxxx

2016-12-13 05:24:07.205 - WARN  ChaosInstance - [ChaosInstance.java:105] Error making SSH connection to instance

org.jclouds.rest.AuthorizationException: POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1 -> HTTP/1.1 401 Unauthorized

at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.refineException(ParseAWSErrorFromXmlContent.java:122)

vasugi...@gmail.com

unread,
Dec 13, 2016, 4:25:31 PM12/13/16
to Simian Army Users
Here's an update -I did replace that part (and everywhere else it's hardcoded too), but it still doesn't appear to work. Here is how I have it set in my code.

String defaultRegion = "us-west-2";
Region currentRegion = Regions.getCurrentRegion();

if (currentRegion != null) {
   //  defaultRegion = currentRegion.getName();
   defaultRegion = "us-west-2";
}

region = config.getStrOrElse("simianarmy.client.aws.region", defaultRegion);
GLOBAL_OWNER_TAGKEY = config.getStrOrElse("simianarmy.tags.owner", "owner");

===========================================================================
And, I didn't overlook the property that deals with region in client config. It is set for us-west-2 and it does get consumed by chaos monkey. I see that it fetches all the available auto-scaling groups in the west region and gets as far as to picking an instance randomly (in the specified ASG) to SSH into. But that's where it gets thrown a HTTP 401 from the east region, as you can see in the log in my first post.

simianarmy.client.aws.region = us-west-2


Any interesting insights from anyone???

Reply all
Reply to author
Forward
Message has been deleted
0 new messages