SlideShare une entreprise Scribd logo
1  sur  81
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS 公式 Webinar
https://amzn.to/JPWebinar
過去資料
https://amzn.to/JPArchive
Solutions Architect, Containers
Kyosuke Ochimizu
2020/10/14
AWS App Mesh Deep Dive
サービスカットシリーズ
[AWS Black Belt Online Seminar]
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
⾃⼰紹介
• Specialist Solutions Architect, Containers
• AWS のコンテナ関連サービスを担当
• 好きなサービス
• Amazon Elastic Container Service (Amazon ECS)
• Amazon Elastic Kubernetes Service (Amazon EKS)
落⽔ 恭介 (Ochimizu Kyosule)
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Black Belt Online Seminar とは
「サービス別」「ソリューション別」「業種別」のそれぞれのテーマに分かれて、アマゾ
ン ウェブ サービス ジャパン株式会社が主催するオンラインセミナーシリーズです。
質問を投げることができます︕
• 書き込んだ質問は、主催者にしか⾒えません
• 今後のロードマップに関するご質問は
お答えできませんのでご了承下さい
① 吹き出しをクリック
② 質問を⼊⼒
③ Sendをクリック
Twitter ハッシュタグは以下をご利⽤ください
#awsblackbelt
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
内容についての注意点
• 本資料では 2020 年 10 ⽉ 14 ⽇現在のサービス内容および価格についてご説明しています。最
新の情報は AWS 公式ウェブサイト (http://aws.amazon.com) にてご確認ください。
• 資料作成には⼗分注意しておりますが、資料内の価格と AWS 公式ウェブサイト記載の価格に相
違があった場合、AWS 公式ウェブサイトの価格を優先とさせていただきます。
• 価格は税抜表記となっています。⽇本居住者のお客様には別途消費税をご請求させていただきま
す。
• AWS does not offer binding price quotes. AWS pricing is publicly available and is subject to
change in accordance with the AWS Customer Agreement available at
http://aws.amazon.com/agreement/. Any pricing information included in this document is
provided only as an estimate of usage charges for AWS services based on certain information
that you have provided. Monthly charges will be based on your actual use of AWS services, and
may vary from the estimates provided.
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
本セミナーの概要
• 本セミナーで学習できること
Ø 異なるプラットフォームで稼働するサービスの
サービス間通信に AWS App Mesh を導⼊するメリット
Ø Amazon ECS および Amazon EKS における
AWS App Mesh の具体的な利⽤⽅法
• 対象者
Ø AWS App Mesh の導⼊を検討しているアーキテクト、
技術者の⽅
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
本⽇のアジェンダ
• サービスメッシュとは︖
• AWS App Mesh の概要
• Example for AWS App Mesh
• AWS App Mesh の利⽤料⾦
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
本⽇のアジェンダ
• サービスメッシュとは︖
• AWS App Mesh の概要
• Example for AWS App Mesh
• AWS App Mesh の利⽤料⾦
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
サービスメッシュとは
アプリケーションレベルの通信を、アプリケーション⾃⾝が制御するのではなく
インフラストラクチャーで制御できるようにする技術
Node.js Java Go Ruby
http/tcp
http/tcp
http/tcp
アプリケーションが⾏う通信制御
• HTTP 通信のリトライやタイムアウト
• 通信のトレーシングやログ、メトリクスの取得
• TLS を使⽤した暗号化通信
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
サービスメッシュとは
• HTTP 通信のリトライやタイムアウト
• 通信のトレーシングやログ、メトリクスの取得
• TLS を使⽤した暗号化通信
アプリケーションレベルの通信制御を、サービスメッシュの基盤で⾏うので、
アプリケーションに組み込む必要がなくなる
サービスメッシュ基盤
Node.js Java Go Ruby
http/tcp
http/tcp
http/tcp
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
サービスメッシュが求められるようになった背景
• 現代のシステムは 複数の⾔語、アーキテクチャ、アプリケーション で構成
• クラウドにより多様な環境が簡単に作成できるように
• マイクロサービスアーキテクチャの採⽤
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
例: 多様なアプリケーションが通信を⾏うシステム
• チームごとに最適な技術を選択してアプリケーションを動かす
• プログラミング⾔語だけでなく、VM やコンテナなど様々なコンピューティ
ングプラットフォームを選択できる
Node.js
チーム A
VM
チーム B
コンテナ
Java
チーム C
Go
Ruby
コンテナ
VM
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
全てのアプリケーションに、同じような通信の仕組みが必要
• 信頼性の確保
• リトライやタイムアウト、暗号化通信の実装
• 可観測性の確保
• メトリクスやトレース、ログの出⼒と収集
Node.js
チーム A
VM
チーム B
コンテナ
Java
チーム C
Go
コンテナ
VM
Ruby
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ライブラリによる通信制御の共通化
共通ライブラリ
通信の仕組みを共通ライブラリとして実装、配布
• リトライやタイムアウト、暗号化通信の実装
• メトリクスやトレース、ログの出⼒と収集
チーム A
Go RubyJavaNode.js
チーム B チーム C
共通基盤チーム
Node.js Java Go Ruby
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
共通ライブラリの導⼊における課題
• 共通ライブラリを⼊れると依存関係が衝突する
• ⾔語ごとにライブラリを実装する必要があり負担が⼤きい
チーム A
Go RubyJavaNode.js
チーム B チーム C
アプリケーション開発者・共通基盤チーム共に運⽤負荷が増⼤する
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アプリケーションから通信処理を分離
Node.js Java
Proxy
アプリケーション間の通信をプロキシして、通信制御を⾏うプロセス
Proxy Proxy
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
サービスメッシュの仕組み
Node.js Java Go Ruby
http/tcp
http/tcp
http/tcp
サービスメッシュ基盤
Control plane
プロキシをコントロールプレーンで管理
=> アプリケーションレベルの通信制御をインフラストラクチャ側で管理可能に
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh とは
Node.js Java Go Ruby
http/tcp
http/tcp
http/tcp
Control plane
Envoy を管理するコントロールプレーンを提供するサービスメッシュ
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
本⽇のアジェンダ
• サービスメッシュとは︖
• AWS App Mesh の概要
• Example for AWS App Mesh
• AWS App Mesh の利⽤料⾦
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
[再掲] AWS App Mesh とは
Node.js Java Go Ruby
http/tcp
http/tcp
http/tcp
Control plane
Envoy を管理するコントロールプレーンを提供するサービスメッシュ
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh
サービスメッシュを管理するコントロールプレーンを提供する
Node.js Java
Control plane
• アプリケーションレベルの通信を
ネットワークモデルとして定義
• ネットワークモデルを Envoy の
設定に変換して配布
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
1. 通信元のアプリケーションは、通信先をサービスディスカバリーで
発⾒してリクエストを送信
2. リクエストがロードバランサーに到達
3. ロードバランサーが、複数の通信先にリクエストを振り分け
AWS App Mesh のネットワークモデル
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ネットワークモデルとアプリケーションの関係
Amazon EC2 AWS Fargate
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の動作イメージ
Application
container
Application
container
http/tcp
Amazon ECS タスク Amazon ECS タスク
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の動作イメージ: Envoy proxy の導⼊
http/tcp
Application
container
Envoy
container
Envoy
container
Application
container
Amazon ECS タスク Amazon ECS タスク
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の動作イメージ: ネットワークモデルとの関係
http/tcp
Application
container
Envoy
container
Envoy
container
Application
container
Amazon ECS タスク Amazon ECS タスク
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の動作イメージ: トップレベルの概念
http/tcp
Application
container
Envoy
container
Envoy
container
Application
container
Amazon ECS タスク Amazon ECS タスク
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の動作イメージ: トップレベルの概念
http/tcp
Application
container
Envoy
container
Envoy
container
Application
container
Amazon ECS タスク Amazon ECS タスク
Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
トップレベルの概念: Mesh
Mesh
• サービス間の通信制御を⾏う論理的な境界
• Mesh の中に Virtual Node や Virtual Service などを組み合わせて
ネットワークモデルを構築する
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
トップレベルの概念: Virtual Node
Mesh
• 実際のアプリケーションへの論理的なポインタ
• 例) ECS サービス、Kubernetes デプロイメント
• Envoy の実⾏時パラメータ (環境変数など) で Virtual Node 名を設定し、
アプリケーション (Envoy) と Virtual Node を関連づける
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
トップレベルの概念: Virtual Service
Mesh
• アプリケーションの通信先を表す
• リクエストは Virtual Router または Virtual Node にルーティングされ、実
際のアプリケーションに到達する
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
トップレベルの概念: Virtual Router
Mesh
• リクエストのルーティングを管理するロードバランサー
• 単⼀または複数の Virtual Node にルーティングされる
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
トップレベルの概念まとめ
http/tcp
Application
container
Envoy
container
Envoy
container
Application
container
Amazon ECS Amazon ECS
Mesh
• Mesh
• サービスメッシュの論理的な境界
• Virtual Node
• アプリケーションのポインタ
• Virtual Service
• アプリケーションの通信先
• Virtual Router
• ルーティング管理
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
関連資料
※AWS App Mesh の基本的な機能についての情報が必要の⽅は、下記の
AWS Black Belt Online Seminar の資料をご参照ください。
[AWS Black Belt Online Seminar]
AWS App Mesh
動画:
https://youtu.be/IC7sxVh7HNM
資料:
https://d1.awsstatic.com/webinars/jp/pdf/s
ervices/20200721_BlackBelt_AWS_App_Mes
h.pdf
Speaker 林 政利
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
本⽇のアジェンダ
• サービスメッシュとは︖
• AWS App Mesh の概要
• Example for AWS App Mesh
• AWS App Mesh の利⽤料⾦
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
例: Amazon ECS と Amazon EKS で稼働するサービス間通信
AWS Cloud
Users
VPC
Elastic Load Balancing
VPC
Elastic Load Balancing
Amazon EKS
Frontend
service
Amazon RDS
Frontend
service
Amazon RDS
Users
Amazon ECS
Backend
service
Backend
service
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
例: Amazon ECS と Amazon EKS で稼働するサービス間通信
AWS Cloud
Users
VPC
Elastic Load Balancing
VPC
Elastic Load Balancing
Amazon EKS
Frontend
service
Amazon RDS
Frontend
service
Amazon RDS
Users
Amazon ECS
Peering
connection
Backend
service
Backend
service
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
例: Amazon ECS と Amazon EKS で稼働するサービス間通信
AWS Cloud
Users
VPC
Elastic Load Balancing
VPC
Elastic Load Balancing
Amazon EKS
Frontend
service
Amazon RDS
Frontend
service
Amazon RDS
Users
Amazon ECS
Peering
connection
Backend
service
Backend
service
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
例: Amazon ECS と Amazon EKS で稼働するサービス間通信
1. Amazon ECS と Amazon EKS それぞれで
サービスが稼働している
2. ビジネス上の理由で、Amazon ECS で稼働する
サービスと Amazon EKS で稼働するサービス
の相互通信が必要に
3. [課題] アプリケーションコードの変更や、
対向サービスとの結合度が強くなってしまう
想定シナリオ
AWS App Mesh を導⼊することで、上記の課題の解決を図る
AWS Cloud
Users
VPC
Elastic Load Balancing
VPC
Elastic Load Balancing
Amazon EKS
Frontend
service
Amazon RDS
Frontend
service
Amazon RDS
Users
Amazon ECS
Peering
connection
Backend
service
Backend
service
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊後のサービス間通信
アプリケーションコードの変更︓
Ø リトライやタイムアウトの処理を Envoy proxy 側で
⾏うため、アプリケーション側の変更は最⼩限に
対向サービスとの結合度︓
Ø 実際のルーティング設定は AWS App Mesh 側で
⾏うため、対向サービスの状態や構成変更に依存しない
AWS Cloud
Users
VPC
Elastic Load Balancing
VPC
Elastic Load Balancing
Amazon EKS
Frontend
service
Amazon RDS
Frontend
service
Amazon RDS
Users
Amazon ECS
Peering
connection
Backend
service
Backend
service
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
例: AWS App Mesh 導⼊後の構成
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
AWS App Mesh
Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊⼿順
1. Amazon EKS での設定
Ø AWS App Mesh Controller For K8s による設定
2. Amazon ECS での設定
Ø マネジメントコンソールによる設定
3. Amazon EKS での設定
Ø Virtual node の更新
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
今回は以下の⼿順で AWS App Mesh を導⼊する
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊⼿順
1. Amazon EKS での設定
Ø AWS App Mesh Controller For K8s による設定
2. Amazon ECS での設定
Ø マネジメントコンソールによる設定
3. Amazon EKS での設定
Ø Virtual node の更新
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
Amazon EKS での導⼊⼿順はこちら
1. AWS App Mesh Controller For K8s のインストール
2. Namespace の変更
3. Mesh の作成
4. AWS Cloud Map 名前空間の作成
5. Virtual node の作成
6. Virtual router の作成
7. Virtual service の作成
8. Virtual node の更新
9. Deployment の更新
• https://docs.aws.amazon.com/eks/latest/userguide/mesh-k8s-integration.html
• https://aws.github.io/aws-app-mesh-controller-for-k8s/guide/installation/
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
1. AWS App Mesh Controller For K8s のインストール
前提条件:
• Kubernetes クラスターのバージョンが 1.13 以上
• AWS App Mesh および AWS Cloud Map を操作する権限が付与されている
• 管理ポリシー AWSAppMeshFullAccess / AWSCloudMapFullAccess
• ノード IAM ロール、もしくは IAM roles for service accounts で設定
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
1. AWS App Mesh Controller For K8s のインストール
# eks-charts リポジトリを Helm に追加
$ helm repo add eks https://aws.github.io/eks-charts
# App Mesh ⽤の custom resource definitions (CRD) を追加
$ kubectl apply -k github.com/aws/eks-charts/stable/appmesh-controller//crds?ref=master
# App Mesh Controller を実⾏する Namespace を追加
$ kubectl create ns appmesh-system
# App Mesh Controller をデプロイ
$ helm upgrade -i appmesh-controller eks/appmesh-controller --namespace appmesh-system
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
2. Namespace の変更
apiVersion: v1
kind: Namespace
metadata:
name: my-apps
labels:
mesh: my-mesh
appmesh.k8s.aws/sidecarInjectorWebhook: enabled
Mesh の指定、および Sidecar Injector の有効化を⾏う
例) Namespace my-apps
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
[補⾜] Sidecar Injector の設定について
Namespace の Label / Pod の Annotation で Inject Mode を制御#1
#1: appmesh.k8s.aws/sidecarInjectorWebhook
• enabled mode
Ø Sidecar が追加される
Ø Virtual Node / Virtual Gateway の設定がされていない場合、Pod の起動に失敗する
• disabled mode
Ø Sidecar の追加処理がスキップされる
• unspecified mode
Ø Virtual Node / Virtual Gateway の設定がされている場合、Sidecar が追加される
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
3. Mesh の作成
apiVersion: appmesh.k8s.aws/v1beta2
kind: Mesh
metadata:
name: my-mesh
spec:
namespaceSelector:
matchLabels:
mesh: my-mesh
例) Mesh my-mesh
spec.namespaceSelector:
Ø Mesh のメンバーとなるリソースが所属する
Namespace
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
4. AWS Cloud Map 名前空間の作成
Virtual node のサービスディスカバリに AWS Cloud Map を使⽤
$ aws servicediscovery create-private-dns-namespace 
--name my-mesh.svc.cluster.local 
--vpc {{VPC_ID}}
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
5. Virtual node の作成
apiVersion: appmesh.k8s.aws/v1beta2
kind: VirtualNode
metadata:
name: eks-frontend
namespace: my-apps
spec:
podSelector:
matchLabels:
app: eks-frontend
listeners:
- portMapping:
port: 80
protocol: http
serviceDiscovery:
awsCloudMap:
namespaceName: my-mesh.svc.cluster.local
serviceName: eks-frontend
例) Virtual node eks-frontend
spec.listeners:
Ø Virtual node のリクエスト受信設定
spec.serviceDiscovery:
Ø Virtual node と関連づけられている、実際の
アプリケーションのサービスディスカバリ情報
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
5. Virtual router の作成
apiVersion: appmesh.k8s.aws/v1beta2
kind: VirtualRouter
metadata:
namespace: my-apps
name: eks-backend-virtual-router
spec:
listeners:
- portMapping:
port: 80
protocol: http
routes:
- name: eks-backend-route
httpRoute:
match:
prefix: /
action:
weightedTargets:
- virtualNodeRef:
name: eks-backend
weight: 1
例) Virtual router eks-backend-virtual-router
spec.listeners:
Ø Virtual router のリクエスト受信設定
spec.routes:
Ø ルーティング情報
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
5. Virtual router の作成
spec.routes[].httpRoute:
Ø HTTP ルーティング情報
Ø http2Route や grpcRoute も設定可能
spec.routes[].httpRoute.match:
Ø route で処理をするリクエストの設定
spec.routes[].httpRoute.action:
Ø マッチしたリクエストの転送先
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
apiVersion: appmesh.k8s.aws/v1beta2
kind: VirtualRouter
metadata:
namespace: my-apps
name: eks-backend-virtual-router
spec:
listeners:
- portMapping:
port: 80
protocol: http
routes:
- name: eks-backend-route
httpRoute:
match:
prefix: /
action:
weightedTargets:
- virtualNodeRef:
name: eks-backend
weight: 1
例) Virtual router eks-backend-virtual-router
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
6. Virtual service の作成
apiVersion: appmesh.k8s.aws/v1beta2
kind: VirtualService
metadata:
name: eks-backend
namespace: my-apps
spec:
awsName: eks-backend.my-apps.svc.cluster.local
provider:
virtualRouter:
virtualRouterRef:
name: eks-backend-virtual-router
例) Virtual service eks-backend
spec.awsName:
Ø Virtual service のリソース名
spec.provider:
Ø Virtual service のリクエスト転送先
Ø Virtual router / Virtual node を指定
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
[補⾜] Virtual service のリソース名について
#1: https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_services.html#create-virtual-service
Virtual service name と実際のサービスディスカバリ名を揃えることを推奨#1
Ø 既存のコードを変更する必要がないため
my-service.default.svc.cluster.local
Application
Application
Application Application
my-service.default.svc.cluster.local
Application
Application
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
7. Virtual node の更新
apiVersion: appmesh.k8s.aws/v1beta2
kind: VirtualNode
metadata:
name: eks-frontend
namespace: my-apps
spec:
podSelector:
matchLabels:
app: eks-frontend
listeners:
- portMapping:
port: 80
protocol: http
backends:
- virtualService:
virtualServiceRef:
name: eks-backend
serviceDiscovery:
awsCloudMap:
namespaceName: my-mesh.svc.cluster.local
serviceName: eks-frontend
例) Virtual node eks-frontend
spec.backends:
Ø Virtual node がリクエストを送信する Virtual service
Ø 先ほど作成した VirtualService custom resource の
リソース名を指定
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
8. Deployment の更新
$ kubectl rollout restart deployment/XXX
...
Envoy proxy を Pod へ追加するためにローリングアップデートを⾏う
App Mesh
Controller
Application
Pod
Inject
Pod
AWS Cloud
Amazon EKS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊⼿順: Amazon EKS での設定
[再掲] 実施した⼿順はこちら
1. AWS App Mesh Controller For K8s のインストール
2. Namespace の変更
3. Mesh の作成
4. AWS Cloud Map 名前空間の作成
5. Virtual node の作成
6. Virtual router の作成
7. Virtual service の作成
8. Virtual node の更新
9. Deployment の更新
• https://docs.aws.amazon.com/eks/latest/userguide/mesh-k8s-integration.html
• https://aws.github.io/aws-app-mesh-controller-for-k8s/guide/installation/
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊⼿順
1. Amazon EKS での設定
Ø AWS App Mesh Controller For K8s による設定
2. Amazon ECS での設定
Ø マネジメントコンソールによる設定
3. Amazon EKS での設定
Ø Virtual node の更新
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
Amazon ECS での⼿順はこちら
1. Virtual node の作成
2. Virtual router の作成
3. Route の作成
4. Virtual service の作成
5. Virtual node の更新
6. タスク定義の更新
7. サービスの更新
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/appmesh-getting-started.html
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
[推奨] ECS サービスでサービス検出の統合が有効になっていること
• Virtual node の背後にいる実際のアプリケーションを検出するため
Ø ⾃前の仕組みを⽤意することも可能だが、運⽤⾯からサービス検出の利⽤を推奨
• [注意] ECS サービスの作成後、後からサービス検出の設定を変更することはできない#1
#1: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/appmesh-getting-started.html
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
1. Virtual node の作成
サービスの検出⽅法:
Ø ECS サービスで設定したサービス検出
の AWS Cloud Map 情報
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
1. Virtual node の作成
リスナー設定:
Ø Virtual node のリクエスト受信設定
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
2. Virtual router の作成
リスナー設定:
Ø Virtual router のリクエスト受信設定
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
3. Route の作成
ルートタイプ:
Ø Route で利⽤するプロトコル
ターゲット:
Ø リクエストの転送先
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
[補⾜] Amazon EKS の⼿順における Route の作成について
VirtualRouter custom resource にて Route リソースの作成も
同時に⾏われる
apiVersion: appmesh.k8s.aws/v1beta2
kind: VirtualRouter
metadata:
namespace: my-apps
name: eks-backend-virtual-router
spec:
listeners:
- portMapping:
port: 80
protocol: http
routes:
- name: eks-backend-route
httpRoute:
match:
prefix: /
action:
weightedTargets:
- virtualNodeRef:
name: eks-backend
weight: 1
例) Virtual router eks-backend-virtual-router
Virtual router の定義
Route の定義
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
4. Virtual service の作成
仮想サービス名:
Ø 実際のサービスディスカバリ名
プロバイダ:
Ø リクエストの転送先
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
5. Virtual node の更新
• 先ほど作成した Virtual service を
バックエンドに追加
• EKS 側の Virtual service も追加
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
6. タスク定義の更新
• 「App Mesh 統合の有効化」をチェック
• 作成した AWS App Mesh リソースを
関連づける
• AWS App Mesh が提供する Envoy
イメージを設定#1
#1: https://docs.aws.amazon.com/app-mesh/latest/userguide/envoy.html
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
6. タスク定義の更新
• マネジメントコンソールにて「サービス統合」を適⽤
することで、「プロキシ設定」は⾃動で設定される
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
7. サービスの更新
作成したタスク定義のリビジョンを利⽤してサービスを更新
Application
Task
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon ECS での設定
[再掲] 実施した⼿順はこちら
1. Virtual node の作成
2. Virtual router の作成
3. Route の作成
4. Virtual service の作成
5. Virtual node の更新
6. タスク定義の更新
7. サービスの更新
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/appmesh-getting-started.html
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊⼿順
1. Amazon EKS での設定
Ø AWS App Mesh Controller For K8s による設定
2. Amazon ECS での設定
Ø マネジメントコンソールによる設定
3. Amazon EKS での設定
Ø Virtual node の更新
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh の導⼊: Amazon EKS での設定
[Amazon EKS での⼿順] Virtual node の更新
• ECS 側の Virtual service を backends に追加
• [注意] ECS 側の Virtual service は ARN で
指定する必要がある
• AWS CLI で取得
(中略)
backends:
- virtualService:
virtualServiceRef:
name: eks-backend
- virtualService:
virtualServiceARN:
<ecs-backend-virtual-service-ARN>
$ aws appmesh describe-virtual-service --mesh-name my-mesh --virtual-service-name ecs-
backend.apps.local --query 'virtualService.metadata.arn'
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
[再掲] AWS App Mesh の導⼊⼿順
1. Amazon EKS での設定
Ø AWS App Mesh Controller For K8s による設定
2. Amazon ECS での設定
Ø マネジメントコンソールによる設定
3. Amazon EKS での設定
Ø Virtual node の更新
Amazon EKS
AWS Cloud
Frontend
service
Backend
service
Amazon ECS
Frontend
service
Backend
service
Mesh
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
[再掲] AWS App Mesh の導⼊後のサービス間通信
アプリケーションコードの変更︓
Ø リトライやタイムアウトの処理を Envoy proxy 側で
⾏うため、アプリケーション側の変更は最⼩限に
対向サービスとの結合度︓
Ø 実際のルーティング設定は AWS App Mesh 側で
⾏うため、対向サービスの状態や構成変更に依存しない
アプリケーションが通信要件や他サービスから分離された状態を実現
AWS Cloud
Users
VPC
Elastic Load Balancing
VPC
Elastic Load Balancing
Amazon EKS
Frontend
service
Amazon RDS
Frontend
service
Amazon RDS
Users
Amazon ECS
Peering
connection
Backend
service
Backend
service
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
本⽇のアジェンダ
• サービスメッシュとは︖
• AWS App Mesh の概要
• Example for AWS App Mesh
• AWS App Mesh の利⽤料⾦
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
利⽤料⾦
• AWS App Mesh は追加料⾦なしで使⽤可能
• Envoy Proxy を稼働するためのリソースに対して
料⾦が発⽣
• AWS X-Ray、Amazon CloudWatch Logs など連携先の
サービスの料⾦が発⽣
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
まとめ
AWS App Mesh の導⼊︓
Ø サービス間の通信に、⼀貫したネット
ワーク制御と可視性を提供
Ø アプリケーションが通信要件や他サー
ビスから分離された状態を実現
Amazon EKS
Frontend
service
Frontend
service
Amazon ECS
Backend
service
Backend
service
AWS App Mesh
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS App Mesh 関連情報: ⼿を動かしながら理解する
AWS App Mesh Workshop
https://www.appmeshworkshop.com/
AWS App Mesh の機能と利⽤⽅法を理解するためのワークショップ
aws / aws-app-mesh-examples
https://github.com/aws/aws-app-mesh-examples
クロスアカウント、gRPC、リトライ、Header ベースルーティングなど、
活⽤例を確認可能なコードサンプル
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Q&A
お答えできなかったご質問については
AWS Japan Blog 「https://aws.amazon.com/jp/blogs/news/」にて
後⽇掲載します。
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS 公式 Webinar
https://amzn.to/JPWebinar
過去資料
https://amzn.to/JPArchive
ご視聴ありがとうございました

