{"id":1734,"date":"2021-08-22T11:55:35","date_gmt":"2021-08-22T02:55:35","guid":{"rendered":"https:\/\/dennie.tokyo\/it\/?p=1734"},"modified":"2022-04-03T15:55:45","modified_gmt":"2022-04-03T06:55:45","slug":"%e3%80%90dynamodb%e3%80%91aws-lambda-%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%9f-dynamodb-%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/dennie.tokyo\/it\/?p=1734","title":{"rendered":"\u3010DynamoDB\u3011AWS Lambda \u3092\u4f7f\u7528\u3057\u305f DynamoDB \u30c6\u30fc\u30d6\u30eb\u64cd\u4f5c"},"content":{"rendered":"\n<p>\u524d\u56de\u306fLambda\u95a2\u6570\u304b\u3089DynamoDB\u3078\u30a2\u30af\u30bb\u30b9\u3059\u308b\u6e96\u5099\u3092\u884c\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<div class=\"title_box\"><span class=\"box-title\">\u524d\u63d0<\/span>\n<p><a href=\"https:\/\/dennie.tokyo\/it\/?p=1730\" rel=\"noopener\" target=\"_blank\">\u3010DynamoDB\u3011AWS Lambda \u3092\u4f7f\u7528\u3057\u305f DynamoDB \u5b9f\u884c\u306e\u6e96\u5099<\/a><\/p>\n<\/div>\n\n\n\n<p>\u4eca\u56de\u306fLambda\u95a2\u6570\u304b\u3089DynamoDB\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210\u3001\u30c6\u30fc\u30d6\u30eb\u69cb\u6210\u306e\u78ba\u8a8d\u3001\u30c6\u30fc\u30d6\u30eb\u5909\u66f4\u3001\u30c6\u30fc\u30d6\u30eb\u4e00\u89a7\u306e\u53d6\u5f97\u3092\u884c\u3044\u307e\u3059\u3002<br>\u524d\u56de\u4f5c\u6210\u3057\u305f DynamoDbOperator \u30af\u30e9\u30b9\u306e exec \u30e1\u30bd\u30c3\u30c9\u306b\u51e6\u7406\u3092\u8a18\u8f09\u3059\u308b\u3053\u3068\u3068\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u5185\u5bb9<\/h2>\n\n\n\n<p>\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>const DynamoDbSetter = require(&quot;.\/DynamoDbSetter&quot;);\n\nmodule.exports = class DynamoDbOperator extends DynamoDbSetter{\n\n    async exec(event) {\n       \n        \/\/ \u5b9f\u884c\u5185\u5bb9\n        let params = {\n            TableName : &quot;Musics&quot;,\n            KeySchema: [       \n                { AttributeName: &quot;artist&quot;, KeyType: &quot;HASH&quot;},  \/\/Partition key\n                { AttributeName: &quot;title&quot;, KeyType: &quot;RANGE&quot; }  \/\/Sort key\n            ],\n            AttributeDefinitions: [       \n                { AttributeName: &quot;artist&quot;, AttributeType: &quot;S&quot; },\n                { AttributeName: &quot;title&quot;, AttributeType: &quot;S&quot; }\n            ],\n            ProvisionedThroughput: {       \n                ReadCapacityUnits: 10, \n                WriteCapacityUnits: 10\n            }\n        };\n  \n        \/\/ \u5b9f\u884c\n        return await this.dynamodb.createTable(params).promise();\n        \n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u8aac\u660e<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc<\/h3>\n\n\n\n<p>\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br>KeySchema \u3078\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br>KeyType: &#8220;HASH&#8221; \u306f\u30d1\u30fc\u30c6\u30b7\u30e7\u30f3\u30ad\u30fc\u3001KeyType: &#8220;RANGE&#8221; \u306f\u30bd\u30fc\u30c8\u30ad\u30fc\u3068\u306a\u308a\u307e\u3059\u3002<br>\u30bd\u30fc\u30c8\u30ad\u30fc\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3059\u304c\u3001\u30d1\u30fc\u30c6\u30b7\u30e7\u30f3\u30ad\u30fc\u306f\u5fc5\u9808\u3067\u3059\u3002<br>\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc\u3084\u30bd\u30fc\u30c8\u30ad\u30fc\u306e\u8aac\u660e\u306f\u4ee5\u4e0b\u3092\u53c2\u8003\u306b\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"title_box\"><span class=\"box-title\">\u53c2\u8003<\/span>\n<p><a href=\"https:\/\/dennie.tokyo\/it\/?p=1939\" rel=\"noopener\" target=\"_blank\">\u3010DynamoDB\u3011\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc<\/a><\/p>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u5c5e\u6027\u306e\u30bf\u30a4\u30d7<\/h3>\n\n\n\n<p>\u5c5e\u6027\u306e\u30bf\u30a4\u30d7\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br>AttributeDefinitions \u306b\u3066\u5c5e\u6027\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br>AttributeType &#8220;N&#8221; \u306f\u6570\u5024\u3001&#8221;S&#8221; \u306f\u6587\u5b57\u5217\u3001&#8221;B&#8221; \u306f\u30d0\u30a4\u30ca\u30ea\u306b\u306a\u308a\u307e\u3059\u3002<br>\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc\u306f\u4e0a\u8a183\u3064\u306e\u578b(\u30b9\u30ab\u30e9\u30fc\u578b)\u306e\u307f\u6307\u5b9a\u3067\u304d\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u4e0b\u3055\u3044\u3002<br>\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u6307\u5b9a\u3059\u308b\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc\u306b\u3064\u3044\u3066\u3082\u540c\u69d8\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30ad\u30e3\u30d1\u30b7\u30c6\u30a3\u30e2\u30fc\u30c9<\/h3>\n\n\n\n<p>\u30ad\u30e3\u30d1\u30b7\u30c6\u30a3\u30e2\u30fc\u30c9\u3092\u30d7\u30ed\u30d3\u30b8\u30e7\u30cb\u30f3\u30b0\u30e2\u30fc\u30c9\u3067\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u70ba\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br>\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u306f ProvisionedThroughput \u3078\u6307\u5b9a\u3057\u307e\u3059\u3002<br>\u30ad\u30e3\u30d1\u30b7\u30c6\u30a3\u30e2\u30fc\u30c9\u306e\u30d7\u30ed\u30d3\u30b8\u30e7\u30cb\u30f3\u30b0\u30e2\u30fc\u30c9\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u3092\u53c2\u7167\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"title_box\"><span class=\"box-title\">\u53c2\u8003<\/span>\n<p><a href=\"https:\/\/dennie.tokyo\/it\/?p=1650\" rel=\"noopener\" target=\"_blank\">\u3010DynamoDB\u3011\u30d7\u30ed\u30d3\u30b8\u30e7\u30cb\u30f3\u30b0\u30e2\u30fc\u30c9<\/a><\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n    &quot;TableDescription&quot;: {\n        &quot;AttributeDefinitions&quot;: [\n            {\n                &quot;AttributeName&quot;: &quot;artist&quot;,\n                &quot;AttributeType&quot;: &quot;S&quot;\n            },\n            {\n                &quot;AttributeName&quot;: &quot;title&quot;,\n                &quot;AttributeType&quot;: &quot;S&quot;\n            }\n        ],\n        &quot;TableName&quot;: &quot;Musics&quot;,\n        &quot;KeySchema&quot;: [\n            {\n                &quot;AttributeName&quot;: &quot;artist&quot;,\n                &quot;KeyType&quot;: &quot;HASH&quot;\n            },\n            {\n                &quot;AttributeName&quot;: &quot;title&quot;,\n                &quot;KeyType&quot;: &quot;RANGE&quot;\n            }\n        ],\n        &quot;TableStatus&quot;: &quot;CREATING&quot;,\n        &quot;CreationDateTime&quot;: &quot;2021-08-27T08:07:00.984Z&quot;,\n        &quot;ProvisionedThroughput&quot;: {\n            &quot;NumberOfDecreasesToday&quot;: 0,\n            &quot;ReadCapacityUnits&quot;: 10,\n            &quot;WriteCapacityUnits&quot;: 10\n        },\n        &quot;TableSizeBytes&quot;: 0,\n        &quot;ItemCount&quot;: 0,\n        &quot;TableArn&quot;: &quot;arn:aws:dynamodb:ap-northeast-1:XXXXXXXXX:table\/Musics&quot;,\n        &quot;TableId&quot;: &quot;43b2bf37-3a41-473d-8c60-b553a1e6334f&quot;\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<p>&#8220;TableStatus&#8221; \u304c &#8220;CREATING&#8221; \u306a\u306e\u3067\u3001DynamoDB\u306f\u30c6\u30fc\u30d6\u30eb\u306e\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3092\u5272\u308a\u5f53\u3066\u3066\u3044\u308b\u72b6\u614b\u3067\u3059\u3002<br>&#8220;ACTIVE&#8221; \u306b\u5909\u308f\u308b\u3068\u30c6\u30fc\u30d6\u30eb\u3078\u66f8\u304d\u8fbc\u307f\u3001\u8aad\u307f\u8fbc\u307f\u304c\u884c\u3048\u307e\u3059\u3002<br>\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u5272\u308a\u5f53\u3066\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u3092\u53c2\u7167\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"title_box\"><span class=\"box-title\">\u53c2\u8003<\/span>\n<p><a href=\"https:\/\/dennie.tokyo\/it\/?p=1605\" rel=\"noopener\" target=\"_blank\">\u3010DynamoDB\u3011\u30d1\u30fc\u30c6\u30b7\u30e7\u30f3<\/a><\/p>\n<\/div>\n\n\n\n<h1 class=\"wp-block-heading\">\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u4f5c\u6210<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u5185\u5bb9<\/h2>\n\n\n\n<p>\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\u6642\u306b\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002<br>\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u3001\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306e\u30d1\u30fc\u30c6\u30b7\u30e7\u30f3\u30ad\u30fc\u306f\u540c\u3058\u3067\u3001\u30bd\u30fc\u30c8\u30ad\u30fc\u306b\u5225\u306e\u5c5e\u6027\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<br>\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u3068\u306f\u9055\u3046\u30bd\u30fc\u30c8\u30ad\u30fc\u3092\u4f7f\u7528\u3057\u3066\u30c6\u30fc\u30d6\u30eb\u3092\u691c\u7d22\u3059\u308b\u969b\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<br>\u8a73\u7d30\u306f\u4ee5\u4e0b\u3092\u53c2\u7167\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"title_box\"><span class=\"box-title\">\u53c2\u8003<\/span>\n<p><a href=\"https:\/\/dennie.tokyo\/it\/?p=1902\" rel=\"noopener\" target=\"_blank\">\u3010DynamoDB\u3011\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9<\/a><\/p>\n<\/div>\n\n\n\n<p>\u4f5c\u6210\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>const DynamoDbSetter = require(&quot;.\/DynamoDbSetter&quot;);\n \nmodule.exports = class DynamoDbOperator extends DynamoDbSetter{\n \n    async exec(event) {\n \n        \/\/ \u5b9f\u884c\u5185\u5bb9\n        let params = {\n            TableName : &quot;weapon&quot;,\n            KeySchema: [       \n                { AttributeName: &quot;name&quot;, KeyType: &quot;HASH&quot;},  \/\/Partition key\n                { AttributeName: &quot;id&quot;, KeyType: &quot;RANGE&quot;}  \/\/Range key\n            ],\n            AttributeDefinitions: [       \n                { AttributeName: &quot;name&quot;, AttributeType: &quot;S&quot; },\n                { AttributeName: &quot;id&quot;, AttributeType: &quot;N&quot; },  \/\/Range key\n                { AttributeName: &quot;kind&quot;, AttributeType: &quot;N&quot; },\n            ],\n            ProvisionedThroughput: {       \n                ReadCapacityUnits: 10, \n                WriteCapacityUnits: 10\n            },\n            LocalSecondaryIndexes: [\n                {\n                    IndexName: &quot;weapon_kind_LSI&quot;, \n                    KeySchema: [\n                        { AttributeName: &quot;name&quot;, KeyType: &quot;HASH&quot;},  \/\/Partition key\n                        { AttributeName: &quot;kind&quot;, KeyType: &quot;RANGE&quot;}  \/\/Range key\n                    ],\n                    Projection: {\n                        ProjectionType: &quot;ALL&quot;,\n                    },\n                },\n            ],\n        };\n    \n        \/\/ \u5b9f\u884c\n        return await this.dynamodb.createTable(params).promise();\n \n    }\n}<\/code><\/pre><\/div>\n\n\n\n<p>\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u30d1\u30fc\u30c6\u30b7\u30e7\u30f3\u30ad\u30fc\u306b\u6307\u5b9a\u3067\u304d\u308b\u30c7\u30fc\u30bf\u30bf\u30a4\u30d7\u306f\u30b9\u30ab\u30e9\u30fc\u578b\u306e\u307f\u3067\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8aac\u660e<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306e\u8aac\u660e<\/h3>\n\n\n\n<p>\u6b66\u5668\u306e\u4e00\u89a7\u3092\u4fdd\u6301\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<br>\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30d1\u30fc\u30c6\u30b7\u30e7\u30f3\u30ad\u30fc\uff1aname<br>\u30bd\u30fc\u30c8\u30ad\u30fc\uff1aid<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u8aac\u660e<\/h3>\n\n\n\n<p>\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u30d7\u30e9\u30a4\u30de\u30ea\u30ad\u30fc\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30d1\u30fc\u30c6\u30b7\u30e7\u30f3\u30ad\u30fc\uff1aname<br>\u30bd\u30fc\u30c8\u30ad\u30fc\uff1akind<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306e\u5b9a\u7fa9<\/h3>\n\n\n\n<p>9\u884c\u76ee\u304b\u308922\u884c\u76ee\u304c\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306e\u5b9a\u7fa9\u306b\u306a\u308a\u307e\u3059\u3002<br>\u901a\u5e38\u306e\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\u3068\u5909\u308f\u308a\u3042\u308a\u307e\u305b\u3093\u304c\u3001\u4e88\u3081\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u30bd\u30fc\u30c8\u30ad\u30fc\u3092\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306b\u5b9a\u7fa9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br>\u5177\u4f53\u7684\u306b\u306f14\u884c\u76ee\u306eAttributeDefinitions\u306b\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u30bd\u30fc\u30c8\u30ad\u30fc\u3067\u3042\u308b kind \u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u5b9a\u7fa9<\/h3>\n\n\n\n<p>23\u884c\u76ee\u306eLocalSecondaryIndexes\u4ee5\u4e0b\u304c\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u5b9a\u7fa9\u5185\u5bb9\u306b\u306a\u308a\u307e\u3059\u3002<br>\u4eca\u56de\u306fProjectionType\u306b\u306f &#8220;ALL&#8221; \u3092\u6307\u5b9a\u3057\u307e\u3057\u305f\u3002&#8221;ALL&#8221; \u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306e\u5168\u3066\u306e\u5c5e\u6027\u304c\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u4f7f\u7528\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<br>\u5fc5\u8981\u306a\u5c5e\u6027\u306e\u307f\u6307\u5b9a\u3057\u305f\u3044\u5834\u5408\u306f\u3001&#8221;INCLUDE&#8221; \u3092\u6307\u5b9a\u3057\u3001\u5fc5\u8981\u306a\u5c5e\u6027\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">DynamoDb\u306e\u5b9f\u884c\u30e1\u30bd\u30c3\u30c9<\/h3>\n\n\n\n<p>\u30ed\u30fc\u30ab\u30eb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210\u3068\u540c\u6642\u306b\u4f5c\u6210\u3059\u308b\u70ba\u3001createTable\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n    &quot;TableDescription&quot;: {\n        &quot;AttributeDefinitions&quot;: [\n            {\n                &quot;AttributeName&quot;: &quot;id&quot;,\n                &quot;AttributeType&quot;: &quot;N&quot;\n            },\n            {\n                &quot;AttributeName&quot;: &quot;kind&quot;,\n                &quot;AttributeType&quot;: &quot;N&quot;\n            },\n            {\n                &quot;AttributeName&quot;: &quot;name&quot;,\n                &quot;AttributeType&quot;: &quot;S&quot;\n            }\n        ],\n        &quot;TableName&quot;: &quot;weapon&quot;,\n        &quot;KeySchema&quot;: [\n            {\n                &quot;AttributeName&quot;: &quot;name&quot;,\n                &quot;KeyType&quot;: &quot;HASH&quot;\n            },\n            {\n                &quot;AttributeName&quot;: &quot;id&quot;,\n                &quot;KeyType&quot;: &quot;RANGE&quot;\n            }\n        ],\n        &quot;TableStatus&quot;: &quot;CREATING&quot;,\n        &quot;CreationDateTime&quot;: &quot;2021-10-20T10:43:13.259Z&quot;,\n        &quot;ProvisionedThroughput&quot;: {\n            &quot;NumberOfDecreasesToday&quot;: 0,\n            &quot;ReadCapacityUnits&quot;: 10,\n            &quot;WriteCapacityUnits&quot;: 10\n        },\n        &quot;TableSizeBytes&quot;: 0,\n        &quot;ItemCount&quot;: 0,\n        &quot;TableArn&quot;: &quot;arn:aws:dynamodb:ap-northeast-1:081461195071:table\/weapon&quot;,\n        &quot;TableId&quot;: &quot;21b7ecf4-f2fc-422e-a06c-2f38db3d6b2a&quot;,\n        &quot;LocalSecondaryIndexes&quot;: [\n            {\n                &quot;IndexName&quot;: &quot;weapon_kind_LSI&quot;,\n                &quot;KeySchema&quot;: [\n                    {\n                        &quot;AttributeName&quot;: &quot;name&quot;,\n                        &quot;KeyType&quot;: &quot;HASH&quot;\n                    },\n                    {\n                        &quot;AttributeName&quot;: &quot;kind&quot;,\n                        &quot;KeyType&quot;: &quot;RANGE&quot;\n                    }\n                ],\n                &quot;Projection&quot;: {\n                    &quot;ProjectionType&quot;: &quot;ALL&quot;\n                },\n                &quot;IndexSizeBytes&quot;: 0,\n                &quot;ItemCount&quot;: 0,\n                &quot;IndexArn&quot;: &quot;arn:aws:dynamodb:ap-northeast-1:081461195071:table\/weapon\/index\/weapon_kind_LSI&quot;\n            }\n        ]\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\">\u30c6\u30fc\u30d6\u30eb\u69cb\u6210\u306e\u78ba\u8a8d<\/h1>\n\n\n\n<p>\u5148\u307b\u3069\u4f5c\u6210\u3057\u305f\u30c6\u30fc\u30d6\u30eb\u306e\u69cb\u6210\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<br>describeTable \u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5185\u5bb9<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>const DynamoDbSetter = require(&quot;.\/DynamoDbSetter&quot;);\n \nmodule.exports = class DynamoDbOperator extends DynamoDbSetter{\n \n    async exec(event) {\n \n        \/\/ \u5b9f\u884c\u5185\u5bb9\n        let params = {\n            TableName : &quot;Musics&quot;,\n        };\n    \n        \/\/ \u5b9f\u884c\n        return await this.dynamodb.describeTable(params).promise();\n \n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n    &quot;Table&quot;: {\n        &quot;AttributeDefinitions&quot;: [\n            {\n                &quot;AttributeName&quot;: &quot;artist&quot;,\n                &quot;AttributeType&quot;: &quot;S&quot;\n            },\n            {\n                &quot;AttributeName&quot;: &quot;title&quot;,\n                &quot;AttributeType&quot;: &quot;S&quot;\n            }\n        ],\n        &quot;TableName&quot;: &quot;Musics&quot;,\n        &quot;KeySchema&quot;: [\n            {\n                &quot;AttributeName&quot;: &quot;artist&quot;,\n                &quot;KeyType&quot;: &quot;HASH&quot;\n            },\n            {\n                &quot;AttributeName&quot;: &quot;title&quot;,\n                &quot;KeyType&quot;: &quot;RANGE&quot;\n            }\n        ],\n        &quot;TableStatus&quot;: &quot;ACTIVE&quot;,\n        &quot;CreationDateTime&quot;: &quot;2021-08-27T08:07:00.984Z&quot;,\n        &quot;ProvisionedThroughput&quot;: {\n            &quot;NumberOfDecreasesToday&quot;: 0,\n            &quot;ReadCapacityUnits&quot;: 10,\n            &quot;WriteCapacityUnits&quot;: 10\n        },\n        &quot;TableSizeBytes&quot;: 0,\n        &quot;ItemCount&quot;: 0,\n        &quot;TableArn&quot;: &quot;arn:aws:dynamodb:ap-northeast-1:XXXXXXXXXX:table\/Musics&quot;,\n        &quot;TableId&quot;: &quot;43b2bf37-3a41-473d-8c60-b553a1e6334f&quot;\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\">\u30c6\u30fc\u30d6\u30eb\u66f4\u65b0<\/h1>\n\n\n\n<p>\u30c6\u30fc\u30d6\u30eb\u306e\u66f4\u65b0\u306b\u306f updateTable \u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br>\u30c6\u30fc\u30d6\u30eb\u66f4\u65b0\u304c\u884c\u3048\u308b\u64cd\u4f5c\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30fb\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u306e\u5909\u66f4<br>\u30fb\u30ad\u30e3\u30d1\u30b7\u30c6\u30a3\u30e2\u30fc\u30c9\u306e\u5909\u66f4<br>\u30fbDynamoDB Streams \u6709\u52b9\/\u7121\u52b9 \u306e\u5909\u66f4<br>\u30fb\u30bb\u30ab\u30f3\u30c0\u30ea\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e\u64cd\u4f5c<\/p>\n\n\n\n<p>\u4eca\u56de\u306f\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u306e\u5909\u66f4\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5185\u5bb9<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>const DynamoDbSetter = require(&quot;.\/DynamoDbSetter&quot;);\n \nmodule.exports = class DynamoDbOperator extends DynamoDbSetter{\n \n    async exec(event) {\n \n        \/\/ \u5b9f\u884c\u5185\u5bb9\n        let params = {\n            TableName : &quot;Musics&quot;,\n            ProvisionedThroughput: {       \n                ReadCapacityUnits: 5, \n                WriteCapacityUnits: 5\n            }\n        };\n    \n        \/\/ \u5b9f\u884c\n        return await this.dynamodb.updateTable(params).promise();\n \n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n    &quot;TableDescription&quot;: {\n        &quot;AttributeDefinitions&quot;: [\n            {\n                &quot;AttributeName&quot;: &quot;artist&quot;,\n                &quot;AttributeType&quot;: &quot;S&quot;\n            },\n            {\n                &quot;AttributeName&quot;: &quot;title&quot;,\n                &quot;AttributeType&quot;: &quot;S&quot;\n            }\n        ],\n        &quot;TableName&quot;: &quot;Musics&quot;,\n        &quot;KeySchema&quot;: [\n            {\n                &quot;AttributeName&quot;: &quot;artist&quot;,\n                &quot;KeyType&quot;: &quot;HASH&quot;\n            },\n            {\n                &quot;AttributeName&quot;: &quot;title&quot;,\n                &quot;KeyType&quot;: &quot;RANGE&quot;\n            }\n        ],\n        &quot;TableStatus&quot;: &quot;UPDATING&quot;,\n        &quot;CreationDateTime&quot;: &quot;2021-08-27T08:07:00.984Z&quot;,\n        &quot;ProvisionedThroughput&quot;: {\n            &quot;LastDecreaseDateTime&quot;: &quot;2021-08-27T08:19:03.845Z&quot;,\n            &quot;NumberOfDecreasesToday&quot;: 0,\n            &quot;ReadCapacityUnits&quot;: 10,\n            &quot;WriteCapacityUnits&quot;: 10\n        },\n        &quot;TableSizeBytes&quot;: 0,\n        &quot;ItemCount&quot;: 0,\n        &quot;TableArn&quot;: &quot;arn:aws:dynamodb:ap-northeast-1:XXXXXXXXX:table\/Musics&quot;,\n        &quot;TableId&quot;: &quot;43b2bf37-3a41-473d-8c60-b553a1e6334f&quot;\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<p>\u66f4\u65b0\u524d\u306e\u60c5\u5831\u304c\u8fd4\u5374\u3055\u308c\u308b\u3088\u3046\u3067\u3059\u3002\u66f4\u65b0\u524d\u306e\u30b9\u30eb\u30fc\u30d7\u30c3\u30c8\u304c\u8fd4\u5374\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u30c6\u30fc\u30d6\u30eb\u4e00\u89a7\u306e\u53d6\u5f97<\/h1>\n\n\n\n<p>\u30c6\u30fc\u30d6\u30eb\u4e00\u89a7\u306e\u53d6\u5f97\u306f listTables \u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5185\u5bb9<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>const DynamoDbSetter = require(&quot;.\/DynamoDbSetter&quot;);\n\nmodule.exports = class DynamoDbOperator extends DynamoDbSetter{\n\n    async exec(event) {\n    \n        \/\/ \u5b9f\u884c\n        return await this.dynamodb.listTables().promise();\n\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9f\u884c\u7d50\u679c<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>{\n    &quot;TableNames&quot;: [\n        &quot;Musics&quot;\n    ]\n}<\/code><\/pre><\/div>\n\n\n\n<h1 class=\"wp-block-heading\">\u6700\u5f8c\u306b<\/h1>\n\n\n\n<p>\u6b21\u56de\u306f\u30c6\u30fc\u30d6\u30eb\u3078\u9805\u76ee\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"title_box\"><span class=\"box-title\">\u6b21\u56de<\/span>\n<p><a href=\"https:\/\/dennie.tokyo\/it\/?p=1769\" rel=\"noopener\" target=\"_blank\">\u3010DynamoDB\u3011AWS SDK \u3092\u4f7f\u7528\u3057\u305f\u9805\u76ee\u306e\u8ffd\u52a0<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306fLambda\u95a2\u6570\u304b\u3089DynamoDB\u3078\u30a2\u30af\u30bb\u30b9\u3059\u308b\u6e96\u5099\u3092\u884c\u3044\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":1258,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,20],"tags":[],"class_list":["post-1734","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws","category-lambda"],"_links":{"self":[{"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/posts\/1734","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1734"}],"version-history":[{"count":51,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/posts\/1734\/revisions"}],"predecessor-version":[{"id":3416,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/posts\/1734\/revisions\/3416"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=\/wp\/v2\/media\/1258"}],"wp:attachment":[{"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dennie.tokyo\/it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}