AWS CodeDeploy Invalid Signature

I’ve spent a lot of time trying to find the root cause for an issue while using AWS CodeDeploy.

The error message was invalid signature, the requested signature does that match the request.

The strange thing is that my code did not change and it was working before. So I created a new aws user with full permissions on S3 and CodeDeploy actions. I also downloaded the latest cli tool. After that I setup the profile to use my new aws user. I have a simple batch file that calls aws deploy push and then it calls aws deploy create-deployment.

When we use aws deploy push, we are creating a new revision and also the zip file gets copied to the s3 bucket.

The strange thing with these calls was that I was getting a confirmation message that included the new deployment id. I had to admit that the error message did not help me find the root cause. Invalid signature?

After a few days researching online, another user had the same issue and he shared that it was related to the S3 bucket and key.

The S3 bucket was not correct because it contained bucket name plus project name and configuration. The bucket name should only contain a bucket name and nothing else. Then I updated the key to be in format [projectname]/[configuration]/[key]. In our project the key was website/dev/23.zip.

After triggering test builds, I was able to verify our deployments were running successfully.

Hopefully aws can change the invalid signature and provide the specific parameter causing the error.