こんにちは、エンジニアインターンの佐藤です。 SAMを使えば、LambdaやAPI Gatewayの再現をローカルで行うことができ、そのデプロイもできます。しかし、API Gatewayにはステージがあったり、Lambdaにはエイリアスがあったりと、どれを活用するべきなのかまとまっている記事がありませんでした。 この記事では、そのわかりにくい概念から説明し、SAMデプロイのベストプラクティスを紹介していきます。 またSAMについては、2つ記事を出しているので、ぜひ見てみてください。 ・AWS SAM + DockerでAWSサーバーレス環境をローカル構築する ・CloudFrontなしでS3をHTTPSカスタムドメインでホスティングしてみた ※SAMのバージョンは1.24.1を使用しています API Gatewayのステージ Lambdaのエイリアスとバージョニング template.ya