Python製のプロビジョニングツールであるFabricを使って、ELB + EC2環境にアプリケーションをローリングデプロイします。 ELBから1台ずつEC2インスタンスを切り離して、アプリケーションをデプロイしてリスタート、終わったら、ELBにEC2インスタンスを追加します。 なぜ、Fabricを使ったかというと、ほかのデプロイ自動化ツール、たとえばCapistranoやAnsibleだと、ELBのAPIを叩く処理を書くのがちょっと面倒そうだったからです。Fabricなら使いやすそうなPythonライブラリがあり、簡潔に書けるな、と考えたからです。 以下のFabricスクリプトは、ロールバックやヘルスチェックなどの処理を書いていません。もうちょっと高級なことがしたかったら、他の方法を考えたりするといいと思います。 ※ ELBは、Classic load balancerを使っています。