Contenu connexe

Plus de Amazon Web Services Japan

Plus de Amazon Web Services Japan (20)

202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用
202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用
202202 AWS Black Belt Online Seminar AWS Managed Rules for AWS WAF の活用
 
202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf
202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf
202203 AWS Black Belt Online Seminar Amazon Connect Tasks.pdf
 
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介
SaaS テナント毎のコストを把握するための「AWS Application Cost Profiler」のご紹介
 
Amazon QuickSight の組み込み方法をちょっぴりDD
Amazon QuickSight の組み込み方法をちょっぴりDDAmazon QuickSight の組み込み方法をちょっぴりDD
Amazon QuickSight の組み込み方法をちょっぴりDD
 
マルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことマルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのこと
 
機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ
機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ
機密データとSaaSは共存しうるのか!?セキュリティー重視のユーザー層を取り込む為のネットワーク通信のアプローチ
 
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
 
202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles
202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles
202202 AWS Black Belt Online Seminar Amazon Connect Customer Profiles
 
Amazon Game Tech Night #24 KPIダッシュボードを最速で用意するために
Amazon Game Tech Night #24 KPIダッシュボードを最速で用意するためにAmazon Game Tech Night #24 KPIダッシュボードを最速で用意するために
Amazon Game Tech Night #24 KPIダッシュボードを最速で用意するために
 
