以下は `'Load Balanced Web Service'` Manifest で利用できるすべてのプロパティのリストです。[Copilot Service の概念](../concepts/services.ja.md)説明のページも合わせてご覧ください。 ???+ note "インターネット向け Service のサンプル Manifest" === "Basic" ```yaml name: 'frontend' type: 'Load Balanced Web Service' image: build: './frontend/Dockerfile' port: 8080 http: path: '/' healthcheck: '/_healthcheck' cpu: 256 memory: 512 count: 3 exec: true variables: LOG_LEVEL: info secrets: GITHUB_TOKEN: GITHUB_TOKEN DB_SECRET: secretsmanager: '${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/mysql' ``` === "With a domain" ```yaml name: 'frontend' type: 'Load Balanced Web Service' image: build: './frontend/Dockerfile' port: 8080 http: path: '/' alias: 'example.com' environments: qa: http: alias: # 証明書インポート済みの "qa" Environment - name: 'qa.example.com' hosted_zone: Z0873220N255IR3MTNR4 ``` === "Larger containers" ```yaml # 例えば、外部からのトラフィックを受け入れる前に、Java サービスをウォームアップしておきたい場合など。 name: 'frontend' type: 'Load Balanced Web Service' image: build: dockerfile: './frontend/Dockerfile' context: './frontend' port: 80 http: path: '/' healthcheck: path: '/_deephealthcheck' port: 8080 success_codes: '200,301' healthy_threshold: 4 unhealthy_threshold: 2 interval: 15s timeout: 10s grace_period: 2m deregistration_delay: 50s stickiness: true allowed_source_ips: ["10.24.34.0/23"] cpu: 2048 memory: 4096 count: 3 storage: ephemeral: 100 network: vpc: placement: 'private' ``` === "Autoscaling" ```yaml name: 'frontend' type: 'Load Balanced Web Service' http: path: '/' image: location: aws_account_id.dkr.ecr.us-west-2.amazonaws.com/frontend:latest port: 80 cpu: 512 memory: 1024 count: range: 1-10 cooldown: in: 60s out: 30s cpu_percentage: 70 requests: 30 response_time: 2s ``` === "Event-driven" ```yaml # https://aws.github.io/copilot-cli/docs/developing/publish-subscribe/ を参照してください。 name: 'orders' type: 'Load Balanced Web Service' image: build: Dockerfile port: 80 http: path: '/' alias: 'orders.example.com' variables: DDB_TABLE_NAME: 'orders' publish: topics: - name: 'products' - name: 'orders' fifo: true ``` === "Network Load Balancer" ```yaml name: 'frontend' type: 'Load Balanced Web Service' image: build: Dockerfile port: 8080 http: false nlb: alias: 'example.com' port: 80/tcp target_container: envoy network: vpc: placement: 'private' sidecars: envoy: port: 80 image: aws_account_id.dkr.ecr.us-west-2.amazonaws.com/envoy:latest ``` === "Shared file system" ```yaml # http://localhost:8000/copilot-cli/docs/developing/storage.ja.md#ファイルシステム を参照してください。 name: 'frontend' type: 'Load Balanced Web Service' image: build: Dockerfile port: 80 depends_on: bootstrap: success http: path: '/' storage: volumes: wp: path: /bitnami/wordpress read_only: false efs: true # ブートストラップコンテナを使って、ファイルシステム内のコンテンツを用意しておきます。 sidecars: bootstrap: image: aws_account_id.dkr.ecr.us-west-2.amazonaws.com/bootstrap:v1.0.0 essential: false mount_points: - source_volume: wp path: /bitnami/wordpress read_only: false ``` === "End-to-end encryption" ```yaml name: 'frontend' type: 'Load Balanced Web Service' image: build: Dockerfile port: 8080 http: alias: 'example.com' path: '/' healthcheck: path: '/_health' # プロトコルでの指定の結果により、envoy コンテナのポートは 443 です。ヘルチェックプロトコルは `HTTPS` になります。 # ロードバランサーは Fargate タスクと TLS 接続します。envoy コンテナに # インストールした証明書が利用されます。それらの証明書は自己証明書です。 target_container: envoy sidecars: envoy: port: 443 image: aws_account_id.dkr.ecr.us-west-2.amazonaws.com/envoy-proxy-with-selfsigned-certs:v1 network: vpc: placement: 'private' ``` === "Expose Multiple Ports" ```yaml name: 'frontend' type: 'Load Balanced Web Service' image: build: './frontend/Dockerfile' port: 8080 nlb: port: 8080/tcp # Traffic on port 8080/tcp is forwarded to the main container, on port 8080. additional_listeners: - port: 8084/tcp # Traffic on port 8084/tcp is forwarded to the main container, on port 8084. - port: 8085/tcp # Traffic on port 8085/tcp is forwarded to the sidecar "envoy", on port 3000. target_port: 3000 target_container: envoy http: path: '/' target_port: 8083 # Traffic on "/" is forwarded to the main container, on port 8083. additional_rules: - path: 'customerdb' target_port: 8081 # Traffic on "/customerdb" is forwarded to the main container, on port 8083. - path: 'admin' target_port: 8082 # Traffic on "/admin" is forwarded to the sidecar "envoy", on port 8082. target_container: envoy sidecars: envoy: port: 80 image: aws_account_id.dkr.ecr.us-west-2.amazonaws.com/envoy-proxy-with-selfsigned-certs:v1 ``` `name` String Service の名前。
`type` String Service のアーキテクチャタイプ。 [Load Balanced Web Service](../concepts/services.ja.md#load-balanced-web-service) は、ロードバランサー及び AWS Fargate 上の Amazon ECS によって構成される、インターネットに公開するための Service です。 `http` Boolean or Map http セクションは Application Load Balancer と Service との連携に関するパラメータを含みます。 Application Load Balancer を無効化する場合は、 `http: false` と指定します。 Load Balanced Web Service では、Application Load Balancer または、Network Load Balancer が少なくとも 1 つ有効となっていなければならない事に注意してください。 http.`path` String このパスに到着したリクエストが、Service に転送されます。各リスナールールは一意のパスでリクエストを受け付ける必要があります。 {% include 'http-healthcheck.ja.md' %} http.`deregistration_delay` Duration 登録解除時にターゲットがクライアントとの接続を閉じるのを待つ時間を指定します。デフォルトでは 60 秒です。この値を大きくするとターゲットが安全に接続を閉じるための時間を確保できますが、新バージョンのデプロイに必要となる時間が長くなります。範囲は 0 〜 3600 です。 http.`target_container` String サイドカーコンテナを指定することで、Service のメインコンテナの代わりにサイドカーでロードバランサーからのリクエストを受け取れます。 ターゲットコンテナのポートが `443` に設定されている場合、プロトコルは `HTTP` に設定され、ロードバランサーは Fargate タスクと TLS 接続します。ターゲットコンテナにインストールされた証明書が利用されます。 http.`target_port` String 任意項目。トラフィックを受信するコンテナポート。デフォルトでは、ターゲットコンテナがメインコンテナの場合、`image.port` 、 ターゲットコンテナがサイドカーの場合は、`sidecars.