SeleniumGridScaler icon indicating copy to clipboard operation
SeleniumGridScaler copied to clipboard

com.amazonaws.AmazonServiceException: AWS was not able to validate the provided access credentials

Open Vinay-Venkatesh opened this issue 6 years ago • 7 comments

Hi,

I am running into the below issue: java -DawsAccessKey="*******" -DawsSecretKey="********" -DipAddress="grid.workerbee.co.in" -cp automation-grid.jar org.openqa.grid.selenium.GridLauncher -role hub -servlets "com.rmn.qa.servlet.AutomationTestRunServlet","com.rmn.qa.servlet.StatusServlet"

I am sure, I am providing an valid AccessKey and SecretKey. I was able to test this from aws cli and did not find any issues in retrieving aws data.

Could someone please help over this.

Thank you in advance.

Vinay-Venkatesh avatar May 21 '18 08:05 Vinay-Venkatesh

Hi Mat,

I have the same issue. The log error from the hub console is below, am pretty sure I have provided the correct aws credentials.

Sep 27, 2018 11:46:52:530 AM - INFO [qtp750468423-21] [AutomationTestRunServlet] 10 threads requested Sep 27, 2018 11:46:52:531 AM - INFO [qtp750468423-21] [AutomationTestRunServlet] 2 nodes will be started for run [testRun1] Sep 27, 2018 11:46:52:544 AM - INFO [qtp750468423-21] [AwsVmManager] Setting image id: ami-d216a3ba Sep 27, 2018 11:46:52:544 AM - INFO [qtp750468423-21] [AwsVmManager] Setting instance type: c4.large Sep 27, 2018 11:46:52:545 AM - INFO [qtp750468423-21] [AwsVmManager] Sending run request to AWS... Sep 27, 2018 11:46:54:389 AM - ERROR [qtp750468423-21] [AutomationTestRunServlet] Error trying to start nodes: com.amazonaws.AmazonServiceException: AWS was not able to validate the provided access credentials (Service: AmazonEC2; Status Code: 401; Error Code: AuthFailure; Request ID: deb363f9-040f-4f10-8b1b-c5f78217148d)

RayChenLDL avatar Sep 27 '18 01:09 RayChenLDL

java -Xms2048m -Xmx4096m \ -DpropertyFileLocation=/opt/hub/aws.properties.default \ -DipAddress="${IP_ADDRESS}" \ -DtotalNodeCount=100 \ -DPOOL_MAX=1024 \ -cp /opt/hub/automation-grid.jar org.openqa.grid.selenium.GridLauncherV3 \ -servlets "com.rmn.qa.servlet.AutomationTestRunServlet","com.rmn.qa.servlet.StatusServlet" \ -role hub \ -hubConfig /opt/hub/hub.static.json \ -log grid.log @RayChenLDL @xxCoDeBoX note the GridLauncherV3 Also try having the keys under ~/.aws/credentials or ~/.aws/config

ambirag avatar Sep 27 '18 13:09 ambirag

Thanks Ragavan, appreciated it. It worked after removing the aws credentials from command line ( instead, I setup the AWS credentials using aws configure before starting the selenium hub).

RayChenLDL avatar Sep 28 '18 00:09 RayChenLDL

Hi Ragavan,

Thanks for the response, I can start the hub now and could spin up EC2 instance for the node while the node is showing on the hub. I checked the error from the hub console, it says:

I did not pass the aws credentials via command line, neither in the " aws.properties.default " . Could you please check your "aws.properties.default" and let me know what are the key names for "awsAccessKey" and "awsSecretKey" should I put? Thanks a lot.

23:54:22.719 INFO - Selenium Grid hub is up and running Oct 01, 2018 23:54:56:403 PM - INFO [qtp1997287019-14] [AwsVmManager] Falling back to IAM roles for authorization since no credentials provided in system properties java.lang.IllegalArgumentException: AWS Access Key must be passed in by the [awsAccessKey] system property or be present in the AWS config file at com.rmn.qa.aws.AwsVmManager.getCredentials(AwsVmManager.java:171) ~[automation-grid.jar:na] at com.rmn.qa.aws.AwsVmManager.(AwsVmManager.java:91) ~[automation-grid.jar:na] at com.rmn.qa.servlet.AutomationTestRunServlet.(AutomationTestRunServlet.java:79) [automation-grid.jar:na] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [na:1.8.0_181]

On Thu, Sep 27, 2018 at 11:08 PM Ragavan Ambighananthan < [email protected]> wrote:

java -Xms2048m -Xmx4096m
-DpropertyFileLocation=/opt/hub/aws.properties.default
-DipAddress="${IP_ADDRESS}" \ -DtotalNodeCount=100 \ -DPOOL_MAX=1024 \ -cp /opt/hub/automation-grid.jar org.openqa.grid.selenium.GridLauncherV3
-servlets "com.rmn.qa.servlet.AutomationTestRunServlet","com.rmn.qa.servlet.StatusServlet" \ -role hub \ -hubConfig /opt/hub/hub.static.json \ -log grid.log @RayChenLDL https://github.com/RayChenLDL @xxCoDeBoX https://github.com/xxCoDeBoX note the GridLauncherV3 Also try having the keys under ~/.aws/credentials or ~/.aws/config

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mhardin/SeleniumGridScaler/issues/24#issuecomment-425083890, or mute the thread https://github.com/notifications/unsubscribe-auth/AmxNHqcN-OXGtyNLxML3h5XBUUmHls1Eks5ufM3JgaJpZM4UGlpD .

RayChenLDL avatar Oct 02 '18 00:10 RayChenLDL

Hi All,

I have the same issue. I have used the AWS Secret and Access keys inline with the Java command, it wasn't working. This is throwing "AWS was not able to validate the provided access credentials".

Post that following this post I have changed it aws configure or aws config but I get an additional exception saying, "falling back on IAM role as access / secret key not configured" This indicates that the aws configure / aws config is not making any effect. I have tried this with ec2-user / root but the issues exist.

Is there anything I am potentially doing wrong here?

sivakumarms avatar Jul 11 '19 16:07 sivakumarms

Hi,

We had same issue and spent quite sometime trying figure out the issue, finally we had to update aws java sdk to 1.9 (1.10 also works) and rebuild the jar which worked with ~/.aws/credentials , hope this information would help someone facing same issue,

Also , can you please let me know where can we download/find the jar file for node, I have tried using below versions but getting an server error 500 response and node is unable to register to grid(though autoscaling works fine)

Execution commsnd : java -Dwebdriver.chrome.driver="/opt/packages/chromedriver" -jar selenium-server-standalone-3.4.0.jar -role node -nodeConfig /opt/packages/node.linux.json

selenium-server-standalone-3.4.0.jar selenium-server-standalone-3.141.59.jar selenium-server-standalone-3.14.0.jar selenium-server-standalone-3.11.0.jar

khoshalarpy avatar Jul 19 '19 07:07 khoshalarpy

Hi @ambirag / @xxCoDeBoX / @RayChenLDL

When we executing the tests , the nodes are getting terminated exactly at 20 minutes and we have been looking at the configurations for this but could not find , appreciate any help on this

please let me know if any specific configuration/parameter needs to be passed to resolve this

khoshalarpy avatar Oct 31 '19 12:10 khoshalarpy