Más contenido relacionado
La actualidad más candente (19)
Similar a 20180313 Amazon Container Services アップデート (20)
Más de Amazon Web Services Japan (20)
20180313 Amazon Container Services アップデート
- 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Container Services
アップデート
Ryosuke Iwanaga, Solutions Architect
Amazon Web Services Japan K.K.
2018.03
- 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Agenda
• Amazon Container Services アップデート
• コンテナCI/CDパイプライン
• コンテナのAuto Scaling
- 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon EC2
AWS
CodePipeline
Source Build Deploy
AWS
CodeCommit
AWS
CodeBuild
Amazon RDS Amazon S3
Developer
Control plane
Data plane
Backing
service
Registry
CI/CD pipeline
- 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elastic Container Registry (ECR)
フルマネージドの高可用性・スケーラブルなレジストリ
エンドポイントにアクセスできるならAWS外からでも利用可能
AWS IAMによる強力な認証管理機構
pullのみの権限、クロスアカウントアクセスも可能
ライフサイクルポリシーでイメージの自動クリーンアップ
何日以前や何個以上は自動削除といったルールを組み合わせて設定
NEW!!
- 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS上の本番環境のコンテナを支える
AWS VPCネットワー
クモード
タスク配置
他のAWSサービスと
の深い連携
ECS CLI…{ }
グローバル展開
強力なスケジューラ
オートスケーリング
CloudWatch メトリクス
ロードバランサ
Linux & Windows
NEW!!
- 6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS VPC ネットワークモード
Task毎にENIを自動割り当て
Security GroupをTask毎に設定可能
Task内のコンテナはlocalhostを共
有
Link不要で互いにアクセス可能
VPC内の他のリソースへPrivate IP
で通信が可能
FargateではPublic IPの割当も可能
172.31.0.0/16
Subnet
172.31.1.0/24
Internet
Other Entities in VPC
EC2 ELB RDS etc.
Elastic Network Interface (ENI)
Public IP / Private IP
208.57.73.13 / 172.31.1.164
us-east-1a
us-east-1b
us-east-1c
NEW!!
- 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ECSアップデート、その他
Linux capabilities ADD/DROP
Task metadata / metrics
Device / Init flag support
Windows support GA
Task level CPU/Memory limit
Circuit breaking for Service
Health check grace period
Container health check
NEW!!
- 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
- 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
63%
のKubernetes利用者がAWS
を今日利用している
—CNCF アンケートより
https://www.cncf.io/blog/2017/06/28/survey-shows-kubernetes-leading-orchestration-platform/
https://www.cncf.io/blog/2017/12/06/cloud-native-technologies-scaling-production-applications/
- 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elastic Container Service for Kubernetes
(EKS)
Tenet 1
EKSはエンタープライズ企業が本番の
ワークロードを実行するためのプラット
フォームであること
Tenet 2
EKSはネイティブで最新のKubernetes
の体験を提供すること
Tenet 3
EKSユーザが他のAWSサービスを使う
時、シームレスな連携を実現し不要な
作業を取り除くこと
Tenet 4
EKSチームは積極的にKubernetesプロ
ジェクトに貢献していくこと
NEW!! (Preview)
- 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
kubectl
3) AWSアイデンティティをRBACで認可する
k8s API
1) AWSアイデンティティを渡す
2) AWSアイデンティティを検
証する
4) k8sのアクションが許可
・拒否される
AWS Auth
IAM 認証 + kubectl
- 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アプリケーションの開発に集中したい
Amazon EC2
• アプリ開発してデプロイ
• コンテナのAuto Scale
• コンテナのセキュリティ管理
• OSのプロビジョン
• OSのセキュリティ管理
• インスタンスのAuto Scale
- 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
計算リソースの使い方を根本的に変える
簡素で、使いやすく、
強力な
新しいリソース利用モデル
=インスタンス
管理不要
タスク
ネイティブAPI
リソース
ベースの価格
NEW!!
- 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Scheduling and Orchestration
Cluster Manager Placement Engine
ECS
AMI
Docker
agent
ECS
agent
EC2 Instance
ECS
AMI
Docker
agent
ECS
agent
EC2 Instance
ECS
AMI
Docker
agent
ECS
agent
EC2 Instance
- 15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
サービスレベルアグリーメント + コンプライアンス
99.99
NEW!!
HIPAA 資格要件を満たす
とともに、ISO、PCI、SOC 1
、SOC 2、および SOC 3 コ
ンプライアンスの基準を満
たしています
- 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
コンテナのCI/CDパイプライン
- 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
なぜCI/CDパイプラインが重要なのか?
• 誰がやっても同じ様にデプロイできること
• イメージがどうやって作られどこで使われてるか把握
• アプリ毎に統一された手法を利用する
しかし、CI/CDパイプラインの実装や構築自体は、典型的な差
別化を産まない重労働
→ AWS CodePipeline / AWS CodeBuild
- 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CodePipeline
柔軟なCI/CDパイプラインをフルマネージド
Source, Build, Test, Deployを複雑に組合せ
並列実行や、手動承認も設定可能
Deploy TargetにECS Serviceも対応
ユースケース
テスト環境にデプロイ後、各種テスト実行
カナリア、リージョンデプロイ
NEW!!
- 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS CodeBuild
マネージドの実行環境
ビルドやテスト等が主な目的
実行環境はDockerイメージ
各種言語対応の環境
Dockerイメージのビルドも可能
Docker 17.09.0対応イメージ有
CodePipelineとも連携可能
もちろん単体でも利用可能
version: 0.2
phases:
pre_build:
commands:
- $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
- REPOSITORY_URI=0123456789.dkr.ecr.us-east-1.amazonaws.com/fargate-demo
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
build:
commands:
- docker build -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- printf '[{"name":"app","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imageDefinition.json
artifacts: files: imageDefinition.json
buildspec.yaml
NEW!!
- 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS
CodePipeline
AWS
CodeCommit
AWS
CodeBuild
Developer
Application
Load Balancer
Servic
e
パイプライン確認、手動承認
コードのチェックイン
ビルド済
イメージの確認
デプロイ後の
状態確認
registerTaskDefinition & updateService
docker build & push
imageDefinition.json
source code
- 21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
コンテナのAuto Scaling
- 22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ECSの特徴: Target Trackingとの連携
メトリクスに対してターゲットの値を設定す
るだけ
(例: CPU使用率 50%)
その値に近づく様に、Application Auto
Scalingが自動的にServiceのDesiredCount
を調整
ECSではコンソールからも設定可能
ECSServiceAverageCPUUtilization
ECSServiceAverageMemoryUtilization
ALBRequestCountPerTarget
CPUTraffic
DesiredCount
Time
100%
0%
50%
10%
20%
30%
40%
60%
70%
80%
90%
5
30
10
15
20
25
Target CPU Utilization DesiredCount
NEW!!
- 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Service
Fargateを利用したコンテナAuto Scalingの優位性
Fargateの場合
• Serviceのスケールに応じて自然にコ
ンテナが起動・終了する
• コンテナの起動時間に対してのみ課
金
EC2の場合
• インスタンスのリソースも上手くスケ
ールさせる必要があり煩雑
• 余分に持っているバッファ分もインス
タンスの課金が必要
Amazon
EC2
Service
Resource
buffer
(+~15%)
- 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
まとめ
Amazon Container Services
CI/CDパイプライン
Auto Scaling
- 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
参考資料
• Amazon Container Services Page
• Containers on AWS - State of the Union
- CON201 - re:Invent 2017 Slides /
Video
• Introducing AWS Fargate - CON214 -
re:Invent 2017 Slides / Video
• Deep Dive into AWS Fargate - CON333 -
re:Invent 2017 Slides / Video
• Introducing Amazon EKS - CON215 -
re:Invent 2017 Slides / Video
• Deep Dive into Amazon EKS - CON409 -
re:Invent 2017 Slides / Video
- 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thanks!