華麗なるelastic beanstalkでの環境構築

Post on 05-Dec-2014

7.960 Views

Category:

Technology

7 Downloads

Preview:

Click to see full reader

DESCRIPTION

NetCOBOLによるAWS活用事例とAWSを活用した事例セミナーにてお話しした、Elastic Beanstalkを活用すべき3つのポイントについてのスライドです。

TRANSCRIPT

華麗なるElastic Beanstalkでの環境構築

2013年2月22日NetCOBOLによるAWS活用事例とAWSを活用した事例セミナー欧文印刷株式会社・田名辺健人 http://blog.dateofrock.com/

Who am I ?(この顔にピンときたら)

田名辺 健人(たなべたけひと)

ソフトウェアエンジニア

欧文印刷株式会社(東京都)高校まで札幌在住2011年11月から札幌でテレワーク

@dateofrock

http://blog.dateofrock.com/

有効期限切れてますww

1946年創業/社員数130名本社:東京都文京区工場:埼玉県坂戸市

アナログ・デジタル独自商品開発

紙で出来たホワイトボード消せる紙(し)

http://www.g-mark.org/award/describe/39114

ノート型ホワイトボードNUboard

✓Elastic Beanstalkとは?✓使う3つの理由

✓Elastic Beanstalkとは?✓使う3つの理由

ウェブインターフェース 識別&アクセスIAM

Identity FederationConsolidated Billing

デプロイ&自動化AWSElasticBeanstalk

AWSCloudFormation

AWSMangement Console Amazon CloudWatch

モニタリング

マネージメント&管理

コンテンツ配信Amazon

CloudFront

メッセージング

AmazonSNS

AmazonSQS

AmazonSES

検索Amazon CloudSearch

分散処理

ElasticMapReduce

AmazonSWF

ライブラリ&SDKJava, PHP, Python,

Ruby, .NET

アプリケーションプラットフォームサービス

基本サービスコンピューティング クラウドストレージ データベース ネットワーク

AmazonEC2

AutoScaling Amazon

S3Amazon

EBSAWS Storage

GatewayAmazon

RDSAmazon

DynamoDBAmazon

ElasticacheAmazon

VPCElastic Load

BalancerAmazonRoute53

AWS DirectConnect

アベイラビリティ―ゾーン

リージョンエッジロケーション

AWSグローバルインフラストラクチャ

アマゾン ウェブ サービスの製品・サービス構成

©Amazon Web Services LLC or its affiliates. All rights reserved.

http://aws.amazon.com/jp/what-is-aws/

ウェブインターフェース 識別&アクセスIAM

Identity FederationConsolidated Billing

デプロイ&自動化AWSElasticBeanstalk

AWSCloudFormation

AWSMangement Console Amazon CloudWatch

モニタリング

マネージメント&管理

コンテンツ配信Amazon

CloudFront

メッセージング

AmazonSNS

AmazonSQS

AmazonSES

検索Amazon CloudSearch

分散処理

ElasticMapReduce

AmazonSWF

ライブラリ&SDKJava, PHP, Python,

Ruby, .NET

アプリケーションプラットフォームサービス

基本サービスコンピューティング クラウドストレージ データベース ネットワーク

AmazonEC2

AutoScaling Amazon

S3Amazon

EBSAWS Storage

GatewayAmazon

RDSAmazon

DynamoDBAmazon

ElasticacheAmazon

VPCElastic Load

BalancerAmazonRoute53

AWS DirectConnect

アベイラビリティ―ゾーン

リージョンエッジロケーション

AWSグローバルインフラストラクチャ

アマゾン ウェブ サービスの製品・サービス構成

©Amazon Web Services LLC or its affiliates. All rights reserved.

ウェブインターフェース 識別&アクセスIAM

Identity FederationConsolidated Billing

デプロイ&自動化AWSElasticBeanstalk

AWSCloudFormation

AWSMangement Console Amazon CloudWatch

モニタリング

マネージメント&管理

コンテンツ配信Amazon

CloudFront

メッセージング

AmazonSNS

AmazonSQS

AmazonSES

検索Amazon CloudSearch

分散処理

ElasticMapReduce

AmazonSWF

ライブラリ&SDKJava, PHP, Python,

Ruby, .NET

アプリケーションプラットフォームサービス

基本サービスコンピューティング クラウドストレージ データベース ネットワーク

AmazonEC2

AutoScaling Amazon

S3Amazon

EBSAWS Storage

GatewayAmazon

RDSAmazon

DynamoDBAmazon

ElasticacheAmazon

VPCElastic Load

BalancerAmazonRoute53

AWS DirectConnect

アベイラビリティ―ゾーン

リージョンエッジロケーション

AWSグローバルインフラストラクチャ

アマゾン ウェブ サービスの製品・サービス構成

©Amazon Web Services LLC or its affiliates. All rights reserved.