202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨
202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨
202202 AWS Black Belt Online Seminar AWS SaaS Boost で始めるSaaS開発⼊⾨
 
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
[20220126] JAWS-UG 2022初頭までに葬ったAWSアンチパターン大紹介
 
202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介
202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介
202111 AWS Black Belt Online Seminar AWSで構築するSmart Mirrorのご紹介
 
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
 
202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ
202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ
202112 AWS Black Belt Online Seminar 店内の「今」をお届けする小売業向けリアルタイム配信基盤のレシピ
 
20211209 Ops-JAWS Re invent2021re-cap-cloud operations
20211209 Ops-JAWS Re invent2021re-cap-cloud operations20211209 Ops-JAWS Re invent2021re-cap-cloud operations
20211209 Ops-JAWS Re invent2021re-cap-cloud operations
 
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
20211203 AWS Black Belt Online Seminar AWS re:Invent 2021アップデート速報
 
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
 
20211109 JAWS-UG SRE keynotes
20211109 JAWS-UG SRE keynotes20211109 JAWS-UG SRE keynotes
20211109 JAWS-UG SRE keynotes
 
20211109 bleaの使い方(基本編)
20211109 bleaの使い方(基本編)20211109 bleaの使い方(基本編)
20211109 bleaの使い方(基本編)
 
