Monday, November 18, 2019

DynamoDB: InvalidSignatureException : The request signature we calculated does not match the signature you provided


In one of our application, while connecting to DynamoDB, our application was getting following exception-

com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException:
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.

There was no deployment on our side and we were surprised to see this issue. This issue was not happening for all the requests to DynamoDB. So, we were not sure where is the problem coming from.

There are already various posts to troubleshoot this exception-
1. https://docs.aws.amazon.com/general/latest/gr/signature-v4-troubleshooting.html
2. Problem with the skewed clocks on the server.
3. Access token not valid.

We tried all the steps as suggested by AWS tech support, various posts on google or stack overflow but none of these worked out.

So, we enabled the debug logs and analyzed the POST requests going to DynamoDB. After going through the request payload and headers, we found out that -
1. All failed requests have extra header "lets-say-xyz_now" which was passed to DynamoDB request.
2. All successful requests did NOT have extra header "lets-say-xyz_now" in the request to DynamoDB.

So, AWS was using this extra header in the signing algorithm which caused this exception.

One of our upstream services passed this header which got passed to DynmoDB. So, we removed the extra header and everything started working again.

Another suspect is underscore(_) present in the header. Some blogs suggest that nginx drops headers with underscore. http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers

Monday, June 16, 2014

Starting Jenkins

Here is the simple command to start jenkins server. Download the .war file from Jenkins website
and run command below-
$ nohup java -Xms1024m  -Xmx8192m -XX:MaxPermSize=1024M -XX:+UseParallelOldGC -XX:ParallelGCThreads=4 -XX:+HeapDumpOnOutOfMemoryError  -Dhudson.util.ProcessTree.disable=true -Djava.awt.headless=true -DHUDSON_HOME=. -jar jenkins.war --httpPort=8585 

Sunday, July 7, 2013

Remove path from prompt in ubuntu

Most of the times in linux machine, you will get a prompt which shows complete path of present working directory i.e pwd. It looks like as -"/home/akash/dir1/movies/hindi/latest$"
But I want to see only "$" prompt on my terminal.
How to achieve this?
Ans: Simple, just export following variable or add it to .bashrc file
export PS1="\u $ "

Tuesday, April 16, 2013

Automounting error on Ubuntu:

 When you have dual boot machine, say windows and ubuntu. If you are currently running windows and hibernated it. Now, your machine is off and you decided to boot ubuntu. When ubuntu is started, now if you try to mount the windows drives, it will pop out error similar to the one mentioned below-
 
Mounting exited with exit code 14:windows is hibernated, refused to mount. Failed to mount '/dev/sde2':Operation not permitted. The NTFS partition is hibernated. Please resume and shutdown windows properly or mount the volume read-only with the 'ro' mount option, or mount the volume read-write with the 'remove_hiberfile' mount option. For example type in command line:  

Solution: Run the command similar to the one written below-
$ sudo mount -t ntfs-3g -o remove_hiberfile  /dev/sda1   /media/akash

where, /dev/sda1 is windows partition

Thursday, February 28, 2013

SSH without password

SSH to server/client without entering ssh password:

I would like to thank my friend, guide Mr. Rajendra to help me.

Suppose there are two Linux machines. In my case both were ubuntu machines say buntu1 and buntu2

On buntu1  machine-
# ssh-keygen -t rsa
# cat ~/.ssh/id_rsa.pub | ssh  user_buntu2@buntu2 'cat >> ~/.ssh/authorized_keys'

Here it will ask the password once to open ssh to buntu2. 

On buntu2  machine-
# ssh-keygen -t rsa
# cat ~/.ssh/id_rsa.pub | ssh  user_buntu1@buntu1 'cat >> ~/.ssh/authorized_keys'

Here it will ask the password once to open ssh to buntu1. 

From now on, ssh will never ask for password. 

Monday, November 26, 2012




"Couldn't load plug in" error when playing videos in google chrome on windows 7.

This can happen with PCs that are running the Enhanced Mitigation Toolkit.
If you are running EMT, do this:
1.  Start/All Programs
2.  Choose the Enhanced Mitigation Toolkit folder and select the EMT app
3.  Windows 7 has a pop up User Account Control Window - say "Yes"
4.  The EMT then appears.  Click on the "Configure Apps" button
5.  You'll see Chrome.exe listed at least once under the "App Name" column.  Uncheck the "SEHOP" boxes to the right of those chrome.exe entries.
6.  Choose OK
7.  Close the EMT window
8.  Close Google Chrome
9.  Reopen Google Chrome and go to a site like YouTube and run a video.  It might just work for you.