I couldn't a launch spot instance with latest ec2-plugin.
I investigated the cause by debuging on local machine and found that requestSpotInstances failed with a following error message.
com.amazonaws.AmazonServiceException: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. (Service: AmazonEC2; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: cd0cd93d-cdc6-45d9-8cdd-5a5b72ed1416)
As a result of a more detail investigation, a "LaunchSpecification#setSecurityGroups" caused the problem. When I commented out the code, I could launch an spot instance without the error ( of course, I couldn't access the instance because of lack of an appropriate security group ).
workaround
I downgraded version of aws-java-sdk to 1.9.40 written in pom.xml.
It happens when the library whose version is 1.10.* or later is used. So I downgraded it manually and fixed some compile errors according to the downgrading.
It seems ok but I don't confirmed whether there is another problem.
permanent fix
I'm not sure but I think fixing and updating aws-java-sdk will solve this problem in the future. Current latest version ( 1.10.14 ) of the library cannot solve this problem.
stack trace
com.amazonaws.AmazonServiceException: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. (Service: AmazonEC2; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: cd0cd93d-cdc6-45d9-8cdd-5a5b72ed1416)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1160)
at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:748)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:467)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:302)
at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:11768)
at com.amazonaws.services.ec2.AmazonEC2Client.requestSpotInstances(AmazonEC2Client.java:7027)
at hudson.plugins.ec2.SlaveTemplate.provisionSpot(SlaveTemplate.java:784)
...
|