Manual deployment through AWS Console, help with update stack codesha256 error

Hello all,

At current client, we are not allowed to use serverless framework to deploy hence we are using cloudformation on aws console to create/update stack. My goal is to eliminate any manual changes we have to make to template for us to deploy the stack.

Here is the current procedure we use -

  • On Build machine, run serverless package --stage=poc --package C:\testserverlessoutput

  • Change all S3Key location from serverless/service/stage/1531247025880-2018-07-10T18:23:45.880Z/ to

  • Copy the update stack json and zip to S3

  • Create/Update stack by pointing to S3 template and selecting deployment role

This process has been working fairly well except when we try to update a stack when there is changes to code base. Error we get is about CodeSha256 not matching and hence deployment stops. For now, when we see this we remove all CodeSha256 key occurrences and move past the issue. I want to see if there is a way to eliminate all the manual edits of template. I currently provide the deployment bucket so S3Bucket is fine, the S3Key is the issue along with CodeSha256 issue.

I also notice that serverless package generates the serverless-state.json and I am not sure how does that play into the whole deployment using serverless. As the name suggest does it play any part in maintaining state in some way so during update stack using serverless I dont see the codesha256 error? If so, how can I use that in manual deployment to avoid codesha issue?

Any pointers here will be helpful.


1 Like

I am facing same issue. I first Bundle using sls package then i am deploying same package using sls deploy --package. However, It is throwing error
CodeSHA256 (***) is different from current CodeSHA256 in $LATEST (***). Please try again with the CodeSHA256 in $LATEST. (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 25f3ca32-0448-423b-af43-c054fa913777)