0
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?

AWSコンテナ設計・構築本格入門 2025年にやってみる

Last updated at Posted at 2025-04-29

Cloud9が動かない問題への対処

Cloud9がいつの間にか新規での利用受付を停止したようなので、EC2インスタンスからで問題なし。

EC2の用途

基本的にdockerのイメージをビルドしてECRに登録するだったり、ECRに疎通確認をするくらいの用途なので、IDEとしての機能は使わない。

設定方法

  1. cloud formation のtemplate「network_step1/2」に以下を追記し、セキュリティグループを作成
      ### Local PC -> VPC endpoint
      sbcntrSgManagementIngressSSH:
        Type: AWS::EC2::SecurityGroupIngress
        Properties:
          IpProtocol: tcp
          Description: SSH access from your IP (replace CidrIp accordingly)
          FromPort: 22
          GroupId:
            Fn::GetAtt:
              - sbcntrSgManagement
              - GroupId
          ToPort: 22
          CidrIp: xxx.xxx.xxx.xx/32 ここにローカルPCのIPをいr
    
  2. EC2インスタンスを作成。イメージを作るときに容量が足りないと面倒なので、無料利用枠の30GB。t2.microでOK。
  3. EC2インスタンス作成時に払いだしたキーペアでSSHクライアントを使ってSSHで接続。

時間かけるとコストがかかる問題に対処する

そこそこコストがかかる

image.png
主にかかるコストは以下。一日7$くらいかかる。。。

  • ec2インスタンス
  • VPCエンドポイント(interface)
  • ロードバランサー
  • ECSクラスタ

対処方法

  • ec2インスタンス
    -> 普通に止めておくだけ
  • VPCエンドポイント(interface)
    -> 停止の概念がないので、formar2を使ってcloudformation templateにしておく
  • ロードバランサー
    -> 停止の概念がないので、formar2を使ってcloudformation templateにしておく
  • ECS
    -> ECSサービスの起動するタスクをゼロにする(backend)。frontendはタスクを直接作成しているはずなので、タスクを落とす。

formar2とは

以下記事を参考にローカル環境でdockerを立ち上げWEB画面から操作するのみ。途中IAMロール・ユーザを作成する必要があるが、この記事の通りに進めれば大丈夫。formar2の画面でリージョンを選択する必要があるのではまらないように気を付けて。
https://qiita.com/y_inoue15/items/26c245c9e9fdf42c75a4

アプリが0.0.0.0で全開放が怖い問題

普通にセキュリティグループのIngressから既存のレコードを削除し、MyIPで登録しなおすのみ。画面からでOK。

0
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
0
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?