半導体デバイス&MEMSの 微小材料・信頼性評価技術 · 位相差,度 製膜前 製膜後 ヤング率計測用共振システム(独自技術) ナノ薄膜のヤング率計測コンセプト
ナウなヤングにCloud Formationが流行ってほしい
-
Upload
sugawara-genki -
Category
Documents
-
view
7.001 -
download
0
Transcript of ナウなヤングにCloud Formationが流行ってほしい
ナウなヤングにCloudFormationが流行ってほしい
菅原元気
注意
『おめぇCloudFormationわかってねぇよ!』
というかたは、後学のため、後ほど詰めにきてください(煽ってません)
自己紹介
菅原元気
@sgwr_dts / id:winebarrel
https://bitbucket.org/winebarrel
https://github.com/winebarrel
白金台の方から来ました
例の界隈で出てくるソフトウェア
• Docker
• Vagrant
• Serf
• ...etc
CloudFomationはないの...?
CloudFormationとは
• EC2やELBなどを使ったAWSサービスのシステム構築
を、設定ファイル(テンプレート)を元に行えるサー
ビス
• テンプレートを自由に作成できるため、自分好みのシステム構成が可能
• テンプレートは、AWSのサービスを操るための新しい
言語
([AWSマイスターシリーズ] AWS CloudFormationより引用)
CloudFormationとは
Infrastructure as Code!
DockerやVagrantと同じでコンテキストで
語られていい気がする…
しかし…
ナウなヤングにはウケそうもない…
1. JSON{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template Insoshi_Multi_AZ: Insoshi is an open source social networking platform in Ruby on Rails. This template installs a highly-available, scalable Insoshi deployment using a
multi-az Amazon RDS database instance for storage and using an S3 bucket for photos and thumbnails. It demonstrates using the AWS CloudFormation bootstrap scripts to install the packages and files necessary to deploy
Insoshi, Rails, MySQL and all dependent packages at instance launch time. **WARNING** This template creates one or more Amazon EC2 instances, an S3 bucket, and Amazon RDS database instance and other AWS
resources. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"KeyName": {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type": "String",
"MinLength": "1",
"MaxLength": "255",
"AllowedPattern" : "[¥¥x20-¥¥x7E]*",
"ConstraintDescription" : "can contain only ASCII characters."
},
"DBName": {
"Default": "insoshi",
"Description" : "MySQL database name",
"Type": "String",
"MinLength": "1",
"MaxLength": "64",
"AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*",
"ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters."
},
"DBUsername": {
"NoEcho": "true",
"Description" : "Username for MySQL database access",
"Type": "String",
1. JSON
JSONはいい子です!でも
•コメント書けない•ファイル分割できない
ないわー
1. JSON
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"#!/bin/bash -v¥n",
"yum update -y aws-cfn-bootstrap¥n",
"# Helper function¥n",
"function error_exit¥n",
"{¥n",
" /opt/aws/bin/cfn-signal -e 1 -r ¥"$1¥" '", { "Ref" : "WaitHandle" }, "'¥n",
" exit 1¥n",
"}¥n",
"# Install Apache Web Server, MySQL and Drupal¥n",
"/opt/aws/bin/cfn-init -s ", { "Ref" : "AWS::StackId" }, " -r WebServer ",
ないわー
2. Cloud-Init / cfn-init
Cloud-InitCloud-init is the defacto multi-distribution package that
handles early initialization of a cloud instance.
cfn-initThe cfn-init helper script reads template metadata from
the AWS::CloudFormation::Init key
2. Cloud-Init / cfn-init
• cfn-initはrpmあります。Ubuntsuもにもインストールできます
o http://aws.amazon.com/developertools/40
26240853893296
• しかし、、、まずCloud-Init / cfn-init入りのAMI作らないといけないの?sshでコマンドたたくだけってできないの?
ないわー
3. スタック
• リソース(EC2インスタンスやS3バケット、RDSインスタンスなど)の
集合のこと
• スタック単位でリソースの管理が可能。スタック破棄を実行すると、ス
タックにひもづくリソースを破棄することが可能
• 使用するリソースおよびリソースの構築順は、テンプレートの依存関係で
決定
([AWSマイスターシリーズ] AWS CloudFormationより引用)
3. スタック
理念は分かる。しかし
• サーバが増えたり減ったりするサービスだと管理しにくい
• スタックとリソースのひも付けは選択できるが、それをテンプレートに書くのは間違ってるだろ!
ないわー
4. ツール
AWS CLIはいい子ですよ?http://docs.aws.amazon.com/cli/latest/reference/cloudformation/
でも、いまいちいけてない
4. ツール
あと、ブログとか「Web GUIからこのように操作します」とか
書いちゃうのはいかがなものかと思う…
ないわー
しかし
CloudFormationには夢がある
※発表者はジョジョ5部を読んだことがありません
CloudFormationには夢がある
• サーバ群を構築するのは、VagrantやDocker
より直感的でわかりやすい(と思う)
• AWSユーザに関しては本番環境でテンプレートが使える
• CIで!CIで!使える(はず)
CI?
サーバ群構築を自動化できると
• 可用性のテストを自動化できる(MHAとかLVSとかHeartbeatとか)
• 負荷テストを自動化できる• サービス間連携のテストを自動化できる
まさに未来
未来に向かって
がんばってみました
Kumogata
• CloudFormationの薄いラッパーです
• Ruby DSLを使えます(JSONも使えます)AWSTemplateFormatVersion "2010-09-09"Description (<<-EOS).undent Kumogata Sample Template You can use Here document!EOSParameters do
InstanceType doDefault "t1.micro"Description "Instance Type"Type "String"endendResources domyEC2Instance do
Type "AWS::EC2::Instance"
Kumogata
• スタックを使うか使わないかは任意(テンプレートに書く必要はない)
• Cloud-Init / cfn-initがなくてもsshでセットアップできます
• 便利CLIが付いてきます
Demo
Demo
…は長いので端折ります
See https://github.com/winebarrel/kumogata#demo
Please try it out!是非!
Please try it out!是非!…というほどでもないです
まとめ
• とはいえサーバ群のテンプレート化は夢があります。o 冗長化のテストとか自動化できたらうれしいですよねぇ…
• なのでCloudFormationがナウなヤングに流行ってほしいです
まとめ
• 誰かテスト部分作ってください!
負荷テストはruby-jmeterでいいかも…