2013/02/19追加!

AWSOpsWorks

ウェブインターフェース 識別&アクセスIAM

Identity FederationConsolidated Billing

デプロイ&自動化AWSElasticBeanstalk

AWSCloudFormation

AWSMangement Console Amazon CloudWatch

モニタリング

マネージメント&管理

コンテンツ配信Amazon

CloudFront

メッセージング

AmazonSNS

AmazonSQS

AmazonSES

検索Amazon CloudSearch

分散処理

ElasticMapReduce

AmazonSWF

ライブラリ&SDKJava, PHP, Python,

Ruby, .NET

アプリケーションプラットフォームサービス

基本サービスコンピューティング クラウドストレージ データベース ネットワーク

AmazonEC2

AutoScaling Amazon

S3Amazon

EBSAWS Storage

GatewayAmazon

RDSAmazon

DynamoDBAmazon

ElasticacheAmazon

VPCElastic Load

BalancerAmazonRoute53

AWS DirectConnect

アベイラビリティ―ゾーン

リージョンエッジロケーション

AWSグローバルインフラストラクチャ

アマゾン ウェブ サービスの製品・サービス構成

©Amazon Web Services LLC or its affiliates. All rights reserved.

2013/02/19追加!

AWSOpsWorks

時間もないので

AWSの良い資料があります

【注】スライドの手抜きではありません(笑)

AWS資料より抜粋 http://www.slideshare.net/AmazonWebServicesJapan/getting-startedwithbeanstalk-20130111

AWS資料より抜粋 http://www.slideshare.net/AmazonWebServicesJapan/getting-startedwithbeanstalk-20130111

AWS資料より抜粋 http://www.slideshare.net/AmazonWebServicesJapan/getting-startedwithbeanstalk-20130111

AWS資料より抜粋 http://www.slideshare.net/AmazonWebServicesJapan/getting-startedwithbeanstalk-20130111

続きはWebで

✓Elastic Beanstalkとは?✓使う3つの理由

✓Elastic Beanstalkとは?✓使う3つの理由

【1】簡単すぎる環境構築

war

構築+deploy完了

EC2 InstanceElastic Load Balancing

S3

war

Cloud Watch SNS

EC2 Instance

Elastic Beanstalk Environment

Auto scaling group

$ git aws.push

【2】便利なSwap URL

本番環境+

ステージング環境

2つの environment

environment1honban.elasticbeanstalk.com

environment1Running Version: version2

environment2staging.elasticbeanstalk.com

environment2Running Version: version3

ステージングを本番に昇格

SwapEnvironmentURL

staging.elasticbeanstalk.com

honban.elasticbeanstalk.com

本番がversion3になりました!

【3】必要十分なConfig

AMI

AMI

素のAMIをカスタマイズしたい!

AMI

✓パッケージ インストール✓コンテナ カスタマイズ

etc...

YAML

YAML

$APP_ROOT/.ebextensions/*.config

✓パッケージインストール✓アーカイブダウンロード + 展開✓ファイル生成 or コピー✓OSユーザー・グループ作成✓コマンド実行(OS用)✓コマンド実行(コンテナ用)✓サービス設定(/etc/init.d)✓Beanstalk固有の設定

YAML

packages: yum: libmemcached: [] ruby-devel: [] nfs-utils: [1.0.9]

rpm, yum, apt,rubygems (chef)

sources: /usr/local/bin:↵

http://hoge.com/hoge.tar.gz

tar, tar+gzip, tar+bz2, zip

files: "/home/ec2-user":

mode: "000777" owner: ec2-user group: ec2-user source: http://hoge.com/a.txt

files: "/home/ec2-user":

mode: "000777" owner: ec2-user group: ec2-user content: |

# this is my file# with content

content直書きOK

users: myuser: groups: group1 group2 uid: "50" homeDir: “/tmp”groups: - groupOne - groupTwo gid: "45"

commands: test: command: myscript.py cwd: /home/ec2-user env: myvarname: myvarvalue

container_commands: replace-server_xml: command: ↵ cp .ebextensions/server.xml ↵

/etc/tomcat7/server.xml

server.xmlの置換

container_commands: 01syncdb: command: "django-admin.py syncdb --noinput" leader_only: true 02migrate: command: "django-admin.py migrate" leader_only: true

マイグレーションの実行

services: sysvinit: myservice: enabled: true ensureRunning: true

option_settings: - namespace: ↵ aws:elasticbeanstalk:container:tomcat:jvmoptions option_name: Xmx value: 512m - option_name: AWS_SECRET_KEY value: SECRET_KEY - option_name: AWS_ACCESS_KEY_ID value: ACCESS_KEY

✓Elastic Beanstalkとは?✓使う3つの理由1.簡単すぎる環境構築2.便利なSwap URL3.必要十分なConfig

Elastic Beanstalkで華麗に環境構築しよう!

おしまい

top related