Amazon EC2 を利用したサーバ構築セミナーの実践報告.それと... AWS SDK for Ruby を使用したEC2インスタンス管理.
Seminar report of building a Linux server using Amazon EC2 and management of EC2 instances using AWS SDK for Ruby.
Jesse Martin became the youngest person to sail solo and nonstop around the world when he completed the voyage at age 17. He had grown up in Australia near the beach and developed a love of sailing and adventure from an early age through trips with his father and brother. Many people doubted he could complete such an ambitious voyage at a young age, but through self-belief and perseverance Jesse was able to achieve his dream and inspire others. He has since embarked on further adventures to continue promoting courage and determination in young people.
An extention of TogoTV for getting much more contributors and beneficiaries.
Advanced bioinformatics tips and tiny codes can be shared from this new feature, and the replication reports including corrections and suggestions can be deposited to TogoTV website.
Jesse Martin became the youngest person to sail solo and nonstop around the world when he completed the voyage at age 17. He had grown up in Australia near the beach and developed a love of sailing and adventure from an early age through trips with his father and brother. Many people doubted he could complete such an ambitious voyage at a young age, but through self-belief and perseverance Jesse was able to achieve his dream and inspire others. He has since embarked on further adventures to continue promoting courage and determination in young people.
An extention of TogoTV for getting much more contributors and beneficiaries.
Advanced bioinformatics tips and tiny codes can be shared from this new feature, and the replication reports including corrections and suggestions can be deposited to TogoTV website.
GREE Platform is a large social platform on which worldwide users can play games with each other.
It's developed by PHP, but Ruby is also used, especially in DevOpts.
I'll talk about how we are using Ruby.
GREE Platform is a large social platform on which worldwide users can play games with each other.
It's developed by PHP, but Ruby is also used, especially in DevOpts.
I'll talk about how we are using Ruby.
7. クラウドサービスについて確認
• クラウドの「構成要素」
- SaaS (Software as a Service)
- PaaS (Platform as a Service)
- IaaS (Infrastructure as a Service)
アプリケーション
ミドルウェア
OS SaaS
PaaS
CPU/メモリ/HDD IaaS
ネットワーク
K-Ruby, 15th. September 27, 2012 7
12年10月1日月曜日
48. main_controller.rb
class MainController < ApplicationController
INSTANCES_YAML_PATH = File.join(Rails.root, "config", "ec2.yml")
def index
instances = []
@infos = Hash.new{ |h, k| h[k] = {}}
all = YAML.load_file(INSTANCES_YAML_PATH)
@instance_ids = all["instance_id"]
ec2 = AWS::EC2.new
@instance_ids.each do |instance_id|
instances << ec2.instances[instance_id]
end
instances.each do |ins|
@infos[ins.id]["tag"] = ins.tags["ccsemi"]
@infos[ins.id]["status"] = ins.status
@infos[ins.id]["public_dns_name"] = ins.public_dns_name
@infos[ins.id]["public_ip_address"] = ins.public_ip_address
end
end
K-Ruby, 15th. September 27, 2012 48
12年10月1日月曜日
49. main_controller.rb(続き)
def stop_instance
id = params[:id]
ec2 = AWS::EC2.new
instance = ec2.instances[id]
if instance.status.to_s == "running"
instance.stop
end
redirect_to main_path
end
def start_instance
id = params[:id]
ec2 = AWS::EC2.new
instance = ec2.instances[id]
if instance.status.to_s == "stopped"
instance.start
end
redirect_to main_path
end
end
K-Ruby, 15th. September 27, 2012 49
12年10月1日月曜日
50. <table border="1">
index.html.erb
<tr>
<th>Instance ID</th>
<th>Tag name</th>
<th>Status</th>
<th>Action</th>
<th>Public DNS name</th>
<th>Public IP address</th>
</tr>
<% @instance_ids.each do |id| %>
<tr>
<td><%= id %></td>
<td><%= @infos[id]["tag"] %></td>
<td><%= @infos[id]["status"] %></td>
<td>
<%=
if @infos[id]["status"].to_s == "running" then
button_to "Stop", stop_instance_path(:id => id)
elsif @infos[id]["status"].to_s == "stopped" then
button_to "Start", start_instance_path(:id => id)
end
%>
</td>
<td><%= @infos[id]["public_dns_name"] %></td>
<td><%= @infos[id]["public_ip_address"] %></td>
</tr>
<% end %>
</table>
K-Ruby, 15th. September 27, 2012 50
12年10月1日月曜日
51. routes.rb
Ccaws::Application.routes.draw do
root :to => 'main#index'
match 'main' => 'main#index'
match 'stop_instance/:id' => 'main#stop_instance', :as => 'stop_instance'
match 'start_instance/:id' => 'main#start_instance', :as => 'start_instance'
end
ルーティング設定.URLパターンは3つ
Railsサーバの起動
$ bundle exec rails s
Rails.root
config app
routes.rb
controllers
ec2.yml main_controller.rb
views
initializers
aws.rb main
index.html.erb
K-Ruby, 15th. September 27, 2012 51
12年10月1日月曜日