ããã«ã¡ã¯ï¼4æã«å ¥ç¤¾ããã°ããã®AWSãã¼ã ã®æ°äººãã¨å¹´å¯ãã¶ããªã§ãï¼
Dynamoãæ±äº¬ã«ãã¦ããã¤ã¹ã¿ã¼ã·ãªã¼ãºã§ãåãä¸ãããã¾ãããçãã使ã£ã¦ã¾ããï¼
node.jsããDynamoãæä½ããã¯ã©ã¤ã¢ã³ããè¦ã¤ãã¾ããã®ã§ãç´¹ä»ãã¾ãï¼
å
ã«æ³¨æãã¦ããã¾ãããç§ã¯ã¯ã¤ã«ãã¨ã¯å
¨ãç¡ç¸ã®é¢ä¿ã§ãããã¾ããæ¹ãã¦ãèªèãã ããã
ä»åå©ç¨ããAMIã¯(amzn-ami-pv-2012.03.1.x86_64-ebs (ami-e47acbe5))ã§ãã
ã¾ãã¯node.jsã«å¿ è¦ãªç°å¢æ§ç¯ãè¡ãã¾ãã
yum install openssl-devel yum install gcc-c++ yum install make
ãã®å¾ãææ°ã®node.jsãã¤ã³ã¹ãã¼ã«ããå±éãã¾ãã
ç¾å¨ã®ææ°ãã¼ã¸ã§ã³ã¯v0.6.15ã§ããã
wget http://nodejs.org/dist/latest/node-v0.6.15.tar.gz tar -zxvf node-v0.6.15.tar.gz ./configure make make install
ã¤ã³ã¹ãã¼ã«ãçµãã£ãããnode -vãã§ãã¼ã¸ã§ã³è¡¨ç¤ºããããã¨ã確èªãã¦ãã ããã
ã¤ã³ã¹ãã¼ã«ãçµãã£ã¦ãã¦ãã¼ã¸ã§ã³ç¢ºèªã§ããªãå ´åã¯PATHãéã£ã¦ããªãã®ã§PATHãéãã¦ãã ããã
èªåã®å ´åã¯tmpã«ã¦ãã¡ã¤ã«ãã¦ã³ãã¼ããããã®ã§ãã·ã³ããªãã¯ãªã³ã¯ãä¸è¨ã®ããã«è²¼ãã¾ããã
ln -s /tmp/node-v0.6.15/out/Release/node /usr/sbin/node
ã¤ãã«ãnpmããã¤ã³ã¹ãã¼ã«ãã¾ãã
npmã¯PHPã®PEARçãªãã®ã§ãããããªã¢ã¸ã¥ã¼ã«ï¼ãã¬ã¼ã ã¯ã¼ã¯ãï¼ç°¡åã«ã¤ã³ã¹ãã¼ã«ã§ãã¾ãã
curl http://npmjs.org/install.sh | sh
ã¤ã³ã¹ãã¼ã«ãçµãã£ãããããããã¯ã©ã¤ã¢ã³ããã¼ã«ãdynodeããã¤ã³ã¹ãã¼ã«ãã¾ãã
npm install dynode
ããã ãã§ã¤ã³ã¹ãã¼ã«ã§ãã¾ãã ãã®ã¾ã¾ã§ãå©ç¨ã§ãã¾ãããregionããEastãã®ã¾ã¾ãªã®ã§ããTokyoãã«ãã¾ãããã
ç·¨éãã¡ã¤ã«ã¯ä¸è¨ãã¡ã¤ã«ã§ãã
- /node_modules/dynode/lib/dynode/request.js
ç·¨éç®æã¯13è¡ç®ã§ãã
var http = require("http"), _ = require("underscore"), signer = require('./request-signer'), AmazonError = require('./amazon-error'), URL = require('url'), STS = require('./sts').STS; var Request = exports.Request = function Request(config) { this.sts = new STS(config); this.config = _.defaults(config, { prefix : "DynamoDB_20111205.", host : "dynamodb.us-east-1.amazonaws.com"â(ç·¨éå) host : "dynamodb.ap-northeast-1.amazonaws.com"â(ç·¨éå¾) });
å®éã«DynamoDBã«ãã¼ãã«ãä½æãã¦ã¿ã¾ãããã
- vi zabbio.js
var dynode = require('dynode'); dynode.auth({accessKeyId: "***", secretAccessKey: "***"}); var opts = {read: 5, write: 5, hash: {wild: String}, range: {percentage: Number}}; dynode.createTable("zabbio", opts, console.log);
詳細ã«ã¤ãã¾ãã¦ã¯æ¬å®¶ã®readmeã«è¨è¼ããããã¾ãã
æ¬å®¶ã®ãµã¤ã
ããã§ã¯å®è¡ãã¦ã¿ã¾ãã
- node zabbio.js
å®è¡å¾ãä¸è¨ã®ã¡ãã»ã¼ã¸ãããã£ã¦ãã¾ããã
null { TableDescription: { CreationDateTime: ****, KeySchema: { HashKeyElement: [Object], RangeKeyElement: [Object] }, ProvisionedThroughput: { ReadCapacityUnits: 5, WriteCapacityUnits: 5 }, TableName: 'zabbio', TableStatus: 'CREATING' } }
Management Consoleãè¦ã¦ã¿ãã¨ã
確ãã«ã§ãã¦ãã¾ããã¼ã
node.js(SocketStream)ã触ãæ©ä¼ãå¤ããæ¬ã©ã¤ãã©ãªã使ç¨ãã¦ãã¾ãã
ãã¡ããã¡ã使ãåæè¯ãéå®ãã¦ãã¾ãã
次å(è¦æãããã°ï½)ã¯ä½æããnodejsã®å©ç¨ä¾ãªã©ç´¹ä»ã§ããã°ãããªã¨æãã¾ãã
ä»ã«ãããããã®ã©ã¤ãã©ãªãããããã§ãããã¡ãã®æ¹ãåããã¦ã確èªãã ããï¼
Amazon Web Services ããã°