LoginSignup
1
0

Learn to compare AWS and Google Cloud: About ECS

Posted at

188563c93c3a2a-a.jpeg

Amazon Elastic Container Service (ECS) 1 について。

前職で使用していた Google Cloud のサービスと関連付けながら学ぶ。

ECS はほとんど触ったことがなかった。

ECS の設定周りと RDS へのの接続について学ぶ。

tl;dr

  • Rust の App を ECS Fargate で動かした。
  • AWS を利用する上では「セキュリティ グループ」が重要だと思う。サービス間の inbound/outbound を正しく理解すること。
  • 「セキュリティ グループ」は Google Cloud の Firewall と同じ位置付けになると思う。それと IAM が必要。

About CodeBuild

188563c93c3a2a-c.png

  • Cloud Build に似たサービス。
  • buildspec.yml を定義。Cloud Build のビルド構成ファイル 2 のような。

Item Google Cloud AWS note
Build の定義 yaml yaml GitHub で管理
Docker の代替 mirror.gcr.io Amazon ECR Public Gallery Docker 3
環境変数 デフォルトとユーザー定義 4 デフォルトとユーザー定義 5
権限と権限の付与 基本的に Default Google Service Account に権限を付与 IAM

Point 💡

  • DockerHub の rate limit 6 に引っかかるため、 Amazon ECR Public Gallery Docker 3 に変更。
#4 [internal] load metadata for docker.io/library/rust:latest
#4 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/rust/manifests/sha256:00e330d2e2cdada2b75e9517c8359df208b3c880c5e34cb802c120083d50af35: 429 Too Many Requests - Server message: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
------
 > [internal] load metadata for docker.io/library/rust:latest:
------

About Amazon Elastic Container Registry (ECR)

188563c93c3a2a-d.png

  • Artifact Registry に似たサービス。

About ECS

188563c93c3a2a-e.png

  • Cloud Run に似たサービス。
  • 「タスク」と「サービス」への理解が必要。
yamamotodaisuke@yamamotodaisukenoMacBook-Air zenn-docs % curl -i 44.x.x.x                              
HTTP/1.1 200 OK
content-type: application/json
content-length: 31
date: Wed, 27 Mar 2024 02:36:35 GMT

[{"user_id":1},{"user_id":999}]%                                                                                                                                                      
yamamotodaisuke@yamamotodaisukenoMacBook-Air zenn-docs %

188563c93c3a2a-b.png

Point 💡

  • セキュリティグループの設定:
    • ECS Fargate タスクのセキュリティ グループと RDS インスタンスのセキュリティ グループにお互いの通信を許可するルールを追加します。
    • 具体的には以下を許可する inbound/outbound ルールを追加します。
      • タイプ: PostgreSQL
      • プロトコル: TCP
      • ポート範囲: 5432

BTW

もうすぐで有給消化期間が終わる

起床して running。カフェで programming しつつ、夕食作りや洗濯、掃除、塾の送迎をする毎日

社会性の動物であることを認識した

仕事が無いと人との関わりが薄れている状態

より大事にするべきことは何かを考えさせられた

まさに「人生後半の戦略書」のとおり

  1. https://aws.amazon.com/jp/ecs/

  2. https://cloud.google.com/build/docs/configuring-builds/create-basic-configuration?hl=ja

  3. https://gallery.ecr.aws/docker 2

  4. https://cloud.google.com/build/docs/configuring-builds/substitute-variable-values?hl=ja

  5. https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/taskdef-envfiles.html

  6. https://docs.docker.com/docker-hub/download-rate-limit/

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