基本課金情報
- インスタンスを起動している時間に応じて課金
- t2.microの場合、1時間辺り0.020$
- 同一AZ内での通信は無料(他のEC2との通信やRDSとの通信)
| cat UserData.sh |sed 's/\"/\\\"/g' | sed 's/^/\"/g' | sed 's/$/\\n\",/g' | sed '$s/.$//' |
| var AWS = require('aws-sdk'); | |
| AWS.config.update({region: 'ap-northeast-1'}); | |
| var codedeploy = new AWS.CodeDeploy(); | |
| // getDeployment | |
| function getDeployment(deploymentId, callback) { | |
| var status = ''; | |
| var params = { | |
| deploymentId: deploymentId | |
| }; |
| #!/bin/bash | |
| DIR="hoge-dir" | |
| cd $DIR | |
| files=`ls` | |
| for file in ${files[@]}; do | |
| echo $file | |
| done |
| $yum install rpm-build | |
| # not su user | |
| $cd | |
| $mkdir rpmbuild | |
| $mkdir rpmbuild/BUILD | |
| $mkdir rpmbuild/BUILDROOT | |
| $mkdir rpmbuild/RPMS | |
| $mkdir rpmbuild/SOURCES | |
| $mkdir rpmbuild/SPECS |
| $sed -e 's/:[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]Z//g' access.log |awk -F " " '{ print $1,$8; }'| sort | uniq -c |
| #!/bin/bash | |
| ip=192.168.0.1 | |
| if [[ $ip =~ ^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then | |
| echo "ip address" | |
| else | |
| echo "not ip" | |
| fi |
| # キューの作成。MessageRetentionPeriodでメッセージの保持期間を14日に設定。また、ReceiveMessageWaitTimeSecondでロングポーリング時の待ち時間を20秒に設定。 | |
| aws sqs create-queue --queue-name test-sqs --attributes MessageRetentionPeriod=1209600,ReceiveMessageWaitTimeSeconds=20 | |
| # キューの表示 | |
| aws sqs list-queues | |
| # メッセージの送信 | |
| aws sqs send-message --queue-url https://ap-northeast-1.queue.amazonaws.com/hogefuga/test-sqs --message-body 'hello world!' | |
| # send-message-batchを使うことで最大10個のメッセージを同時に送信できる |
| require 'net/ssh' | |
| require 'fileutils' | |
| PASSWORD="password" | |
| CONFIG='./config_file' | |
| def write_config_file | |
| File.open(CONFIG, 'w') { |f| | |
| f << "Host fumidai\n" | |
| f << "HostName hoge\n" |