This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'right_aws' | |
require 'nkf' | |
require 'net/smtp' | |
# このスクリプトでジョブの結果をメールで通知する場合はローカル環境にsmtpサーバが必要です | |
# 動作確認に使用した環境は以下の通りです | |
# * ruby 1.8.7 | |
# * postfix 2.3.3 | |
# スクリプトを使用する場合は以下の順番で引数を指定して下さい |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'rubygems' | |
require 'aws-sdk' | |
## アクセスIDとシークレットアクセスキーを指定します | |
ACCESS_KEY = 'SET UP YOUR ACCESS KEY' | |
SECRET_KEY = 'SET UP YOUR SECRET KEY' | |
## 引数チェック | |
unless ARGV.size == 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
## aws-sdk for rubyを使用したEC2インスタンス起動スクリプト | |
## 引数に指定する値はリージョンURL、インスタンスID、固定IPとなります | |
## インスタンスのステータスを判定して起動もしくは停止をします | |
## 引数で指定するURLの例は以下の通りです | |
## ec2.us-east-1.amazonaws.com | |
## ec2.us-west-1.amazonaws.com | |
## ec2.eu-west-1.amazonaws.com | |
## ec2.ap-southeast-1.amazonaws.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: UTF-8 -*- | |
# このスクリプトはあるURLでログインして失敗したら警告メールをyammerに投稿するスクリプトです | |
# スクリプトを実行するには以下のライブラリが必要となりますので、事前にインストールして下さい | |
# gem install httpclient | |
# gem install tmail | |
# gem install tlsmail | |
require 'rubygems' | |
require 'httpclient' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'rubygems' | |
require 'right_aws' | |
### 使用例 | |
# ruby rightaws_runstop_dbinstance.rb rds_instance_name db.m1.small security-group parameter_group | |
### 事前に指定するパラメータ | |
# * RDSのインスタンス名 | |
# * RDSのインスタンスタイプ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'aws-sdk' | |
# ACCESS_KEYとSECRET_KEYを定義します | |
ACCESS_KEY = 'YOUR_ACCESS_KEY' | |
SECRET_KEY = 'YOUR_SECRET_KEY' | |
# AWSの認証を行い、テストメールを送信します | |
ses = AWS::SimpleEmailService.new(:access_key_id => ACCESS_KEY,:secret_access_key => SECRET_KEY) | |
ses.send_email( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'aws-sdk' | |
# ACCESS_KEYとSECRET_KEYを定義します | |
ACCESS_KEY = 'YOUR_ACCESS_KEY' | |
SECRET_KEY = 'YOUR_SECRET_KEY' | |
# 送信メールの本文を作成します | |
body = 'Sample email attaching file.' | |
# ファイルを読み込みbase64フォーマットにエンコードします |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
## 複数のセキュリティグループに同一の許可ルールを設定します | |
## スクリプトの引数には設定するセキュリティグループを指定します | |
require 'aws-sdk' | |
# 設定するプロトコルや接続元のIPアドレスを設定する | |
protocol = 'set tcp or udp or icmp' | |
port = 'set port number' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## EC2 confiration | |
export JAVA_HOME="Set your java home path" | |
export EC2_HOME="Set your ec2 home path" | |
export EC2_PRIVATE_KEY="Set your aws private-key" | |
export EC2_CERT="Set your your X509-cert" | |
export EC2_URL="Set using ec2 url" | |
export EC2_REGION="Set using ec2 region" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
## EC2 confiration | |
export JAVA_HOME="Set your java home path" | |
export EC2_HOME="Set your ec2 home path" | |
export EC2_PRIVATE_KEY="Set your aws private-key" | |
export EC2_CERT="Set your your X509-cert" | |
export EC2_URL="Set using ec2 url" | |
export EC2_REGION="Set using ec2 region" |
OlderNewer