aws codeシリーズを利用した パイプラインの自動化入門 · visual...
TRANSCRIPT
![Page 1: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/1.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Atsushi Fukui
DevOps Specialist Solutions Architect, Amazon Web Services Japan K.K.
3-H1-1-15
AWS Codeシリーズを利用した
パイプラインの自動化入門
![Page 2: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/2.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
自己紹介❖名前
❖ 福井 厚(ふくい あつし) fatsushi@
❖所属❖ アマゾン ウェブ サービス ジャパン株式会社
❖ 技術統括本部レディネスソリューション部
❖ ソリューション アーキテクトDev&Opsスペシャリスト
❖前職❖ エンタープライズ アプリケーション開発コンサルタント
❖好きなAWSサービス❖ AWS Code シリーズ、AWS Cloud9、Amazon ECS/Fargate/EKS、AWS Lambda
![Page 3: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/3.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
なぜDevOpsなのか?
AmazonのDevOps ストーリー
AWS Code シリーズ
AWS Codeシリーズを利用したパイプラインの自動化
![Page 4: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/4.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
なぜDevOpsなのか?
![Page 5: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/5.jpg)
ソフトウェア開発は高速化している
![Page 6: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/6.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
なぜ DevOps なのか?
5x 変更による失敗率の低下
440xコミットからデプロイまでの速度
46xより頻繁なデプロイメント
44%新機能の開発に費やす時間の増加
Source: Puppet 2017 State of DevOps Report
![Page 7: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/7.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOpsとは何か?
• カルチャーと哲学
• プラクティス
• ツール
Culture
PracticesTools
![Page 8: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/8.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
カルチャー
• DevとOpsを一緒に
• 壁をつくらない
• 責任をチームで共有
• オーナーシップを持つ
• 見える化とコミュニケーション
![Page 9: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/9.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOpsのプラクティス
マイクロサービス
モノリシックなアプリケーション アーキテクチャから多くの独立したサービスへ
![Page 10: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/10.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOpsのプラクティス
• 継続的インテグレーション
• 継続的デリバリー&デプロイメント
![Page 11: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/11.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOpsのプラクティス
Infrastructure as code
• コードによってAWSリソースをモデル化
![Page 12: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/12.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOpsのプラクティス
• モニタリングとロギング
• メトリックスとログをトラックして分析
• インフラストラクチャとアプリケーションのリアルタイムなフォーマンスを理解する
![Page 13: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/13.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
信頼性
DevOpsのメリット
スピードスケール
迅速なデリバリーコラボレーションの改善
セキュリティ
![Page 14: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/14.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AmazonのDevOpsストーリー
![Page 15: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/15.jpg)
Amazonの開発の歴史をふりかえる
https://secure.flickr.com/photos/pixelthing/15806918992/
![Page 16: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/16.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazonにおける開発の変遷: 2001–2009
2001 2009
モノリシックアプリケーション +チーム
マイクロサービス + 2ピザチーム
![Page 17: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/17.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
モノリシックなアーキテクチャの問題点
密結合
メンテナンスと維持が難しい• ソースコードが複雑に絡み合い、マージ一つでも一苦労
ビルドやテストがとにかく時間がかかる
デプロイがボトルネック• デプロイが一大イベントとなる
1つのプロセスで提供される
スケールが難しい
![Page 18: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/18.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• 単一目的のサービス
• HTTPSのAPIのみによる通信
• お互いをブラックボックスに
• マイクロサービス
![Page 19: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/19.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• 2ピザ チーム
• 全ての所有権
• 全ての説明責任
![Page 20: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/20.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
2ピザチームの働き方
• ”サービスチーム”と呼ぶ
• サービスを所有し、構築する:• プロダクトプランニング(ロードマップ)
• 開発
• 運用/カスタマーサポート
• “You build it, you run it”
• 大きな組織の一部分を構成する (Amazon.com、AWS、 Primeなど)
![Page 21: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/21.jpg)
さらにスピードアップするためにソフトウェアリリースプロセスの自動化ツールを開発
https://secure.flickr.com/photos/lindseygee/5894617854/
![Page 22: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/22.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
自動化されたアクションと遷移、チェックインから本番環境へ
開発のメリット
• より高速
• より安全
• 単純化と標準化
• プロセスの見える化
パイプライン
![Page 23: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/23.jpg)
Where Do You
?
![Page 24: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/24.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• 他のシステムとの統合テスト
• ロードテスト• UIテスト• 侵入テスト
リリースとモニタのフェーズ
Source Build Test Deploy Monitor
• .javaファイルなどのソースコードをチェックイン
• 新しいコードのピアレビュー
• コードのコンパイル
• ユニットテスト• スタイルチェッ
カー• コードメトリッ
ク• コンテナイメー
ジの作成
• 本番環境にデプロイ
• 異常なアクティビティやエラーを素早く検知するために本番環境のコードをモニタリング
![Page 25: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/25.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Codeシリーズ
![Page 26: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/26.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Code サービス
Source Build Test Deploy Monitor
AWS CodeBuild
+ Third Party
ソフトウェア リリース ステップ
AWS CodeCommit AWS CodeBuild AWS CodeDeploy
AWS CodePipeline
AWS
CodeStar
AWS X-Ray
Amazon
CloudWatch
![Page 27: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/27.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
コードのバージョンを管理する
![Page 28: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/28.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
セキュアでスケーラブルなマネージドGitソース管理
スタンダードなGit ツールが利用可能
Visual StudioやEclipseなど普段利用しているIDEから接続可能
Amazon S3のスケーラビリティ、可用性、堅牢なストレージを利用
カスタマ特有のキーを使用した暗号化
レポジトリサイズの上限なし
AWS CodeCommit
![Page 29: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/29.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS CodeCommit
Git pull/pushAWS CodeCommit
GitオブジェクトはAmazon S3
GitインデックスはAmazon DynamoDB
暗号化キーはAWS KMSに保存
SSH or HTTPS
![Page 30: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/30.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
リポジトリのコンテンツ参照
![Page 31: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/31.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
コミット間の差分表示
![Page 32: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/32.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
コミット グラフの表示
Commit Visualizer を選択
![Page 33: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/33.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
プルリクエスト機能• リポジトリのユーザに対して、プルリクエストを起点としたコードに関
する議論やコミュニケーションの機会を提供できるようになった
• CodeCommitの仕組みの中でコードレビューを実施したり、変更箇所を精査することが可能に。結果として品質改善に繋げることができる
![Page 34: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/34.jpg)
アプリケーションをビルドしてテストする
https://secure.flickr.com/photos/spenceyc/7481166880
![Page 35: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/35.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
完全なマネージドのビルドサービスでソースコードのコンパイル、実行、テスト、ソフトウェアパッケージの生成をサポート
継続的なスケールと同時複数ビルドの実行
Dockerイメージによってニーズにマッチするカスタムなビルド環境を構築可能
利用したコンピュータ リソース/分のみの支払い
CodePipelineやJenkinsとの統合が可能
AWS CodeBuild
![Page 36: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/36.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS CodeBuild のコンセプト
1. CodeBuild にビルド プロジェクトを作成
2. AWS CodeBuild はビルド プロジェクトに基づいてビルド環境を構築
3. AWS CodeBuildはソースコードをダウンロード
4. ビルドのアウトプットをS3へアップロード
5. ビルド実行中、AWS CodeBuild とAWS CloudWatch Logs に情報を送信
6. ビルド実行中、AWS CodeBuild コンソール、AWS CLI、AWS SDK、AWS APIでビルド情報を取得
![Page 37: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/37.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
version: 0.1
environment_variables:plaintext:JAVA_HOME: "/usr/lib/jvm/java-8-openjdk-amd64"
phases:install:commands:- apt-get update -y- apt-get install -y maven
pre_build:commands:- echo Nothing to do in the pre_build phase...
build:commands:- echo Build started on `date`- mvn install
post_build:commands:- echo Build completed on `date`
artifacts:type: zipfiles:- target/messageUtil-1.0.jar
discard-paths: yes
buildspec.yml の例
• ビルドの各フェーズで利用される環境変数
• 各フェースで実行するコマンドの指定• “insutall”では環境を準備するた
めのパッケージのインストールやコマンドの実行など
• ”pre build“では構文チェックやコマンドの実行など
• “build”ではビルドツールやコマンドの実行など
• “post build”ではテスト実行やレポジトリへのコンテナイメージの配布
• アーティファクトを作成しS3に保存
![Page 38: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/38.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ローカル環境でのテストとデバッグをサポート
• AWS CodeBuildのローカル エージェントを利用してCodeBuildのローカル環境でのテストとデバッグが可能
• ローカルでのCodeBuild環境のシミュレートが可能になり、buildspecファイル上のコマンドや設定のトラブルシュートが容易
• 詳細は下記のBlog記事を参照くださいhttps://aws.amazon.com/blogs/devops/announcing-local-build-support-for-aws-codebuild/
![Page 39: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/39.jpg)
アプリケーションをデプロイする
https://secure.flickr.com/photos/simononly/15386966677
![Page 40: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/40.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
あらゆるインスタンスに対するコードのデプロイメントを自動化
アプリケーションの複雑なアップデートに対処
アプリケーションのデプロイ中のダウンタイムを回避
失敗を検知したら自動的にロールバック
言語やオペレーティングシステムに依存せずに、Amazon EC2やオンプレミスサーバーにデプロイ
AWS Lambdaへのカナリア デプロイをサポート
AWS CodeDeploy
![Page 41: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/41.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS CodeDeploy ワークフロー
![Page 42: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/42.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
version: 0.0os: linuxfiles:
- source: /destination: /var/www/html
permissions:- object: /var/www/html
pattern: “*.html”owner: rootgroup: rootmode: 755
hooks:ApplicationStop:
- location: scripts/deregister_from_elb.shBeforeInstall:
- location: scripts/install_dependencies.shApplicationStart:
- location: scripts/start_httpd.shValidateService:
- location: scripts/test_site.sh- location: scripts/register_with_elb.sh
• ELBへのインスタンスの追加と削除
• 依存パッケージのインストール• Apacheの起動• デプロイの成功を確認
• アプリケーションファイルと設定ファイルをそれぞれのディレクトリに送信
• 特定のディレクトリとファイルのアクセス許可を設定
appspec.ymlの例
![Page 43: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/43.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
v2 v2 v2 v2 v2 v2
1つずつ
半分ずつ
すべて一度に
v2 v2 v2 v1 v1 v1
v2 v1 v1 v1 v1 v1 エージェント
開発デプロイグループ
または本番デプロイグループ
デプロイの作業量とグループの選択
エージェント
エージェント エージェント エージェント
エージェント エージェント エージェント
![Page 44: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/44.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda
• AWS Lambda
• カナリア
• 最初の増分でトラフィックの指定パーセントを移行し、指定された時間経過後に残りを移行
• リニア
• 最初の増分でトラフィックの指定パーセントを移行、指定した分数経過後に指定パーセント増加を繰り返す
Version 2
Version 1
alias
Event
Source
10%
![Page 45: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/45.jpg)
パイプラインによる展開
https://www.flickr.com/photos/seattlemunicipalarchives/12504672623/
![Page 46: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/46.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
アプリケーションのすばやく信頼できるアップデートを可能にする継続的デリバリサービス
ソフトウェアリリースプロセスのモデル化と見える化
コードが変更されるたびにコードをビルド、テスト、デプロイ
サードパーティツールやAWSとの統合
AWS CodePipeline
![Page 47: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/47.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Source
SourceGitHub
Build
JenkinsOnEC2Jenkins
Deploy
JavaAppElastic Beanstalk
パイプラインステージ
アクション
トランジション
MyApplication
![Page 48: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/48.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Build
AWS CodeBuildAWS CodeBuild
Staging-Deploy
JavaAppElastic Beanstalk
Prod-Deploy
JavaAppElastic Beanstalk
QATeamReviewManual Approval
マニュアル承認Review
MyApplication
![Page 49: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/49.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
9. ビルドアーティファクトを取得
Source
SourceCodeCommit
Build
JenkinsOnEC2CodeBuild
Deploy
JavaAppCodePipeline
ソースアーティファクト
S3
ビルドアーティファクト
S
5. ソースアーティファクトを取得
1. 変更を取得
6. ビルドアーティファクトを格納
3. ジョブをポーリング
4. ジョブを承認
7. 成功を通知
8. CodePipelineでイメージを更新
MyApplication
AWS CodeCommit
Amazon ECS
Amazon ECR
AWS CodeBuild
![Page 50: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/50.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS CodeStar
• AWS上でのアプリケーションの素早い開発、ビルド、デプロイ
• 数分でAWS上での開発を開始
• 安全にチームを横断して作業
• ソフトウェア デリバリーを容易に管理
• 多様なプロジェクトテンプレートから選択
![Page 51: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/51.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Codeシリーズを利用した
パイプラインの自動化
![Page 52: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/52.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Demo
AWS CodeStarによるCI/CD環境の構築
![Page 53: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/53.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2インスタンスのための継続的デリバリー(CodeDeploy)
AWS CodeCommit AWS
CodeBuild
Source Repository Build Deploy
Or
AWS Cloud9
AWS CodeStar
Author
AWS CodePipeline
Monitor
AWS X-Ray
And/ or Amazon
CloudWatch
AWS CodeDeployAmazon
EC2
![Page 54: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/54.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2インスタンスのための継続的デリバリー(Elastic Beanstalk)
AWS CodeCommit AWS
CodeBuild
Source Repository Build
Or
AWS Cloud9
AWS CodeStar
Author
AWS CodePipeline
Monitor
AWS X-Ray
And/ or Amazon
CloudWatch
Amazon EC2
AWS Elastic Beanstalk
![Page 55: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/55.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
サーバーレスアプリケーションのための継続的デリバリー
AWS CodeCommit
AWS CodeBuild
Source Repository Build Deploy
Or
AWS Cloud9
AWS CodeStar
AWS Lambda
Author
AWS CodePipeline
Monitor
AWS X-Ray
And/ or Amazon
CloudWatch
![Page 56: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/56.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
コンテナのための継続的デリバリー
AWS CodeCommit
AWS CodeBuild
Amazon ECR
Amazon ECS/Fargate
Source repository Build Deploy
Or Or
AWS CodePipeline
![Page 57: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/57.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
価格AWS CodeStar
無料。作成したEC2インスタンスやパイプラインなどの課金が発生。AWS CodeCommit
$1 / アクティブユーザー/ 月 (最初の5ユーザーは無料)AWS CodePipeline
$1 / アクティブなパイプライン / 月 (最初の1つは無料)AWS CodeDeploy
Amazon EC2へのデプロイは無料$0.02 / オンプレミスサーバーへの更新
AWS CodeBuild分単位の課金。build.general1.smallで100分/月の無料枠
Compute Instance
Type
Memory(GB) vCPU Price per build minute
($)
Small 3 2 0.005
Medium 7 4 0.010
Large 15 8 0.020
![Page 58: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/58.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
まとめ
• DevOpsを実現するカルチャー、プラクティス、ツール
• 継続的インテグレーション/継続的デリバリーは必須
• AWS Codeシリーズを利用して、フルマネージドな環境でパイプラインの自動化を容易に実現!
• 付加価値を伴わない重たい作業はマネージドサービスに任せて、価値を生む作業に集中する!
![Page 59: AWS Codeシリーズを利用した パイプラインの自動化入門 · Visual StudioやEclipseなど普段利用しているIDEから接 続可能 Amazon S3のスケーラビリティ、可用性、堅牢なスト](https://reader034.vdocument.in/reader034/viewer/2022042305/5ed084e594292a06451f055a/html5/thumbnails/59.jpg)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.