4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

コストを抑えて ComfyUI を AWS EC2 で動かしてみた

Posted at

はじめに

こんにちは.

EC2 スポットインスタンスを活用することで
コストを抑えつつ ComfyUI を実行する方法をご紹介します.

なお, 今回ご紹介するコードはサンプルコードです.
EC2 の URL を特定されてしまえば
誰からでもアクセスできてしまうので適宜調整してくださいませ.

構成

User --- http://ec2...:8188 ---> ComfyUI on EC2(Spot Instance)

前提

  • Spot Instance quotas > All G and VT Spot Instance Requests の引き上げ
    • 注意: 使用する EC2 インスタンスタイプの vCPU 数で緩和申請をしておいてください. 申請が受理されていない場合, 下記 AWS リソースの作成時にエラーとなります
    • 例: g6.xlarge の vCPUs は 4 ですので, 4 で申請してください

コード

準備
$ git clone https://github.com/dev-kawano-y/image-generator.git
$ cd image-generator
$ npm ci
AWS リソース作成
$ cdk deploy
ComfyUI にアクセス
http://ec2-...:8188
AWS リソース削除
$ cdk destroy

ポイント

  • リージョンはバージニア北部を利用する
    • 東京リージョンと比較するとコストを抑えることが可能
  • スポットインスタンスを利用する

最後に

お試し後は $ cdk destroy にてリソースの削除を行ってくださいませ.

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?