-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Unable to perform SSH cases - HTTP 401 being returned from a wrong region #285
Comments
Which region are you running Chaos Monkey and which region has the instance
you are trying to terminate?
…On Mon, Dec 12, 2016 at 9:37 PM, VinnieGogniti ***@***.***> wrote:
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)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#285>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKXxgbZPzYQEIrIjCAvpwOYsIxm8hdPwks5rHi8JgaJpZM4LLW8B>
.
|
Both are "us-west-2".
…On Mon, Dec 12, 2016 at 9:42 PM ebukoski ***@***.***> wrote:
Which region are you running Chaos Monkey and which region has the instance
you are trying to terminate?
On Mon, Dec 12, 2016 at 9:37 PM, VinnieGogniti ***@***.***>
wrote:
> 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)
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#285>, or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AKXxgbZPzYQEIrIjCAvpwOYsIxm8hdPwks5rHi8JgaJpZM4LLW8B
>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#285 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AXZt1KfkqVOCCOVHm23LK6QOxz0EGGUTks5rHjBdgaJpZM4LLW8B>
.
|
This is the important line here
<https://github.com/Netflix/SimianArmy/blob/master/src/main/java/com/netflix/simianarmy/basic/BasicSimianArmyContext.java#L137>
.
Check to make sure the property
<https://github.com/Netflix/SimianArmy/wiki/Client-Settings>
simianarmy.client.aws.region is set and being consumed by Chaos Monkey.
On Mon, Dec 12, 2016 at 9:44 PM, VinnieGogniti <[email protected]>
wrote:
… Both are "us-west-2".
On Mon, Dec 12, 2016 at 9:42 PM ebukoski ***@***.***> wrote:
> Which region are you running Chaos Monkey and which region has the
instance
>
>
> you are trying to terminate?
>
>
>
>
>
> On Mon, Dec 12, 2016 at 9:37 PM, VinnieGogniti ***@***.***
>
>
>
> wrote:
>
>
>
>
>
> > 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)
>
>
> >
>
>
> > —
>
>
> > You are receiving this because you are subscribed to this thread.
>
>
> > Reply to this email directly, view it on GitHub
>
>
> > <#285>, or mute the thread
>
>
> > <
> https://github.com/notifications/unsubscribe-auth/
AKXxgbZPzYQEIrIjCAvpwOYsIxm8hdPwks5rHi8JgaJpZM4LLW8B
> >
>
>
> > .
>
>
> >
>
>
>
>
>
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#285 (comment)
>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/
AXZt1KfkqVOCCOVHm23LK6QOxz0EGGUTks5rHjBdgaJpZM4LLW8B>
> .
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#285 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKXxgRG5GrhEMPM__SoelsuwKg9Xf0goks5rHjDDgaJpZM4LLW8B>
.
|
Thanks for responding. 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";
=========================================================================== simianarmy.client.aws.region = us-west-2 |
@ebukoski I somehow feel that this is the particular piece of code that deals with the construction of ec2 client end-point - ec2.us-east-1.amazonaws.com, the one that was thrown in the HTTP 401 error. Please review and let me know your thoughts. Error log: |
I am wiling to pay a reasonable amount for anyone who can fix this. |
I'm having the same problem, but I get I'm trying to see if there is something wrong with my IAM user or role permissions. I wonder if the temporary cred retrieved from the Amazon STS service aren't valid right away and maybe require some time (few seconds?) before they work with the ec2 describe-regions api? Just guessing, I'm not an AWS expert by any means. |
If that HTTP 401 is being thrown from a different region than the one in your client config, then it certainly is a bug and it has been open and unaddressed for a very long time. |
Have you two ensured that this property exists in your properties file and is being consumed by Chaos Monkey as Ed suggested: Also, check out this Region Detection feature: #233 |
Yes, I can see it consuming the region and detecting all auto-scaling groups available in that region, during startup. It actually gets as far as to picking an instance for executing a termination strategy, in that region. AWSClient - [AWSClient.java:360] Got 37 auto-scaling groups in region us-west-2. |
Taking a shot in the dark here; if you look at the error it is an authentication error to the AWS API, not an error trying to actually make the SSH connection. When connecting via SSH, Chaos Monkey sends only the instanceId to the connectSsh method, not the instanceId and region. It may be possible that the Apache Jcloud is querying multiple regions in an effort to locate the region of your instance so that it can query the instance to populate the NodeMetaData. Check this method: https://github.com/Netflix/SimianArmy/blob/master/src/main/java/com/netflix/simianarmy/client/aws/AWSClient.java#L880 Is it possible the IAM credentials your Monkey is using doesn't have read access to the API in the us-east-1 region? Are you restricting the regions to which the Monkey is allowed to query? |
Not that I'm aware of. I'm able to manually do a "aws ec2 describe-instances --region us-east-1" from the monkey instance on east region without any issues. aws ec2 describe-instances --region us-east-1 Is it possible to restrict Apache Jcloud to query only on the region specified in the AWS Client config, which is us-west-2 in this case? |
AWS tech tried to replicate my issue. They were only able to during use of IAM roles, but not when using regular user access key and secret key. He also couldn't see any api request being made, so it appears there is something wrong with the signature used when making the api request for describe-regions. I should also mention I only get the 401 error when trying to elicit a terminate on demand via http POST |
When I use my AWS access and secret keys, it ends up failing at the step in creating SimpleDB domain at the wrong region (us-east-1), again. WARN SimpleDBRecorder - [SimpleDBRecorder.java:287] Error while trying to auto-create SimpleDB domain |
There is something wrong with your amazon permissions. Try doing this for your permissions. see attachment |
I got the following permissions, which basically has full EC2, ASG and SDB permissions, regardless of the region. { Error: |
I ran the build with extended logging enabled and I'm now able to see some new useful stack trace information which wasn't exposed before. Any two useful cents, from anyone? How do I override it in the code to return "us-west-2"? at org.jclouds.aws.ec2.compute.strategy.AWSEC2ListNodesStrategy.pollRunningInstances(AWSEC2ListNodesStrategy.java:65) |
To find the source of this problem, it might also help to use an artifact that is known to work, e.g. this Docker image: https://github.com/mlafeldt/docker-simianarmy |
This error (401 unauthorized) only occurs if I use IAM roles, but if I use the normal user access key and secret key, there are NO problems. I created a basic jcloud project and I got the same issue if I use the access key for the role and the normal user id. Tried with normal user key and listNode() worked.
Maybe a bug in jclouds? Maybe a bug in aws sdk? |
That's what I think too! |
I don't have much time to look into it further, but I here are two things:
|
I'm having the same problem and I'm thinking it might has to do with the fact that my chaos monkey is in a private subnet and has to go through a proxy to talk to AWS. For people having problem, is your setup similar? |
I didn't use a proxy. Are you using IAM roles or users? It works for me when using users |
Overall, there were multiple issues I ran into
|
I am facing the same problem. |
Is there any update on this issue? I am seeing similar failures running in us-east-1 region but I believe my issues are seen because jcloud doesn't use session tokens. |
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)
The text was updated successfully, but these errors were encountered: