{"id":5043,"date":"2014-12-12T10:00:47","date_gmt":"2014-12-12T01:00:47","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=5043"},"modified":"2018-11-14T16:33:50","modified_gmt":"2018-11-14T07:33:50","slug":"amazon-dynamodb-local-and-aws-sdk-for-java-1","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2014\/12\/12\/amazon-dynamodb-local-and-aws-sdk-for-java-1\/","title":{"rendered":"Amazon DynamoDB Local &#038; AWS SDK for Java \u3092\u4f7f\u3063\u3066\u307f\u3088\u3046\uff08\u524d\u7de8\uff09"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u677e\u672c\u3067\u3059\u3002<br \/>\n<a title=\"TECHSCORE Advent Calendar 2014\" href=\"http:\/\/www.techscore.com\/blog\/2014\/11\/27\/techscore-advent-calendar-2014\/\">TECHSCORE Advent Calendar 2014<\/a> \u306e 12 \u65e5\u76ee\u306e\u6295\u7a3f\u3067\u3059\u3002<\/p>\n<p>\u672c\u30a8\u30f3\u30c8\u30ea\u30fc\u3067\u306f\u7121\u6599\u306e Amazon DynamoDB Local \u3092\u4f7f\u3063\u3066\u3001AWS SDK for Java \u306b\u7528\u610f\u3055\u308c\u3066\u3044\u308b AmazonDynamoDBv2 API \u3092\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>Amazon DynamoDB Local \u3063\u3066\uff1f<\/h2>\n<p>DynamoDB Local \u306f DynamoDB API \u3068\u4e92\u63db\u6027\u3092\u6301\u3064\u5c0f\u578b\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u3001DynamoDB \u30b5\u30fc\u30d3\u30b9\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u5411\u3051\u306b Amazon \u304b\u3089\u7121\u6599\u3067\u63d0\u4f9b\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u4e2d\u8eab\u306f SQLite \u3084 Jetty \u3092\u4f7f\u3063\u3066\u5b9f\u73fe\u3055\u308c\u3066\u304a\u308a\u3001\u305d\u306e\u540d\u306e\u901a\u308a\u30ed\u30fc\u30ab\u30eb\u7aef\u672b\u3067\u52d5\u4f5c\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u304c\u7279\u5fb4\u3067\u3059\u3002<\/p>\n<p><a title=\"DynamoDB Local\" href=\"http:\/\/docs.aws.amazon.com\/amazondynamodb\/latest\/developerguide\/Tools.DynamoDBLocal.html\" target=\"_blank\">DynamoDB Local<\/a><\/p>\n<blockquote style=\"font-style: italic;\"><p>DynamoDB Local is compatible with the DynamoDB API. When you are ready to deploy your application, you simply redirect it to DynamoDB, without having to modify your application code. In addition, you do not need to have an Internet connection to use DynamoDB Local. You can develop applications without having to be connected to the network.<\/p><\/blockquote>\n<p>DynamoDB Local \u306f\u3001<a title=\"Downloading and Running DynamoDB Local\" href=\"http:\/\/docs.aws.amazon.com\/amazondynamodb\/latest\/developerguide\/Tools.DynamoDBLocal.html#Tools.DynamoDBLocal.DownloadingAndRunning\" target=\"_blank\">AWS \u306e\u30b5\u30a4\u30c8<\/a>\u304b\u3089 <a title=\"dynamodb_local_latest.zip\" href=\"http:\/\/dynamodb-local.s3-website-us-west-2.amazonaws.com\/dynamodb_local_latest.zip\" target=\"_blank\">JAR \u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a>\u3057\u3066\u5b9f\u884c\u3059\u308b\u3060\u3051\u3067\u5229\u7528\u3067\u304d\u307e\u3059\u304c\u3001\u4eca\u65e5\u306f eclipse \u304b\u3089\u5229\u7528\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u66f8\u3044\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>DynamoDB Local \u3092 eclipse \u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306e\u306f\u7c21\u5358\u3067\u3001AWS Toolkit \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u304f\u3064\u304b\u624b\u9806\u3092\u8e0f\u3080\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u5c1a\u3001\u672c\u8a18\u4e8b\u306f\u6b21\u306e\u74b0\u5883\u3067\u52d5\u4f5c\u78ba\u8a8d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>Eclipse Luna (4.4.1) Release for Windows 64 Bit<\/li>\n<li>JRE 1.8.0_20<\/li>\n<li>Java \u30b3\u30f3\u30d1\u30a4\u30e9\u30fc\u6e96\u62e0\u30ec\u30d9\u30eb 1.8<\/li>\n<\/ul>\n<p>\u203bDynamoDB Local \u306f JRE 6.x \u4ee5\u4e0a\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p><a title=\"Downloading and Running DynamoDB Local\" href=\"http:\/\/docs.aws.amazon.com\/amazondynamodb\/latest\/developerguide\/Tools.DynamoDBLocal.html#Tools.DynamoDBLocal.DownloadingAndRunning\" target=\"_blank\">Downloading and Running DynamoDB Local<\/a><\/p>\n<blockquote style=\"font-style: italic;\"><p>Important<br \/>\nDynamoDB Local supports the Java Runtime Engine (JRE) version 6.x or newer; it will not run on older JRE versions.<\/p><\/blockquote>\n<h3>1. AWS Toolkit for Eclipse \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>eclipse \u4e0a\u3067 Help &gt; Eclipse Marketplace... \u3092\u30af\u30ea\u30c3\u30af\u3057\u3066 Eclipse Marketplace \u3092\u958b\u304d\u3001AWS Toolkit for Eclipse 2.0 \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002\u300cAWS Toolkit for Eclipse\u300d\u3092\u30ad\u30fc\u30ef\u30fc\u30c9\u306b\u3057\u3066\u691c\u7d22\u3059\u308c\u3070\u3059\u3050\u306b\u898b\u3064\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u30a6\u30a3\u30b6\u30fc\u30c9\u4e2d\u306e Confirm Selected Features \u3067\u306f\u3001Amazon DynamoDB Management \u3068Amazon EC2 Management \u3092\u9078\u629e\u3057\u3066\u4e0b\u3055\u3044\u3002Amazon EC2 Management \u306f\u4f9d\u5b58\u95a2\u4fc2\u4e0a\u3001\u5fc5\u8981\u306a\u306e\u3067\u3059\u3002<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5b8c\u4e86\u5f8c\u3001eclipse \u306e\u518d\u8d77\u52d5\u304c\u6c42\u3081\u3089\u308c\u308b\u306e\u3067\u5b9f\u65bd\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<h3>2. AWS \u30a2\u30ab\u30a6\u30f3\u30c8\u8a8d\u8a3c\u60c5\u5831\u306e\u5165\u529b<\/h3>\n<p>eclipse \u306e\u518d\u8d77\u52d5\u304c\u5b8c\u4e86\u3059\u308b\u3068 AWS account credentials \u306e\u5165\u529b\u304c\u6c42\u3081\u3089\u308c\u307e\u3059\u3002DynamoDB Local \u3092\u4f7f\u3046\u3060\u3051\u306a\u3089\u5b9f\u969b\u306e AWS \u30a2\u30ab\u30a6\u30f3\u30c8\u8a8d\u8a3c\u60c5\u5831\u3092\u5165\u529b\u3059\u308b\u5fc5\u8981\u306f\u306a\u3044\u306e\u3067\u3001\u9069\u5f53\u306a\u60c5\u5831\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u3053\u3067\u8a2d\u5b9a\u3057\u305f\u30a2\u30af\u30bb\u30b9\u30ad\u30fcID\u3084\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u306f\u3001SDK \u304b\u3089 DynamoDB Local \u3092\u64cd\u4f5c\u3059\u308b\u5834\u5408\u306b\u3082\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_aws_account_credentials.png\" rel=\"facebox\" rel=\"attachment wp-att-5135\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-5135\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_aws_account_credentials-300x269.png\" alt=\"dynamodb_aws_account_credentials\" width=\"300\" height=\"269\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_aws_account_credentials-300x269.png 300w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_aws_account_credentials.png 476w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3>3. Amazon DynamoDB Local \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>Window &gt; Preferences \u304b\u3089 AWS Toolkit \u306e DynamoDB Local Test Tool \u753b\u9762\u3092\u958b\u304f\u3068\u3001Version \u30ea\u30b9\u30c8\u306e\u4e2d\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u53ef\u80fd\u306a DynamoDB Loacal \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u9069\u5f53\u306a\u3082\u306e\u3092\u9078\u629e\uff08\u7279\u306b\u5236\u7d04\u304c\u7121\u3044\u306a\u3089\u6700\u65b0\u306e\u65e5\u4ed8\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u9078\u3079\u3070\u826f\u3044\u3067\u3059\uff09\u3057\u3066 Install \u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p>\u3053\u308c\u3067 DynamoDB Local \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h2>\u305d\u3057\u3066\u8d77\u52d5\uff01<\/h2>\n<p>DynamoDB Local \u306e\u8d77\u52d5\u306f AWS Explorer \u304b\u3089\u884c\u3044\u307e\u3059\u3002<\/p>\n<h3>1. AWS Explorer \u3092\u958b\u304f<\/h3>\n<p>eclipse \u4e0a\u3067 AWS Explorer \u304c\u958b\u3044\u3066\u3044\u306a\u3051\u308c\u3070\u3001Window &gt; Show View &gt; Other... \u304b\u3089 Show View \u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u958b\u3044\u3066 AWS Toolkit \u5185\u306e AWS Explorer \u304b\u3089\u958b\u3044\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<h3>2. \u30ea\u30fc\u30b8\u30e7\u30f3\u3092 Local \u306b<\/h3>\n<p>AWS Explorer \u4e0a\u3067\u30ea\u30fc\u30b8\u30e7\u30f3\u3092 Local (localhost) \u306b\u8a2d\u5b9a\u3002<\/p>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_region.png\" rel=\"facebox\" rel=\"attachment wp-att-5094\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-5094\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_region-300x166.png\" alt=\"dynamodb_region\" width=\"300\" height=\"166\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_region-300x166.png 300w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_region.png 775w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3>3. \u30b0\u30ed\u30fc\u30d0\u30eb\u30b3\u30f3\u30d5\u30a3\u30ae\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3<\/h3>\n<p>AWS Explorer \u4e0a\u3067 Global Configuration \u304c\u306a\u3044\u3068\u6012\u3089\u308c\u305f\u5834\u5408\u306f\u3001Window &gt; Preferences \u306e AWS Toolkit \u4e0a\u3067 Global Configuration \u306b\u9069\u5f53\u306a\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u4e0b\u3055\u3044\u3002\u5165\u529b\u3059\u308b AWS \u30a2\u30ab\u30a6\u30f3\u30c8\u8a8d\u8a3c\u60c5\u5831\u306f\u9069\u5f53\u306a\u3082\u306e\u3067\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_global-configuration.png\" rel=\"facebox\" rel=\"attachment wp-att-5085\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-5085\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_global-configuration-300x189.png\" alt=\"dynamodb_global-configuration\" width=\"300\" height=\"189\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_global-configuration-300x189.png 300w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_global-configuration.png 893w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u3053\u308c\u3067 AWS Explorer \u306e\u8b66\u544a\u304c\u6d88\u3048\u3001DynamoDB Local \u304c\u5229\u7528\u53ef\u80fd\u306a\u72b6\u614b\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>4. DynamoDB Local \u306e\u8d77\u52d5<\/h3>\n<p>AWS Explorer \u4e0a\u3067 Amazon DynamoDB \u3092\u53f3\u30af\u30ea\u30c3\u30af\u3057 Start DynamoDB Local \u3092\u30af\u30ea\u30c3\u30af\u3002<br \/>\n\u8d77\u52d5\u3059\u308b DynamoDB Local \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u805e\u3044\u3066\u304f\u308b\u306e\u3067\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:shell decode:true \">2014-12-09 11:38:01.615:INFO:oejs.Server:jetty-8.1.12.v20130726\r\n2014-12-09 11:38:01.739:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8000\r\n<\/pre>\n<p>\u3053\u308c\u3067\u8d77\u52d5\u5b8c\u4e86\u3002\u30b3\u30f3\u30bd\u30fc\u30eb\u3078\u306e\u51fa\u529b\u304b\u3089\u3001DynamoDB Local \u304c Jetty \u304c\u52d5\u3044\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u306d\uff08\u72b6\u6cc1\u306b\u3088\u3063\u3066\u3001SQLite \u306e\u30ed\u30b0\u3082\u51fa\u529b\u3055\u308c\u307e\u3059\uff09\u3002<\/p>\n<p>\u3055\u3042\u3001\u7d9a\u3044\u3066 SDK \u7d4c\u7531\u3067 DynamoDB Local \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u6e96\u5099\u3092\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>AWS SDK for Java \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>\u4eca\u56de\u306f maven \u3067\u69cb\u7bc9\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<h3>1. maven \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u4f5c\u6210<\/h3>\n<p>eclipse \u306e File &gt; New &gt; Project... \u304b\u3089 Maven &gt; Maven Project \u3092\u9078\u3073\u3001simple project \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002groupId \u3068 artifactId \u306f\u9069\u5f53\u306b\u5165\u529b\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<h3>2. pom.xml \u3092\u7de8\u96c6<\/h3>\n<p><code>dependencies<\/code> \u306b AWS SDK for Java \u3092\u8ffd\u52a0\u3059\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<pre class=\"lang:xml decode:true\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n  &lt;groupId&gt;com.techscore&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;dynamodb-local-sample&lt;\/artifactId&gt;\r\n  &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n\r\n  &lt;dependencies&gt;\r\n\r\n    &lt;dependency&gt;\r\n      &lt;groupId&gt;com.amazonaws&lt;\/groupId&gt;\r\n      &lt;artifactId&gt;aws-java-sdk&lt;\/artifactId&gt;\r\n      &lt;version&gt;1.9.9&lt;\/version&gt;\r\n    &lt;\/dependency&gt;\r\n\r\n  &lt;\/dependencies&gt;\r\n\r\n&lt;\/project&gt;\r\n<\/pre>\n<p>\u3057\u3070\u3089\u304f\u5f85\u3066\u3070 AWS SDK for Java \u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u3067\u74b0\u5883\u69cb\u7bc9\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h2>\u3067\u306f\u5b9f\u969b\u306b AWS SDK for Java \u7d4c\u7531\u3067\u30a2\u30a4\u30c6\u30e0\u3092\u4fdd\u5b58\u3057\u3066\u307f\u3088\u3046<\/h2>\n<p>\u4e3b\u306b <code>com.amazonaws.services.dynamodbv2<\/code> \u4ee5\u4e0b\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5229\u7528\u3057\u307e\u3059\u3002\u53e4\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306e SDK \u3067\u306f <code>com.amazonaws.services.dynamodb<\/code> \u7cfb\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3082\u5b58\u5728\u3059\u308b\u306e\u3067\u9593\u9055\u3048\u306a\u3044\u3088\u3046\u6ce8\u610f\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<h3>1. \u6e96\u5099<\/h3>\n<p>\u307e\u305a\u306f <code>AmazonDynamoDBClient<\/code> \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u751f\u6210\u304b\u3089\u3002<\/p>\n<pre class=\"lang:java decode:true\">AWSCredentials credentials = new BasicAWSCredentials(\"yourAccessKeyId\", \"yourSecretAccessKey\");\r\nAmazonDynamoDBClient client = new AmazonDynamoDBClient(credentials);\r\nclient.setEndpoint(\"http:\/\/localhost:8000\", \"\", \"local\");\r\n<\/pre>\n<p>DynamoDB Local \u3092\u4f7f\u3046\u4e0a\u3067\u306e\u30dd\u30a4\u30f3\u30c8\u306f <code>AmazonDynamoDBClient<\/code> \u4e0a\u3067\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u5909\u3048\u308b\u3053\u3068\u3068\u3001\u30ea\u30fc\u30b8\u30e7\u30f3ID\u3092\u30bb\u30c3\u30c8\u3059\u308b\u4e8b\u3067\u3059\u3002<code>setEndpoint()<\/code> \u306e\u4e8c\u3064\u76ee\u306e\u5f15\u6570\u3067\u3042\u308b\u300c\u30b5\u30fc\u30d3\u30b9\u540d\u300d\u306f\u7121\u8996\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a title=\"AmazonDynamoDBClient#setEndpoint\" href=\"http:\/\/docs.aws.amazon.com\/AWSJavaSDK\/latest\/javadoc\/com\/amazonaws\/services\/dynamodbv2\/AmazonDynamoDBClient.html#setEndpoint(java.lang.String,%20java.lang.String,%20java.lang.String)\" target=\"_blank\">AmazonDynamoDBClient#setEndpoint()<\/a><\/p>\n<blockquote style=\"font-style: italic;\"><p><code>endpoint<\/code> - The endpoint (ex: \"dynamodb.us-east-1.amazonaws.com\/\") or a full URL, including the protocol (ex: \"http:\/\/dynamodb.us-east-1.amazonaws.com\/\") of the region specific AWS endpoint this client will communicate with.<br \/>\n<code>serviceName<\/code> - This parameter is ignored.<br \/>\n<code>regionId<\/code> - The ID of the region in which this service resides AND the overriding region for signing purposes.<\/p><\/blockquote>\n<p><code>BasicAWSCredentials<\/code> \u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306b\u306f\u3001AWS \u30a2\u30ab\u30a6\u30f3\u30c8\u8a8d\u8a3c\u60c5\u5831\u3068\u3057\u3066 eclipse \u4e0a\u3067\u8a2d\u5b9a\u3057\u305f\u30a2\u30af\u30bb\u30b9\u30ad\u30fcID\u3068\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u3092\u5f15\u6570\u3068\u3057\u3066\u6e21\u3057\u307e\u3059\u3002\u4eca\u56de\u306f <code>AWSCredentials<\/code> \u306e\u751f\u6210\u3092\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066\u308f\u304b\u308a\u3084\u3059\u3044 <code>BasicAWSCredentials<\/code> \uff08<a title=\"BasicAWSCredentials\" href=\"http:\/\/docs.aws.amazon.com\/AWSJavaSDK\/latest\/javadoc\/com\/amazonaws\/auth\/BasicAWSCredentials.html\" target=\"_blank\">javadoc<\/a>\uff09\u3067\u884c\u3044\u307e\u3057\u305f\u304c\u3001\u5b9f\u969b\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306f\u6b21\u306e\u3088\u3046\u306b <code>ClasspathPropertiesFileCredentialsProvider<\/code> \uff08<a title=\"ClasspathPropertiesFileCredentialsProvider\" href=\"http:\/\/docs.aws.amazon.com\/AWSJavaSDK\/latest\/javadoc\/com\/amazonaws\/auth\/ClasspathPropertiesFileCredentialsProvider.html\" target=\"_blank\">javadoc<\/a>\uff09\u3092\u4f7f\u3046\u3053\u3068\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:java decode:true\">AWSCredentials credentials = new ClasspathPropertiesFileCredentialsProvider().getCredentials();\r\n<\/pre>\n<p>\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u30af\u30e9\u30b9\u30d1\u30b9\u4e0a\u306e AwsCredentials.properties \u30d5\u30a1\u30a4\u30eb\u3092\u53c2\u7167\u3057\u3066\u304f\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>2. \u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210<\/h3>\n<p>AWS Explorer \u3092\u4f7f\u3063\u3066\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>AWS Explorer \u306e Amazon DynamoDB \u30a2\u30a4\u30b3\u30f3\u4e0a\u3067\u53f3\u30af\u30ea\u30c3\u30af\u3057\u3001Create Table \u3092\u9078\u3093\u3067\u4e0b\u3055\u3044\u3002Create New DynamoDB Table \u3068\u3044\u3046\u753b\u9762\u304c\u958b\u304f\u306e\u3067\u3001\u4e0b\u8a18\u3092\u53c2\u8003\u306b\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\u3092\u884c\u3063\u3066\u4e0b\u3055\u3044\u3002\u30b5\u30f3\u30d7\u30eb\u3067\u306f\u30c1\u30e3\u30c3\u30c8\u30a2\u30d7\u30ea\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u3092\u8868\u3059\u30c6\u30fc\u30d6\u30eb\u3092\u60f3\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_channels-table.png\" rel=\"facebox\" rel=\"attachment wp-att-5081\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-5081\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_channels-table-300x230.png\" alt=\"dynamodb_channels-table\" width=\"300\" height=\"230\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_channels-table-300x230.png 300w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_channels-table.png 963w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Table Name \u3068 Hash Key Name\u3001Hash Key Type \u306b\u5fc5\u8981\u306a\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30b5\u30f3\u30d7\u30eb\u3067\u306f\u30ec\u30f3\u30b8\u30ad\u30fc\u3092\u4f7f\u7528\u3057\u306a\u3044\u306e\u3067\u3001Enable Range Key \u306f\u30aa\u30d5\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>Table Throughput \u3068\u3044\u3046\u9805\u76ee\u306f\u3001DynamoDB Local \u3067\u306f\u7121\u8996\u3055\u308c\u308b\u306e\u3067\u4eca\u56de\u306f\u9069\u5f53\u306a\u5024\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u3044\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<p><a title=\"Differences Between DynamoDB Local and DynamoDB\" href=\"http:\/\/docs.aws.amazon.com\/amazondynamodb\/latest\/developerguide\/Tools.DynamoDBLocal.html#Tools.DynamoDBLocal.Differences\" target=\"_blank\">Differences Between DynamoDB Local and DynamoDB<\/a><\/p>\n<blockquote style=\"font-style: italic;\"><p>DynamoDB Local ignores provisioned throughput settings, even though the API requires them. For CreateTable, you can specify any numbers you want for provisioned read and write throughput, even though these numbers will not be used. You can call UpdateTable as many times as you like per day; however, any changes to provisioned throughput values are ignored.<\/p><\/blockquote>\n<h3>3. \u30a2\u30a4\u30c6\u30e0\u306e\u4fdd\u5b58<\/h3>\n<p>\u6b21\u306b\u5b9f\u969b\u306e\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<pre class=\"lang:java decode:true\">PutItemRequest request = new PutItemRequest()\r\n        .withTableName(\"Channels\")\r\n        .addItemEntry(\"channelName\", new AttributeValue(\"techscore\"))\r\n        .addItemEntry(\"maxMessageNumber\", new AttributeValue().withN(\"0\"))\r\n        .addItemEntry(\"createdAt\", new AttributeValue(OffsetDateTime.now().toString()))\r\n        .addItemEntry(\"updatedAt\", new AttributeValue(OffsetDateTime.now().toString()));\r\nclient.putItem(request);\r\n<\/pre>\n<p>\u3053\u3053\u3067\u306f <code>PutItemRequest<\/code> \u3092\u4f7f\u3063\u3066 Channels \u30c6\u30fc\u30d6\u30eb\u306b\u30a2\u30a4\u30c6\u30e0\u3092\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30c6\u30fc\u30d6\u30eb\u540d\u306e\u6307\u5b9a\u3092 <code>withTableName()<\/code> \u30e1\u30bd\u30c3\u30c9\u3067\u3001\u5c5e\u6027\u5024\u306e\u30bb\u30c3\u30c8\u3092 <code>addItemEntry()<\/code> \u3067\u884c\u3063\u3066\u3044\u307e\u3059\u3002<code>withXxx()<\/code> \u3084 <code>addXxx()<\/code> \u7cfb\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u623b\u308a\u5024\u306b <code>PutItemRequest<\/code> \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u81ea\u8eab\u3092\u8fd4\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u3001\u5c5e\u6027\u5024\u306e\u8a2d\u5b9a\u7b49\u3092\u30e1\u30bd\u30c3\u30c9\u30c1\u30a7\u30fc\u30f3\u3067\u3064\u306a\u3050\u3053\u3068\u304c\u3067\u304d\u3001\u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027\u3092\u4e0a\u3052\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><code>AttributeValue<\/code> \u306f\u5c5e\u6027\u5024\u3092\u8868\u3059\u30af\u30e9\u30b9\u3067\u3001\u30c7\u30fc\u30bf\u578b\u304c Number \u306a\u3089 <code>withN()<\/code> \u3084 <code>setN()<\/code>\u3001\u6587\u5b57\u5217\u578b\u306a\u3089 <code>withS()<\/code> \u3084 <code>setS()<\/code> \u3068\u3044\u3046\u3088\u3046\u306b\u3001\u30c7\u30fc\u30bf\u578b\u306b\u5fdc\u3058\u305f\u30e1\u30bd\u30c3\u30c9\u3067\u5024\u306e\u683c\u7d0d\uff08\u3084\u53d6\u5f97\uff09\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>\u5168\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u63b2\u8f09\u3057\u307e\u3059\u3002<\/p>\n<p><a name=\"ChannelCreationLowLevelAPI.java\">com\/techscore\/dynamodb_local_sample\/ChannelCreationLowLevelAPI.java<\/a><\/p>\n<pre class=\"lang:java decode:true\">package com.techscore.dynamodb_local_sample;\r\n\r\nimport java.time.OffsetDateTime;\r\nimport com.amazonaws.auth.AWSCredentials;\r\nimport com.amazonaws.auth.BasicAWSCredentials;\r\nimport com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;\r\nimport com.amazonaws.services.dynamodbv2.model.AttributeValue;\r\nimport com.amazonaws.services.dynamodbv2.model.ExpectedAttributeValue;\r\nimport com.amazonaws.services.dynamodbv2.model.PutItemRequest;\r\n\r\npublic class ChannelCreationLowLevelAPI {\r\n\r\n    public static void main(String[] args) {\r\n        AWSCredentials credentials = new BasicAWSCredentials(\"yourAccessKeyId\", \"yourSecretAccessKey\");\r\n        AmazonDynamoDBClient client = new AmazonDynamoDBClient(credentials);\r\n        client.setEndpoint(\"http:\/\/localhost:8000\", \"\", \"local\");\r\n\r\n        PutItemRequest request = new PutItemRequest()\r\n                .withTableName(\"Channels\")\r\n                .addItemEntry(\"channelName\", new AttributeValue(\"techscore\"))\r\n                .addItemEntry(\"maxMessageNumber\", new AttributeValue().withN(\"0\"))\r\n                .addItemEntry(\"createdAt\", new AttributeValue(OffsetDateTime.now().toString()))\r\n                .addItemEntry(\"updatedAt\", new AttributeValue(OffsetDateTime.now().toString()));\r\n        client.putItem(request);\r\n    }\r\n}\r\n<\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067 Channels \u30c6\u30fc\u30d6\u30eb\u306b <code>\"techscore\"<\/code> \u3068\u3044\u3046 channelName \u5c5e\u6027\u5024\u3092\u6301\u3064\u30a2\u30a4\u30c6\u30e0\u304c\u65b0\u898f\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002\u7d50\u679c\u306f AWS Explorer \u4e0a\u3067 Channels \u30c6\u30fc\u30d6\u30eb\u306e Query Editor \u3092\u958b\u304f\u3053\u3068\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_query-editor.png\" rel=\"facebox\" rel=\"attachment wp-att-5090\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-5090\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_query-editor-300x163.png\" alt=\"dynamodb_query-editor\" width=\"300\" height=\"163\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_query-editor-300x163.png 300w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2014\/12\/dynamodb_query-editor.png 854w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>\u6b21\u56de\u306f<\/h2>\n<p>\u300c\u524d\u7de8\u300d\u3068\u984c\u3057\u305f\u4eca\u56de\u306f\u4e3b\u306b Amazon DynamoDB Local \u306e\u5229\u7528\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002\u3082\u3046\u5c11\u3057\u66f8\u304d\u305f\u3044\u3053\u3068\u3082\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u9577\u304f\u306a\u3063\u3066\u304d\u305f\u306e\u3067\u4eca\u56de\u306f\u3053\u3053\u3067\u3044\u3063\u305f\u3093\u7d42\u4e86\u3057\u307e\u3059\u3002<\/p>\n<p>\u6b21\u56de\u300c\u5f8c\u7de8\u300d\u3067\u306f AWS SDK for Java \u306b\u3088\u308b\u4f4e\u30ec\u30d9\u30eb API \u304a\u3088\u3073\u9ad8\u30ec\u30d9\u30eb API \u306b\u89e6\u308c\u3064\u3064\u3001DynamoDB \u306e Atomic Counters \u3068 Conditional Writes \u3092\u8a66\u3059\u4e88\u5b9a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u677e\u672c\u3067\u3059\u3002<br \/>\nTECHSCORE Advent Calendar 2014 \u306e 12 \u65e5\u76ee\u306e\u6295\u7a3f\u3067\u3059\u3002<br \/><a href=\"https:\/\/www.techscore.com\/blog\/2014\/12\/12\/amazon-dynamodb-local-and-aws-sdk-for-java-1\/\">\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[141,119,57],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/5043"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=5043"}],"version-history":[{"count":93,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/5043\/revisions"}],"predecessor-version":[{"id":5524,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/5043\/revisions\/5524"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=5043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=5043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=5043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}