'How to package and version a SAM application for deployment to multiple environments?

I have an AWS SAM-based app/service. I would like to follow the practice of a Continuous Integration pipeline (CI) that results in a versioned deployable artifact that can be deployed to various environments (e.g. Dev, Test, Prod) through Deployment pipelines. This is similar to factor 5 of the 12 Factors: https://12factor.net/build-release-run

There does not appear to be an appropriate pattern to accomplish this leveraging sam deploy.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source