AWS Elastic...
Transcript of AWS Elastic...
1
AWS Elastic Beanstalk
AWS Black Belt Tech Webinar 2015アマゾン ウェブ サービス ジャパン株式会社ソリューションアーキテクト 篠原 英治
2015/11/25
2
{"Name" : "篠原英治","Twitter" : "@shinodogg","Blog" : "http://shinodogg.com","Profile" : {
"Role" : "Solutions Architect","Market": "Startup","Subject Matter Expert" : [
"Amazon CloudSearch","Amazon Elasticsearch Service","Amazon Simple Workflow Service","AWS Elastic Beanstalk"
]}
}
3
Agenda
• Introduction
• Deployment
• Monitoring
• Docker Support
• Worker Tier
• Customer Use-cases
• Tips
4
Agenda
• Introduction
• Deployment
• Monitoring
• Docker Support
• Worker Tier
• Customer Use-cases
• Tips
5
AWS Elastic Beanstalk
http://en.hatsuon.info/word/beanstalk
http://ejje.weblio.jp/content/beanstalk
• 読み方• ビーンストーク• ビーンスターク
http://www.otsuka.co.jp/bst/
6
AWS Elastic Beanstalk
• 特徴 (http://aws.amazon.com/jp/elasticbeanstalk/)
– 速く簡単にアプリケーションをデプロイ可能– インフラストラクチャの準備&運営からアプリ
ケーションスタックの管理まで自動化– Auto Scaling によりコストを抑えながらスケー
ラビリティを確保– Java, PHP, Ruby, Python, Node.js, .NET,
Docker, Goに対応
• 価格体系 (http://aws.amazon.com/jp/elasticbeanstalk/pricing/)
– 追加料金なし– アプリケーションの保存、実行に必要なAWSリ
ソース (EC2, S3, RDS, DynamoDB など) に対してのみ課金
インフラ構成の構築・アプリデプロイの自動化サービス
7
Elastic Beanstalk vs. Do It YourselfOn-instance configuration
Your code
HTTP Server
Application Server
Language Interpreter
Operating System
Host
8
On-instance configuration
Your code
HTTP Server
Application Server
Language Interpreter
Operating System
Host
アプリケーションの開発”だけ”にフォーカス
Elastic Beanstalkにお任せ!
Elastic Beanstalk vs. Do It Yourself
9
• あらかじめ定義されたインフラストラクチャ
• Single instance (開発環境, ローコスト)
• Load balancing, Auto Scaling (本番環境)
• Web Tier と Worker Tier
• リソースのプロビジョニング
• Load Balancer
• Auto Scaling group
• Security groups
• Database (optional)
• ユニークなドメイン名の提供
• 例) yourapp.elasticbeanstalk.com
Infrastructure stack
Elastic Beanstalk vs. Do It Yourself
10
• アプリケーションを簡単にデプロイ
• 複数バージョンの切り替え
• 複数環境の切り替え
Easy Deployment
Elastic Beanstalk vs. Do It Yourself
11
Agenda
• Introduction
• Deployment
• Monitoring
• Docker Support
• Worker Tier
• Customer Use-cases
• Tips
12
Elastic Beanstalkでアプリケーションをデプロイするのに必要なこと
1
2
3
4
Region
Stack (container) type
Single-InstanceLoad Balanced w/ Autoscaling
or
Database (RDS) optional
Your codeSupported Platforms
13
1
2
3
4
Region
Stack (container) type
Single-InstanceLoad Balanced w/ Autoscaling
or
Database (RDS) optional
Your code
■ デプロイを行う方法1.AWS Management Console を使う2.AWS Toolkit for Eclipse/Visual Studio IDEを使う3.EB Command Line Interface(EB CLI) を使う
$ eb deploy
Elastic Beanstalkでのデプロイ
14
Elastic Beanstalkでのデプロイ
1
2
3
4
Region
Stack (container) type
Single-InstanceLoad Balanced w/ Autoscaling
or
Database (RDS) optional
Your code
■ デプロイを行う方法1.AWS Management Console を使う2.AWS Toolkit for Eclipse/Visual Studio IDEを使う3.EB Command Line Interface(EB CLI) を使う
$ eb deploy
今回は上記3.のEB CLIを使ったデプロイ方法をご紹介します
15
サンプルアプリケーション
• Node.js + Expressな会員登録アプリケーション– ソースコードは↓から入手可能
– https://github.com/awslabs/eb-node-express-sample
16
サンプルアプリケーションのデプロイ
1. EB CLIのインストール:$ pip install --upgrade awsebcli
2. サンプルアプリケーションのダウンロード:$ git clone https://github.com/awslabs/eb-node-express-sample.git
3. Elastic Beanstalk applicationの作成:$ eb init
4. プロンプトに従って環境の設定
5. リソースの作成およびアプリケーションのローンチ:$ eb create
17
サンプルアプリケーションのデプロイ
• eb initのプロンプト: リージョンの選択
Select a default region1) us-east-1 : US East (N. Virginia)2) us-west-1 : US West (N. California)3) us-west-2 : US West (Oregon)4) eu-west-1 : EU (Ireland)5) eu-central-1 : EU (Frankfurt)6) ap-southeast-1 : Asia Pacific (Singapore)7) ap-southeast-2 : Asia Pacific (Sydney)8) ap-northeast-1 : Asia Pacific (Tokyo)9) sa-east-1 : South America (Sao Paulo)10) cn-north-1 : China (Beijing)(default is 3):
18
サンプルアプリケーションのデプロイ
• eb initのプロンプト: アプリ名/スタック/SSH/Keypair
Enter Application Name(default is "eb-node-express-sample"):
It appears you are using Node.js. Is this correct?(y/n): yDo you want to set up SSH for your instances?(y/n): y
Select a keypair.1) oregon2) [ Create new KeyPair ](default is 2): 1
19
サンプルアプリケーションのデプロイ
• eb initのプロンプト: スタック
Select a platform.1) Node.js2) PHP3) Python4) Ruby5) Tomcat6) IIS7) Docker8) Multi-container Docker9) GlassFish10) Go11) Java
20
サンプルアプリケーションのデプロイ
• eb createのプロンプト: Environment/CNAME/Deploy
Enter Environment Name(default is eb-node-express-sample): Enter DNS CNAME prefix(default is eb-node-express-sample):
Creating application version archive "5529".Uploading eb-node-express-sample/5529.zip to S3. This may take a while.Upload Complete.Environment details for: eb-node-express-sample
Application name: eb-node-express-sampleRegion: us-west-2Deployed Version: 5529Environment ID: e-ufxx79fmkc
21
サンプルアプリケーションのデプロイ
• EB CLIを使ってブラウザで表示$ eb open
22
サンプルアプリケーションのデプロイ
• UIを変更$ vim views/index.ejs$ git commit –am “modify UI”$ eb deploy$ eb open
23
サンプルアプリケーションのデプロイ
• サンプルアプリケーションを動かす
24
デプロイしたサンプルアプリケーションの詳細
• Application dependency management– package.json: パッケージの名前とバージョンを記載
{"name": "Elastic-Beanstalk-Sample-App","version": "0.0.1","private": true,"dependencies": {
"ejs": "latest","aws-sdk": "latest","express": "latest","body-parser": "latest"
},"scripts": {
"start": "node app.js"}
}
• Node.js→package.json• Ruby→Gemfile• PHP→composer.json
25
デプロイしたサンプルアプリケーションの詳細
• Application dependency management– package.json: パッケージの名前とバージョンを記載
{"name": "Elastic-Beanstalk-Sample-App","version": "0.0.1","private": true,"dependencies": {
"ejs": "2.3.4","aws-sdk": "2.2.17","express": "4.13.3","body-parser": "1.14.1"
},"scripts": {
"start": "node app.js"}
}
本番運用の際はバージョンを明記しましょう
26
デプロイしたサンプルアプリケーションの詳細
• .ebextensions を活用した環境のカスタマイズ– Elastic Beanstalkの定義されたテンプレートのカスタマイズ– 例えば、”サーバー監視のサービスをインストールしたい”
本番運用の際はバージョンを明記しましょう
http://www.slideshare.net/shotaumeda1/aws-startuptechsummer2015/15
Retty 梅田さんのスライド.ebextensionsでMackerelの
自動インストールを実現
27
デプロイしたサンプルアプリケーションの詳細
• options.config – 環境変数の設定
本番運用の際はバージョンを明記しましょう
option_settings:aws:elasticbeanstalk:application:environment:THEME: "flatly"AWS_REGION: '`{ "Ref" : "AWS::Region"}`'STARTUP_SIGNUP_TABLE: '`{ "Ref" : "StartupSignupsTable"}`'NEW_SIGNUP_TOPIC: '`{ "Ref" : "NewSignupTopic"}`'
aws:elasticbeanstalk:container:nodejs:ProxyServer: nginx
aws:elasticbeanstalk:container:nodejs:staticfiles:/static: /static
aws:autoscaling:asg:Cooldown: "120"
aws:autoscaling:trigger:Unit: "Percent"Period: "1"BreachDuration: "2"UpperThreshold: "75"LowerThreshold: "30"MeasureName: "CPUUtilization"
28
デプロイしたサンプルアプリケーションの詳細• resources.config – 追加のリソース定義
本番運用の際はバージョンを明記しましょう
Resources:StartupSignupsTable:
Type: AWS::DynamoDB::TableProperties:KeySchema:HashKeyElement: {AttributeName: email, AttributeType: S}
ProvisionedThroughput: {ReadCapacityUnits: 1, WriteCapacityUnits: 1}NewSignupQueue: Type: AWS::SQS::Queue
NewSignupTopic:Type: AWS::SNS::TopicProperties:Subscription:- Endpoint:
Fn::GetOptionSetting: {DefaultValue: [email protected], OptionName: NewSignupEmail}Protocol: email
- Endpoint:Fn::GetAtt: [NewSignupQueue, Arn]
Protocol: sqs
29
.ebextensions
• .ebextensions を活用してElastic Beanstalkに集約– option_settings セクション
• 環境内のAWSリソース、アプリケーションを実行するソフトウエアの設定
– resources セクション• CloudFormationがサポートするあらゆるリソースの追加および設定
– 環境を起動する際に使うCloudFormationテンプレートに追加– その他のセクション
• packages、sources、files、users、groups、commands、container_commands、services
• 起動されるEC2インスタンスの設定
• セクション毎にファイルを分割するのを推奨※ 設定ファイルはアルファベット順に処理される
30
• packages– yum/rpm/rubygems等を利用したパッケージのインストール
– 例) yumから最新、rpmでURL指定、rubygemsでchef 0.10.2
.ebextensions
packages: yum:
libmemcached: [] ruby-devel: []gcc: []
rpm:epel:
http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rubygems: chef: '0.10.2'
31
• sources– 外部からのアーカイブをダウンロードして指定した場所に展開
• tar、tar+gzip、tar+bz2、zip をサポート
– 例) S3にあるアーカイブファイルを指定したディレクトリに展開
.ebextensions
sources: /etc/myapp: http://s3.amazonaws.com/mybucket/my.tgz
32
• files– EC2上にファイルを作成。外部からファイルを取得することも可能
– 例) ファイルをコピーしてrootだけ書き込める権限で配置
– 例) シンボリックリンク myfile1.txt を参照する myfile2.txt
.ebextensions
files:"/home/ec2-user/myfile" :
mode: "000755"owner: rootgroup: rootsource: http://foo.bar/myfile
files:"/tmp/myfile2.txt" :
mode: "120400"content: "/tmp/myfile1.txt"
33
• groups– グループを作成
– 例) groupOneはグループIDなし、groupTwoのグループIDは45
.ebextensions
groups:groupOne:groupTwo:
gid: "45"
34
• users– ユーザーを作成
– 例) ユーザーID、グループ名、ホームディレクトリの設定
.ebextensions
users:myuser:
groups:- group1- group2
uid: "50"homeDir: "/home/myuser"
35
• commands– サーバー設定後、バージョンファイルが抽出される前に実行されるコマンド
– 例) pythonスクリプトを実行
.ebextensions
commands:python_install:
command: myscript.pycwd: /home/ec2-userenv:
myvarname: myvarvaluetest: '[ ! /usr/bin/python ] && echo "python not installed"'
36
• container_commands– サーバー設定後、バージョンファイルが抽出された後に実行されるコマンド
• AWSセキュリティ認証情報などの環境変数にもアクセス可能
• leader_only(option): AutoScalingグループのリーダーにするインスタンスのみ
– 例) Djangoの管理タスクを実行
.ebextensions
container_commands:01collectstatic:
command: "django-admin.py collectstatic --noinput”02syncdb:
command: "django-admin.py syncdb --noinput"leader_only: true
03migrate:command: "django-admin.py migrate"leader_only: true
37
• services– インスタンス起動時に開始/停止する必要のあるサービスを定義
– 例) 起動時にサービスサービスが自動的に開始される
.ebextensions
services: sysvinit:
myservice:enabled: true
38
Elastic Beanstalkにおけるデプロイの選択肢
• Rolling Deploy
現 現 現 現
39
• Rolling Deploy
現 現 現 現
Elastic Beanstalkにおけるデプロイの選択肢
40
• Rolling Deploy
新 現 現 現
Elastic Beanstalkにおけるデプロイの選択肢
41
Elastic Beanstalkにおけるデプロイの選択肢
• Rolling Deploy
新 現 現 現
42
Elastic Beanstalkにおけるデプロイの選択肢
• Rolling Deploy
新 現 現 現
43
Elastic Beanstalkにおけるデプロイの選択肢
• Rolling Deploy
新 新 現 現
44
Elastic Beanstalkにおけるデプロイの選択肢
• Rolling Deploy
新 新 現 現
45
Elastic Beanstalkにおけるデプロイの選択肢
• Rolling Deploy
新 新 現 現
46
Elastic Beanstalkにおけるデプロイの選択肢
• Rolling Deploy
新 新 新 現
47
Elastic Beanstalkにおけるデプロイの選択肢
• Rolling Deploy– Batch type: Auto Scaling グループ内のインスタンスの割合もしくは一定数– Batch size: 割合(%)もしくはインスタンス数(AutoScaling設定の最大数まで)– 2台ずつデプロイする場合の設定は Batch type: Fixed, Batch size: 2– 例) 30%ずつRolling Deploy
48
Elastic Beanstalkにおけるインスタンス置換え
• Rolling Updates– アプリケーションデプロイではなくインスタンスの置換え
• 内部的にはCloudFromationのUpdate Policyを利用– VPC設定やAuto ScalingのLaunch Configurationの設定変更
一度に入れ替えるインスタンスの最大数
最低限維持すべきインスタンス数
各Update操作間のPause時間
49
Elastic Beanstalkにおけるデプロイの選択肢
• Blue/Green Deploy
現 現 現 現
50
Elastic Beanstalkにおけるデプロイの選択肢
• Blue/Green Deploy
現 現 現 現 新 新 新 新
51
Elastic Beanstalkにおけるデプロイの選択肢
• Blue/Green Deploy
現 現 現 現 新 新 新 新
52
Elastic Beanstalkにおけるデプロイの選択肢
• Blue/Green Deploy
新 新 新 新
53
v1.1 v1.1
v1.1 v1.1
v1.1 v1.1
v1.1 v1.1
v1.2
v1.2
v1.2.1
v1.2.1
v1.2.2
v1.2.2
DNS(Amazon route 53)
Webサーバー群(Amazon EC2)
データベースサーバ群(Amazon RDS)
ロードバランサー
90% 5% 3% 2%
Elastic Beanstalkにおけるデプロイの選択肢
54
Elastic Beanstalkにおけるデプロイの選択肢
• Rolling Deploy? Blue/Green Deploy?– Rolling Deploy
• 新しくサーバーを立てるわけではないのでデプロイにかかる時間が短い
• 新しいバージョンにバグ等があった場合にRollbackに手間がかかる
– Blue/Green• 新しくサーバーを立てるので環境作成に時間がかかる• Rollbackが容易• Elastic BeanstalkのDNSのTTLはデフォルト60秒であるが、
接続元のデバイスによってDNSがキャッシュされてしまうような場合デプロイが反映されない場合がある
55
Agenda
• Introduction
• Deployment
• Monitoring
• Docker Support
• Worker Tier
• Customer Use-cases
56
Elastic Beanstalkにおけるモニタリング
• EB CLIでモニタリング$ eb health --refresh
57
Elastic Beanstalkにおけるモニタリング
• マネージメントコンソール上でモニタリング
58
Elastic Beanstalkにおけるモニタリング
• マネージメントコンソール上でモニタリング
カスタマイズ可能!
59
Elastic Beanstalkにおけるモニタリング
• マネージメントコンソールでの拡張ヘルスレポート
60
Elastic Beanstalkにおけるモニタリング• マネージメントコンソールでの拡張ヘルスレポート
– メトリクス• EnvironmentHealth
– OK– Warning– Degraded– Severe– Info– Pending– Unknown
http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/health-enhanced-cloudwatch.html#health-enhanced-cloudwatch-metrics
61
Elastic Beanstalkにおけるモニタリング• マネージメントコンソールでの拡張ヘルスレポート
– メトリクス: 該当のインスタンスの数を表示• InstancesSevere• InstancesDegraded• InstancesWarning• InstancesInfo• InstancesOk• InstancesPending• InstancesUnknown• InstancesNoData
http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/health-enhanced-cloudwatch.html#health-enhanced-cloudwatch-metrics
62
Elastic Beanstalkにおけるモニタリング• マネージメントコンソールでの拡張ヘルスレポート
– メトリクス: リクエスト総数および各レスポンスコード毎の数• ApplicationRequestsTotal• ApplicationRequests5xx• ApplicationRequests4xx• ApplicationRequests3xx• ApplicationRequests2xx
http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/health-enhanced-cloudwatch.html#health-enhanced-cloudwatch-metrics
63
Elastic Beanstalkにおけるモニタリング• マネージメントコンソールでの拡張ヘルスレポート
– メトリクス: xパーセントの完了にかかった平均時間• ApplicationLatencyP10• ApplicationLatencyP50• ApplicationLatencyP75• ApplicationLatencyP85• ApplicationLatencyP90• ApplicationLatencyP95• ApplicationLatencyP99• ApplicationLatencyP99.9
http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/health-enhanced-cloudwatch.html#health-enhanced-cloudwatch-metrics
64
Elastic Beanstalkにおけるモニタリング• マネージメントコンソールでの拡張ヘルスレポート
– メトリクス• LoadAverage1min: 1分間のLoad値の平均値• InstanceHealth: 現在のインスタンスのヘルスステータス• RootFilesystemUtil: 使用ディスク容量の割合
http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/health-enhanced-cloudwatch.html#health-enhanced-cloudwatch-metrics
65
Elastic Beanstalkにおけるモニタリング• マネージメントコンソールでの拡張ヘルスレポート
– メトリクス: 過去1分間のCPU使用状況• CPUIrq• CPUUser• CPUIdle• CPUSystem• CPUSoftirq• CPUIowait• CPUNice
http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/health-enhanced-cloudwatch.html#health-enhanced-cloudwatch-metrics
66
CloudWatch Logsを使ってログ監視
CloudWatch Logs Agentを追加する設定ファイル- Tomcat (Java)向け- Apache (PHP and Python)向け- Nginx (Ruby, Node.js, and Docker)向けCloudWatch Logsへの書き込み権限はIAM Roleで
http://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/AWSHowTo.cloudwatchlogs.html
67
提供されるCloudWatch Logs Agent設定ファイル
• cwl-setup.config– CloudWatch Logs agentを各EC2インスタンスにインストール– 設定ファイルgeneral.confを作成– 修正なしで利用可能
• cwl-webrequest-metrics.config– どのファイルを監視するかを設定– CloudWatch Logs Agentが適用するMetrics Filterを指定– Alarmの条件や通知先Amazon SNSのTopicなどを指定– カスタムログや追加のAlarm設定などがあれば必要に応じて修正して利用
• eb-logs.config– CloudWatch Logs Agentが出力するログファイルのローテーションなどの設定– 修正なしで利用可能
68
Elastic Beanstalkの便利機能
• SSH接続が必要な場合もEB CLIで$ eb ssh –i xxxx
69
Agenda
• Introduction
• Deployment
• Monitoring
• Docker Support
• Worker Tier
• Customer Use-cases
• Tips
70
Elastic BeanstalkのDockerサポート
• Single Container– EC2インスタンスの中で単一のDockerコンテナを実行– Elastic Beanstalkの標準的であらかじめ定義された設定の活用
Environment
Host Manager
AutoScaling
Nginx (tcp:80)
Docker(tcp: xxxx)
コンテナの起動・終了
Nginxとコンテナとの接続ポートの更新
コマンド
71
Elastic BeanstalkのDockerサポート
• Multi Container– EC2 Container Service(ECS)を使用– Dockerrun.aws.jsonを使ったより柔軟な構成が可能に
72
Elastic BeanstalkのDockerサポート• Dockerrun.aws.json
73
Elastic BeanstalkのDockerサポート• Dockerrun.aws.json
{"AWSEBDockerrunVersion": 2,"volumes": [{
"name": "php-app","host": {
"sourcePath": "/var/app/current/php-app"}
},{
"name": "nginx-proxy-conf","host": {
"sourcePath": "/var/app/current/proxy/conf.d"}
} ],
"containerDefinitions": [{"name": "php-app","image": "php:fpm","essential": true,"memory": 128,"mountPoints": [
{"sourceVolume": "php-app","containerPath": "/var/www/html","readOnly": true
}]
},
Single は 1Multi は 2
PHPアプリ用コンテナとProxyのNginx用コンテナのボリューム(マウントポイント)
PHPアプリ用コンテナのインフラ設定Dockerイメージ指定、メモリ設定、Sourceボリュームからコンテナへのファイルコピー
74
Elastic BeanstalkのDockerサポート• Dockerrun.aws.json
"mountPoints": [{"sourceVolume": "php-app","containerPath": "/var/www/html","readOnly": true
},{"sourceVolume": "nginx-proxy-conf","containerPath": "/etc/nginx/conf.d","readOnly": true
},{"sourceVolume": "awseb-logs-nginx-proxy","containerPath": "/var/log/nginx"
}]
}]
}
{"name": "nginx-proxy","image": "nginx","essential": true,"memory": 128,"portMappings": [
{"hostPort": 80,"containerPort": 80
}],"links": [
"php-app"],
Proxy用コンテナのインフラ設定ホスト側の80版ポートとコンテナ側の80版ポートをマッピングして裏のPHPアプリへルーティング
75
Elastic BeanstalkのDockerサポート• ローカルでのDockerコンテナの実行
– EB CLI$ eb local run
• 開発時に便利なコマンド群
$ eb local status
$ eb local open
$ eb local logs
$ eb local runCreating elasticbeanstalk_phpapp_1...Creating elasticbeanstalk_nginxproxy_1...Attaching to elasticbeanstalk_phpapp_1, elasticbeanstalk_nginxproxy_1phpapp_1 | [23-Apr-2015 23:24:25] NOTICE: fpm is running, pid 1phpapp_1 | [23-Apr-2015 23:24:25] NOTICE: ready to handle connections
76
Agenda
• Introduction
• Deployment
• Monitoring
• Docker Support
• Worker Tier
• Customer Use-cases
• Tips
77
Elastic Beanstalk Worker Tier
• バッチアプリケーションもElastic Beanstalkで– SQS + Auto Scalingでスケーラブルなバッチ処理基盤
• Scale-InしてもメッセージはSQSに残るため後から処理
78
Elastic Beanstalk Worker Tier
• Workerホスト内でWebアプリケーションが動作– Sqsd
• Workerホスト内で動作するデーモン• Webアプリからの応答
– 200 OKの場合→SQSからメッセージを削除(DeleteMessage)– 200 OK以外の場合→VisibilityTimeout(SQSの設定)後にSQS
からメッセージが取得可能(リトライ)– 応答無し→Inactivity Timeout(Elastic Beanstalkの設定)後
にSQSからメッセージが取得可能(リトライ)• Dead Letter Queue
– 何度実行しても200 OK以外でSQSのキューに残り続けてしまうメッセージを別のキュー(Dead Letter Queue)に移動
79
Elastic Beanstalk Worker Tier
• 定期的なタスク実行– cron.yaml
• 例) 12時間ごとにbackupジョブを実行毎日午後11時にauditジョブを実行
version: 1cron:- name: "backup"
url: "/backup" schedule: "0 */12 * * *"
- name: "audit"url: "/audit"schedule: "0 23 * * *"
80
Agenda
• Introduction
• Deployment
• Monitoring
• Docker Support
• Worker Tier
• Customer Use-cases
• Tips
81
ユーザー事例: Royal Caribbean Cruises Ltd.
• 43隻の大型船を運営中。今後更に拡大予定
• 7大陸490地点でサービスを展開中
• 9,000 ページのHTMLがサイトにホストされている
• 2015年3月に royalcaribbean.com をElastic Beanstalkを使ってローンチ
• ピークシーズンは月間1億ページView
• 600万ユニークユーザー
82
ユーザー事例: Royal Caribbean Cruises Ltd.
• Scaling Your Web Applications with AWS Elastic Beanstalk
http://www.slideshare.net/AmazonWebServices/dvo201-scaling-your-web-applications-with-aws-elastic-beanstalk
https://www.youtube.com/watch?v=nkj0GXgaRv8
83
ユーザー事例: Royal Caribbean Cruises Ltd.
84
ユーザー事例: Retty
• RettyがElastic Beanstalkを使い始めて1年経過
http://www.slideshare.net/shotaumeda1/aws-startuptechsummer2015
85
ユーザー事例: Retty
• eb cloneで環境を丸ごと新たしい環境にコピー
86
ユーザー事例: SONY
• Building At-Scale Services with AWS Elastic Beanstalk
https://www.youtube.com/watch?v=gA_m_4ikTgg
http://www.slideshare.net/AmazonWebServices/dvo312-sony-building-atscale-services-with-aws-elastic-beanstalk
87
• Infrastructure as Code を実践
– Shinya Kawaguchiさん
• “Especially Elastic Beanstalk configuration files are very useful and powerful to customize environment, so we are utilizing them in our system”
ユーザー事例: SONY
88
• Auto Scaling: Custom Scaling Policy
ユーザー事例: SONY
89
• Zero Downtime Deployment
ユーザー事例: SONY
90
• クラスメソッドが構築した
クラウドネイティブなプラットフォーム
ユーザー事例: バーミヤン公式アプリ
http://dev.classmethod.jp/cloud/skylark-bamiyan-mobile-app/
91
Agenda
• Introduction
• Deployment
• Monitoring
• Docker Support
• Worker Tier
• Customer Use-cases
• Tips
92
Environment間リンク機能
• SQSのキューを介して疎結合なアーキテクチャを実現– Environment Manifest (env.yaml)
本番運用の際はバージョンを明記しましょう
AWSConfigurationTemplateVersion: 1.1.0.0EnvironmentLinks:
"WORKERQUEUE": "worker"
93
時間指定のスケーリング
• Time-based Scaling– 時間設定でスケールアウト/インを制御
本番運用の際はバージョンを明記しましょう
94
各種ログの有効活用
• インスタンスログhttp://docs.aws.amazon.com/ja_jp/elasticbeanstalk/latest/dg/using-features.logging.html
95
Tomcatに複数のwarをデプロイ
• warファイルと.ebextensionsを一つのzipに– MyApplication.zip
• .ebextensions• foo.war -> http://MyApplication.elasticbeanstalk.com/foo• bar.war -> http://MyApplication.elasticbeanstalk.com/bar• ROOT.war -> http://MyApplication.elasticbeanstalk.com/
– 注意点• ELBのヘルスチェックは一つのwarにしか行われない• 解決策: ヘルスチェック用のwarをデプロイ
– 各warにアクセスし想定通りのレスポンスが返ってくるかチェック
96
Release Notes
• 更新情報はリリースノートでチェック– https://aws.amazon.com/releasenotes/AWS-Elastic-Beanstalk
97
Q&A
次回Webinarのお申し込みhttp://aws.amazon.com/jp/event_schedule/
98
Webinar資料の配置場所
• AWS クラウドサービス活用資料集– http://aws.amazon.com/jp/aws-jp-introduction/
99
公式Twitter/FacebookAWSの最新情報をお届けします
@awscloud_jp
検索
最新技術情報、イベント情報、お役立ち情報、お得なキャンペーン情報などを日々更新しています!
もしくはhttp://on.fb.me/1vR8yWm
100
ご参加ありがとうございました。