.serverless folder after deploy

do we have to keep the .serverless folder after deploy?

No. It’s a bit annoying it doesn’t go away… but it’s nice to be able to review the generated CloudFormation file and zipped bundle immediately if you need to debug your serverless.yml configuration.

This folder will get regenerated every time you deploy and is just a build artifact, you and safely delete/ignore it.

In the past we had it the other way around where it was deleted after the deployment, now we delete and recreate and leave it so its easier to debug things. We should probably add this to .gitignore of each template: https://github.com/serverless/serverless/issues/2343

So if .serverless directory is not needed where are information stored? If I checkout code on different machine how does serverless knows which function to update?

The deploy bucket automatically created on s3, and the CloudFormation stack

Nice idea. Thanks for explanation.