Purpose of sls package if sls deploy still requires serverless.yml

I’m trying to understand the purpose of sls package. My assumption was you can package your code up and then later do an sls deploy WITHOUT needing the code since you have the package. But when I do sls deploy and specify a package directory it still requires me to have the correct serverless.yml file. Shouldn’t the package contain everything necessary to deploy? In my cicd workflow I want to repeatably deploy a package without the need to make sure the serverless.yml is the correct revision.

I was wondering about this too. We want to make use of ssm parameters in our config that live in a different AWS account from the account we are deploying to. I thought I could make it work by packaging using a role in the account where the ssm store is, then deploy using a role from the other account, but because serverless deploy still evaluates serverless.yml on deploy it doesn’t seem to work

For testing and debugging. You can run package and then take a look at your .serverless folder and review the cloudformation it produces and the zip file it creates. You can often find a lot of problems with your configuration that way and help optimize your package sizes.