202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN
202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN
202110 AWS Black Belt Online Seminar AWS Site-to-Site VPN
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 

20201014 AWS Black Belt Online Seminar AWS App Mesh Deep Dive

  • 1. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS 公式 Webinar https://amzn.to/JPWebinar 過去資料 https://amzn.to/JPArchive Solutions Architect, Containers Kyosuke Ochimizu 2020/10/14 AWS App Mesh Deep Dive サービスカットシリーズ [AWS Black Belt Online Seminar]
  • 2. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ⾃⼰紹介 • Specialist Solutions Architect, Containers • AWS のコンテナ関連サービスを担当 • 好きなサービス • Amazon Elastic Container Service (Amazon ECS) • Amazon Elastic Kubernetes Service (Amazon EKS) 落⽔ 恭介 (Ochimizu Kyosule)
  • 3. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Black Belt Online Seminar とは 「サービス別」「ソリューション別」「業種別」のそれぞれのテーマに分かれて、アマゾ ン ウェブ サービス ジャパン株式会社が主催するオンラインセミナーシリーズです。 質問を投げることができます︕ • 書き込んだ質問は、主催者にしか⾒えません • 今後のロードマップに関するご質問は お答えできませんのでご了承下さい ① 吹き出しをクリック ② 質問を⼊⼒ ③ Sendをクリック Twitter ハッシュタグは以下をご利⽤ください #awsblackbelt
  • 4. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 内容についての注意点 • 本資料では 2020 年 10 ⽉ 14 ⽇現在のサービス内容および価格についてご説明しています。最 新の情報は AWS 公式ウェブサイト (http://aws.amazon.com) にてご確認ください。 • 資料作成には⼗分注意しておりますが、資料内の価格と AWS 公式ウェブサイト記載の価格に相 違があった場合、AWS 公式ウェブサイトの価格を優先とさせていただきます。 • 価格は税抜表記となっています。⽇本居住者のお客様には別途消費税をご請求させていただきま す。 • AWS does not offer binding price quotes. AWS pricing is publicly available and is subject to change in accordance with the AWS Customer Agreement available at http://aws.amazon.com/agreement/. Any pricing information included in this document is provided only as an estimate of usage charges for AWS services based on certain information that you have provided. Monthly charges will be based on your actual use of AWS services, and may vary from the estimates provided.
  • 5. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 本セミナーの概要 • 本セミナーで学習できること Ø 異なるプラットフォームで稼働するサービスの サービス間通信に AWS App Mesh を導⼊するメリット Ø Amazon ECS および Amazon EKS における AWS App Mesh の具体的な利⽤⽅法 • 対象者 Ø AWS App Mesh の導⼊を検討しているアーキテクト、 技術者の⽅
  • 6. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 本⽇のアジェンダ • サービスメッシュとは︖ • AWS App Mesh の概要 • Example for AWS App Mesh • AWS App Mesh の利⽤料⾦
  • 7. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 本⽇のアジェンダ • サービスメッシュとは︖ • AWS App Mesh の概要 • Example for AWS App Mesh • AWS App Mesh の利⽤料⾦
  • 8. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. サービスメッシュとは アプリケーションレベルの通信を、アプリケーション⾃⾝が制御するのではなく インフラストラクチャーで制御できるようにする技術 Node.js Java Go Ruby http/tcp http/tcp http/tcp アプリケーションが⾏う通信制御 • HTTP 通信のリトライやタイムアウト • 通信のトレーシングやログ、メトリクスの取得 • TLS を使⽤した暗号化通信
  • 9. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. サービスメッシュとは • HTTP 通信のリトライやタイムアウト • 通信のトレーシングやログ、メトリクスの取得 • TLS を使⽤した暗号化通信 アプリケーションレベルの通信制御を、サービスメッシュの基盤で⾏うので、 アプリケーションに組み込む必要がなくなる サービスメッシュ基盤 Node.js Java Go Ruby http/tcp http/tcp http/tcp
  • 10. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. サービスメッシュが求められるようになった背景 • 現代のシステムは 複数の⾔語、アーキテクチャ、アプリケーション で構成 • クラウドにより多様な環境が簡単に作成できるように • マイクロサービスアーキテクチャの採⽤
  • 11. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 例: 多様なアプリケーションが通信を⾏うシステム • チームごとに最適な技術を選択してアプリケーションを動かす • プログラミング⾔語だけでなく、VM やコンテナなど様々なコンピューティ ングプラットフォームを選択できる Node.js チーム A VM チーム B コンテナ Java チーム C Go Ruby コンテナ VM
  • 12. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 全てのアプリケーションに、同じような通信の仕組みが必要 • 信頼性の確保 • リトライやタイムアウト、暗号化通信の実装 • 可観測性の確保 • メトリクスやトレース、ログの出⼒と収集 Node.js チーム A VM チーム B コンテナ Java チーム C Go コンテナ VM Ruby
  • 13. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ライブラリによる通信制御の共通化 共通ライブラリ 通信の仕組みを共通ライブラリとして実装、配布 • リトライやタイムアウト、暗号化通信の実装 • メトリクスやトレース、ログの出⼒と収集 チーム A Go RubyJavaNode.js チーム B チーム C 共通基盤チーム Node.js Java Go Ruby
  • 14. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 共通ライブラリの導⼊における課題 • 共通ライブラリを⼊れると依存関係が衝突する • ⾔語ごとにライブラリを実装する必要があり負担が⼤きい チーム A Go RubyJavaNode.js チーム B チーム C アプリケーション開発者・共通基盤チーム共に運⽤負荷が増⼤する
  • 15. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. アプリケーションから通信処理を分離 Node.js Java Proxy アプリケーション間の通信をプロキシして、通信制御を⾏うプロセス Proxy Proxy
  • 16. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. サービスメッシュの仕組み Node.js Java Go Ruby http/tcp http/tcp http/tcp サービスメッシュ基盤 Control plane プロキシをコントロールプレーンで管理 => アプリケーションレベルの通信制御をインフラストラクチャ側で管理可能に
  • 17. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh とは Node.js Java Go Ruby http/tcp http/tcp http/tcp Control plane Envoy を管理するコントロールプレーンを提供するサービスメッシュ
  • 18. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 本⽇のアジェンダ • サービスメッシュとは︖ • AWS App Mesh の概要 • Example for AWS App Mesh • AWS App Mesh の利⽤料⾦
  • 19. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. [再掲] AWS App Mesh とは Node.js Java Go Ruby http/tcp http/tcp http/tcp Control plane Envoy を管理するコントロールプレーンを提供するサービスメッシュ
  • 20. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh サービスメッシュを管理するコントロールプレーンを提供する Node.js Java Control plane • アプリケーションレベルの通信を ネットワークモデルとして定義 • ネットワークモデルを Envoy の 設定に変換して配布
  • 21. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 1. 通信元のアプリケーションは、通信先をサービスディスカバリーで 発⾒してリクエストを送信 2. リクエストがロードバランサーに到達 3. ロードバランサーが、複数の通信先にリクエストを振り分け AWS App Mesh のネットワークモデル
  • 22. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. ネットワークモデルとアプリケーションの関係 Amazon EC2 AWS Fargate
  • 23. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の動作イメージ Application container Application container http/tcp Amazon ECS タスク Amazon ECS タスク
  • 24. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の動作イメージ: Envoy proxy の導⼊ http/tcp Application container Envoy container Envoy container Application container Amazon ECS タスク Amazon ECS タスク
  • 25. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の動作イメージ: ネットワークモデルとの関係 http/tcp Application container Envoy container Envoy container Application container Amazon ECS タスク Amazon ECS タスク
  • 26. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の動作イメージ: トップレベルの概念 http/tcp Application container Envoy container Envoy container Application container Amazon ECS タスク Amazon ECS タスク
  • 27. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の動作イメージ: トップレベルの概念 http/tcp Application container Envoy container Envoy container Application container Amazon ECS タスク Amazon ECS タスク Mesh
  • 28. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. トップレベルの概念: Mesh Mesh • サービス間の通信制御を⾏う論理的な境界 • Mesh の中に Virtual Node や Virtual Service などを組み合わせて ネットワークモデルを構築する
  • 29. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. トップレベルの概念: Virtual Node Mesh • 実際のアプリケーションへの論理的なポインタ • 例) ECS サービス、Kubernetes デプロイメント • Envoy の実⾏時パラメータ (環境変数など) で Virtual Node 名を設定し、 アプリケーション (Envoy) と Virtual Node を関連づける
  • 30. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. トップレベルの概念: Virtual Service Mesh • アプリケーションの通信先を表す • リクエストは Virtual Router または Virtual Node にルーティングされ、実 際のアプリケーションに到達する
  • 31. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. トップレベルの概念: Virtual Router Mesh • リクエストのルーティングを管理するロードバランサー • 単⼀または複数の Virtual Node にルーティングされる
  • 32. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. トップレベルの概念まとめ http/tcp Application container Envoy container Envoy container Application container Amazon ECS Amazon ECS Mesh • Mesh • サービスメッシュの論理的な境界 • Virtual Node • アプリケーションのポインタ • Virtual Service • アプリケーションの通信先 • Virtual Router • ルーティング管理
  • 33. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 関連資料 ※AWS App Mesh の基本的な機能についての情報が必要の⽅は、下記の AWS Black Belt Online Seminar の資料をご参照ください。 [AWS Black Belt Online Seminar] AWS App Mesh 動画: https://youtu.be/IC7sxVh7HNM 資料: https://d1.awsstatic.com/webinars/jp/pdf/s ervices/20200721_BlackBelt_AWS_App_Mes h.pdf Speaker 林 政利
  • 34. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 本⽇のアジェンダ • サービスメッシュとは︖ • AWS App Mesh の概要 • Example for AWS App Mesh • AWS App Mesh の利⽤料⾦
  • 35. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 例: Amazon ECS と Amazon EKS で稼働するサービス間通信 AWS Cloud Users VPC Elastic Load Balancing VPC Elastic Load Balancing Amazon EKS Frontend service Amazon RDS Frontend service Amazon RDS Users Amazon ECS Backend service Backend service
  • 36. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 例: Amazon ECS と Amazon EKS で稼働するサービス間通信 AWS Cloud Users VPC Elastic Load Balancing VPC Elastic Load Balancing Amazon EKS Frontend service Amazon RDS Frontend service Amazon RDS Users Amazon ECS Peering connection Backend service Backend service
  • 37. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 例: Amazon ECS と Amazon EKS で稼働するサービス間通信 AWS Cloud Users VPC Elastic Load Balancing VPC Elastic Load Balancing Amazon EKS Frontend service Amazon RDS Frontend service Amazon RDS Users Amazon ECS Peering connection Backend service Backend service AWS App Mesh
  • 38. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 例: Amazon ECS と Amazon EKS で稼働するサービス間通信 1. Amazon ECS と Amazon EKS それぞれで サービスが稼働している 2. ビジネス上の理由で、Amazon ECS で稼働する サービスと Amazon EKS で稼働するサービス の相互通信が必要に 3. [課題] アプリケーションコードの変更や、 対向サービスとの結合度が強くなってしまう 想定シナリオ AWS App Mesh を導⼊することで、上記の課題の解決を図る AWS Cloud Users VPC Elastic Load Balancing VPC Elastic Load Balancing Amazon EKS Frontend service Amazon RDS Frontend service Amazon RDS Users Amazon ECS Peering connection Backend service Backend service AWS App Mesh
  • 39. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊後のサービス間通信 アプリケーションコードの変更︓ Ø リトライやタイムアウトの処理を Envoy proxy 側で ⾏うため、アプリケーション側の変更は最⼩限に 対向サービスとの結合度︓ Ø 実際のルーティング設定は AWS App Mesh 側で ⾏うため、対向サービスの状態や構成変更に依存しない AWS Cloud Users VPC Elastic Load Balancing VPC Elastic Load Balancing Amazon EKS Frontend service Amazon RDS Frontend service Amazon RDS Users Amazon ECS Peering connection Backend service Backend service AWS App Mesh
  • 40. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 例: AWS App Mesh 導⼊後の構成 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service AWS App Mesh Mesh
  • 41. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊⼿順 1. Amazon EKS での設定 Ø AWS App Mesh Controller For K8s による設定 2. Amazon ECS での設定 Ø マネジメントコンソールによる設定 3. Amazon EKS での設定 Ø Virtual node の更新 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh 今回は以下の⼿順で AWS App Mesh を導⼊する
  • 42. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊⼿順 1. Amazon EKS での設定 Ø AWS App Mesh Controller For K8s による設定 2. Amazon ECS での設定 Ø マネジメントコンソールによる設定 3. Amazon EKS での設定 Ø Virtual node の更新 AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh
  • 43. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 Amazon EKS での導⼊⼿順はこちら 1. AWS App Mesh Controller For K8s のインストール 2. Namespace の変更 3. Mesh の作成 4. AWS Cloud Map 名前空間の作成 5. Virtual node の作成 6. Virtual router の作成 7. Virtual service の作成 8. Virtual node の更新 9. Deployment の更新 • https://docs.aws.amazon.com/eks/latest/userguide/mesh-k8s-integration.html • https://aws.github.io/aws-app-mesh-controller-for-k8s/guide/installation/ Amazon EKS AWS Cloud Frontend service Backend service Mesh AWS App Mesh
  • 44. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 1. AWS App Mesh Controller For K8s のインストール 前提条件: • Kubernetes クラスターのバージョンが 1.13 以上 • AWS App Mesh および AWS Cloud Map を操作する権限が付与されている • 管理ポリシー AWSAppMeshFullAccess / AWSCloudMapFullAccess • ノード IAM ロール、もしくは IAM roles for service accounts で設定 AWS Cloud Amazon EKS Frontend service Backend service
  • 45. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 1. AWS App Mesh Controller For K8s のインストール # eks-charts リポジトリを Helm に追加 $ helm repo add eks https://aws.github.io/eks-charts # App Mesh ⽤の custom resource definitions (CRD) を追加 $ kubectl apply -k github.com/aws/eks-charts/stable/appmesh-controller//crds?ref=master # App Mesh Controller を実⾏する Namespace を追加 $ kubectl create ns appmesh-system # App Mesh Controller をデプロイ $ helm upgrade -i appmesh-controller eks/appmesh-controller --namespace appmesh-system AWS Cloud Amazon EKS Frontend service Backend service
  • 46. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 2. Namespace の変更 apiVersion: v1 kind: Namespace metadata: name: my-apps labels: mesh: my-mesh appmesh.k8s.aws/sidecarInjectorWebhook: enabled Mesh の指定、および Sidecar Injector の有効化を⾏う 例) Namespace my-apps AWS Cloud Amazon EKS Frontend service Backend service
  • 47. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 [補⾜] Sidecar Injector の設定について Namespace の Label / Pod の Annotation で Inject Mode を制御#1 #1: appmesh.k8s.aws/sidecarInjectorWebhook • enabled mode Ø Sidecar が追加される Ø Virtual Node / Virtual Gateway の設定がされていない場合、Pod の起動に失敗する • disabled mode Ø Sidecar の追加処理がスキップされる • unspecified mode Ø Virtual Node / Virtual Gateway の設定がされている場合、Sidecar が追加される AWS Cloud Amazon EKS Frontend service Backend service
  • 48. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 3. Mesh の作成 apiVersion: appmesh.k8s.aws/v1beta2 kind: Mesh metadata: name: my-mesh spec: namespaceSelector: matchLabels: mesh: my-mesh 例) Mesh my-mesh spec.namespaceSelector: Ø Mesh のメンバーとなるリソースが所属する Namespace AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh
  • 49. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 4. AWS Cloud Map 名前空間の作成 Virtual node のサービスディスカバリに AWS Cloud Map を使⽤ $ aws servicediscovery create-private-dns-namespace --name my-mesh.svc.cluster.local --vpc {{VPC_ID}} AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh
  • 50. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 5. Virtual node の作成 apiVersion: appmesh.k8s.aws/v1beta2 kind: VirtualNode metadata: name: eks-frontend namespace: my-apps spec: podSelector: matchLabels: app: eks-frontend listeners: - portMapping: port: 80 protocol: http serviceDiscovery: awsCloudMap: namespaceName: my-mesh.svc.cluster.local serviceName: eks-frontend 例) Virtual node eks-frontend spec.listeners: Ø Virtual node のリクエスト受信設定 spec.serviceDiscovery: Ø Virtual node と関連づけられている、実際の アプリケーションのサービスディスカバリ情報 AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh
  • 51. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 5. Virtual router の作成 apiVersion: appmesh.k8s.aws/v1beta2 kind: VirtualRouter metadata: namespace: my-apps name: eks-backend-virtual-router spec: listeners: - portMapping: port: 80 protocol: http routes: - name: eks-backend-route httpRoute: match: prefix: / action: weightedTargets: - virtualNodeRef: name: eks-backend weight: 1 例) Virtual router eks-backend-virtual-router spec.listeners: Ø Virtual router のリクエスト受信設定 spec.routes: Ø ルーティング情報 AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh
  • 52. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 5. Virtual router の作成 spec.routes[].httpRoute: Ø HTTP ルーティング情報 Ø http2Route や grpcRoute も設定可能 spec.routes[].httpRoute.match: Ø route で処理をするリクエストの設定 spec.routes[].httpRoute.action: Ø マッチしたリクエストの転送先 AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh apiVersion: appmesh.k8s.aws/v1beta2 kind: VirtualRouter metadata: namespace: my-apps name: eks-backend-virtual-router spec: listeners: - portMapping: port: 80 protocol: http routes: - name: eks-backend-route httpRoute: match: prefix: / action: weightedTargets: - virtualNodeRef: name: eks-backend weight: 1 例) Virtual router eks-backend-virtual-router
  • 53. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 6. Virtual service の作成 apiVersion: appmesh.k8s.aws/v1beta2 kind: VirtualService metadata: name: eks-backend namespace: my-apps spec: awsName: eks-backend.my-apps.svc.cluster.local provider: virtualRouter: virtualRouterRef: name: eks-backend-virtual-router 例) Virtual service eks-backend spec.awsName: Ø Virtual service のリソース名 spec.provider: Ø Virtual service のリクエスト転送先 Ø Virtual router / Virtual node を指定 AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh
  • 54. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 [補⾜] Virtual service のリソース名について #1: https://docs.aws.amazon.com/app-mesh/latest/userguide/virtual_services.html#create-virtual-service Virtual service name と実際のサービスディスカバリ名を揃えることを推奨#1 Ø 既存のコードを変更する必要がないため my-service.default.svc.cluster.local Application Application Application Application my-service.default.svc.cluster.local Application Application AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh
  • 55. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 7. Virtual node の更新 apiVersion: appmesh.k8s.aws/v1beta2 kind: VirtualNode metadata: name: eks-frontend namespace: my-apps spec: podSelector: matchLabels: app: eks-frontend listeners: - portMapping: port: 80 protocol: http backends: - virtualService: virtualServiceRef: name: eks-backend serviceDiscovery: awsCloudMap: namespaceName: my-mesh.svc.cluster.local serviceName: eks-frontend 例) Virtual node eks-frontend spec.backends: Ø Virtual node がリクエストを送信する Virtual service Ø 先ほど作成した VirtualService custom resource の リソース名を指定 AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh
  • 56. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 8. Deployment の更新 $ kubectl rollout restart deployment/XXX ... Envoy proxy を Pod へ追加するためにローリングアップデートを⾏う App Mesh Controller Application Pod Inject Pod AWS Cloud Amazon EKS Frontend service Backend service Mesh AWS App Mesh
  • 57. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊⼿順: Amazon EKS での設定 [再掲] 実施した⼿順はこちら 1. AWS App Mesh Controller For K8s のインストール 2. Namespace の変更 3. Mesh の作成 4. AWS Cloud Map 名前空間の作成 5. Virtual node の作成 6. Virtual router の作成 7. Virtual service の作成 8. Virtual node の更新 9. Deployment の更新 • https://docs.aws.amazon.com/eks/latest/userguide/mesh-k8s-integration.html • https://aws.github.io/aws-app-mesh-controller-for-k8s/guide/installation/ Amazon EKS AWS Cloud Frontend service Backend service Mesh AWS App Mesh
  • 58. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊⼿順 1. Amazon EKS での設定 Ø AWS App Mesh Controller For K8s による設定 2. Amazon ECS での設定 Ø マネジメントコンソールによる設定 3. Amazon EKS での設定 Ø Virtual node の更新 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 59. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 Amazon ECS での⼿順はこちら 1. Virtual node の作成 2. Virtual router の作成 3. Route の作成 4. Virtual service の作成 5. Virtual node の更新 6. タスク定義の更新 7. サービスの更新 https://docs.aws.amazon.com/AmazonECS/latest/developerguide/appmesh-getting-started.html Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 60. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 [推奨] ECS サービスでサービス検出の統合が有効になっていること • Virtual node の背後にいる実際のアプリケーションを検出するため Ø ⾃前の仕組みを⽤意することも可能だが、運⽤⾯からサービス検出の利⽤を推奨 • [注意] ECS サービスの作成後、後からサービス検出の設定を変更することはできない#1 #1: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/appmesh-getting-started.html
  • 61. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 1. Virtual node の作成 サービスの検出⽅法: Ø ECS サービスで設定したサービス検出 の AWS Cloud Map 情報 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 62. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 1. Virtual node の作成 リスナー設定: Ø Virtual node のリクエスト受信設定 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 63. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 2. Virtual router の作成 リスナー設定: Ø Virtual router のリクエスト受信設定 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 64. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 3. Route の作成 ルートタイプ: Ø Route で利⽤するプロトコル ターゲット: Ø リクエストの転送先 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 65. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 [補⾜] Amazon EKS の⼿順における Route の作成について VirtualRouter custom resource にて Route リソースの作成も 同時に⾏われる apiVersion: appmesh.k8s.aws/v1beta2 kind: VirtualRouter metadata: namespace: my-apps name: eks-backend-virtual-router spec: listeners: - portMapping: port: 80 protocol: http routes: - name: eks-backend-route httpRoute: match: prefix: / action: weightedTargets: - virtualNodeRef: name: eks-backend weight: 1 例) Virtual router eks-backend-virtual-router Virtual router の定義 Route の定義 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 66. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 4. Virtual service の作成 仮想サービス名: Ø 実際のサービスディスカバリ名 プロバイダ: Ø リクエストの転送先 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 67. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 5. Virtual node の更新 • 先ほど作成した Virtual service を バックエンドに追加 • EKS 側の Virtual service も追加 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 68. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 6. タスク定義の更新 • 「App Mesh 統合の有効化」をチェック • 作成した AWS App Mesh リソースを 関連づける • AWS App Mesh が提供する Envoy イメージを設定#1 #1: https://docs.aws.amazon.com/app-mesh/latest/userguide/envoy.html Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 69. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 6. タスク定義の更新 • マネジメントコンソールにて「サービス統合」を適⽤ することで、「プロキシ設定」は⾃動で設定される Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 70. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 7. サービスの更新 作成したタスク定義のリビジョンを利⽤してサービスを更新 Application Task Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 71. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon ECS での設定 [再掲] 実施した⼿順はこちら 1. Virtual node の作成 2. Virtual router の作成 3. Route の作成 4. Virtual service の作成 5. Virtual node の更新 6. タスク定義の更新 7. サービスの更新 https://docs.aws.amazon.com/AmazonECS/latest/developerguide/appmesh-getting-started.html Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 72. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊⼿順 1. Amazon EKS での設定 Ø AWS App Mesh Controller For K8s による設定 2. Amazon ECS での設定 Ø マネジメントコンソールによる設定 3. Amazon EKS での設定 Ø Virtual node の更新 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 73. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh の導⼊: Amazon EKS での設定 [Amazon EKS での⼿順] Virtual node の更新 • ECS 側の Virtual service を backends に追加 • [注意] ECS 側の Virtual service は ARN で 指定する必要がある • AWS CLI で取得 (中略) backends: - virtualService: virtualServiceRef: name: eks-backend - virtualService: virtualServiceARN: <ecs-backend-virtual-service-ARN> $ aws appmesh describe-virtual-service --mesh-name my-mesh --virtual-service-name ecs- backend.apps.local --query 'virtualService.metadata.arn' Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 74. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. [再掲] AWS App Mesh の導⼊⼿順 1. Amazon EKS での設定 Ø AWS App Mesh Controller For K8s による設定 2. Amazon ECS での設定 Ø マネジメントコンソールによる設定 3. Amazon EKS での設定 Ø Virtual node の更新 Amazon EKS AWS Cloud Frontend service Backend service Amazon ECS Frontend service Backend service Mesh AWS App Mesh
  • 75. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. [再掲] AWS App Mesh の導⼊後のサービス間通信 アプリケーションコードの変更︓ Ø リトライやタイムアウトの処理を Envoy proxy 側で ⾏うため、アプリケーション側の変更は最⼩限に 対向サービスとの結合度︓ Ø 実際のルーティング設定は AWS App Mesh 側で ⾏うため、対向サービスの状態や構成変更に依存しない アプリケーションが通信要件や他サービスから分離された状態を実現 AWS Cloud Users VPC Elastic Load Balancing VPC Elastic Load Balancing Amazon EKS Frontend service Amazon RDS Frontend service Amazon RDS Users Amazon ECS Peering connection Backend service Backend service AWS App Mesh
  • 76. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 本⽇のアジェンダ • サービスメッシュとは︖ • AWS App Mesh の概要 • Example for AWS App Mesh • AWS App Mesh の利⽤料⾦
  • 77. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 利⽤料⾦ • AWS App Mesh は追加料⾦なしで使⽤可能 • Envoy Proxy を稼働するためのリソースに対して 料⾦が発⽣ • AWS X-Ray、Amazon CloudWatch Logs など連携先の サービスの料⾦が発⽣
  • 78. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. まとめ AWS App Mesh の導⼊︓ Ø サービス間の通信に、⼀貫したネット ワーク制御と可視性を提供 Ø アプリケーションが通信要件や他サー ビスから分離された状態を実現 Amazon EKS Frontend service Frontend service Amazon ECS Backend service Backend service AWS App Mesh
  • 79. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS App Mesh 関連情報: ⼿を動かしながら理解する AWS App Mesh Workshop https://www.appmeshworkshop.com/ AWS App Mesh の機能と利⽤⽅法を理解するためのワークショップ aws / aws-app-mesh-examples https://github.com/aws/aws-app-mesh-examples クロスアカウント、gRPC、リトライ、Header ベースルーティングなど、 活⽤例を確認可能なコードサンプル
  • 80. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Q&A お答えできなかったご質問については AWS Japan Blog 「https://aws.amazon.com/jp/blogs/news/」にて 後⽇掲載します。
  • 81. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS 公式 Webinar https://amzn.to/JPWebinar 過去資料 https://amzn.to/JPArchive ご視聴ありがとうございました