{"id":16636766,"url":"https://github.com/takamin/aws-node-util","last_synced_at":"2025-10-09T17:36:04.786Z","repository":{"id":4255164,"uuid":"52521793","full_name":"takamin/aws-node-util","owner":"takamin","description":"SQL-ish statement classes to manipurate DynamoDB","archived":false,"fork":false,"pushed_at":"2022-12-30T18:45:54.000Z","size":1412,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-12T22:27:06.581Z","etag":null,"topics":["aws","cli","npm","utility"],"latest_commit_sha":null,"homepage":"http://takamints.hatenablog.jp/entry/operating-the-dynamodb-by-SQL-ish-language","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takamin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-25T12:10:33.000Z","updated_at":"2022-02-23T01:14:08.000Z","dependencies_parsed_at":"2023-01-13T13:02:13.684Z","dependency_job_id":null,"html_url":"https://github.com/takamin/aws-node-util","commit_stats":null,"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/takamin/aws-node-util","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takamin%2Faws-node-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takamin%2Faws-node-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takamin%2Faws-node-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takamin%2Faws-node-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takamin","download_url":"https://codeload.github.com/takamin/aws-node-util/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takamin%2Faws-node-util/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271073387,"owners_count":24694538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cli","npm","utility"],"created_at":"2024-10-12T06:22:46.680Z","updated_at":"2025-10-09T17:35:59.766Z","avatar_url":"https://github.com/takamin.png","language":"JavaScript","readme":"AWS-Node-Util\n=============\n\n[![Build Status](https://travis-ci.org/takamin/aws-node-util.svg?branch=master)](https://travis-ci.org/takamin/aws-node-util)\n\nDESCRIPTION\n-----------\n\nThis module provides __SQL-ish statement classes to manipulate DynamoDB__.\n\nThe latest [API reference](https://takamin.github.io/aws-node-util/apis/index.html) is available.\n\nStatement classes:\n\n1. ScanStatement\n2. QueryStatement\n3. PutItemStatement `(*1)`\n4. DeleteItemStatement `(*1)`\n\n`(*1)` - Currently, These cannot be parameterized. So the prepared execution is unavailable.\n\nAnd also provides CLI commands that manipulate AWS services.\nSome of these are depending on AWS CLI or shell script.\n\nSQL-ish feature\n---------------\n\nSee the sample code below to use the SQL-ish classes.\n\n### Sample of SQL-ish statements\n\n__sample/sqlish-sample.js__\n\nTo run this sample, a DynamoDB table named 'stars' is required.\n\nOn that table,\nthe attribute named 'mainStar' is a HASH-key typed as String and\n'orbitOrder' is a RANGE-key typed as number.\n\n\n```javascript\n\"use strict\";\nconst awsNodeUtil = require(\"aws-node-util\");\nconst ScanStatement = awsNodeUtil.dynamodb.ScanStatement;\nconst QueryStatement = awsNodeUtil.dynamodb.QueryStatement;\nconst ResultSet = awsNodeUtil.dynamodb.ResultSet;\n\n// Connect (change each value for your account)\nawsNodeUtil.connect(\n//    { accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2' }\n);\n\n// Prepare a scanning-all-statement without parameters.\nvar scanAllStatement = new ScanStatement(\"FROM stars\");\n\n// Prepare 'Scan' statement to filter by name.\n// The name is parameterized.\nvar scanByNameStatement = new ScanStatement(\n        \"FROM stars WHERE name=:name\");\n\n// Prepare 'Query' statement to get children of specific main star.\n// The name of a main star is parameterized.\nvar queryChildrenStatement = new QueryStatement(\n        \"SELECT mainStar, orbitOrder, name \" +\n        \"FROM stars \" +\n        \"WHERE mainStar=:mainStar\");\n\n// Set DynamoDB API interface to each statementa\nconst dynamodbApi = awsNodeUtil.getService(\"DynamoDB\");\nscanAllStatement.dynamodb = dynamodbApi;\nscanByNameStatement.dynamodb = dynamodbApi;\nqueryChildrenStatement.dynamodb = dynamodbApi;\n\n// Run the statements\nscanAllStatement.run({}, (err, resp) =\u003e {\n    console.log(\"-----------------------\");\n    console.log(\"SCAN all items of stars\");\n    console.log(\"-----------------------\");\n    printResult(err, resp);\n    scanByNameStatement.run({ \":name\": \"EARTH\" }, (err, resp) =\u003e {\n        console.log(\"--------------\");\n        console.log(\"SCAN the EARTH\");\n        console.log(\"--------------\");\n        printResult(err, resp);\n\n        queryChildrenStatement.run({ \":mainStar\": \"EARTH\" }, (err, resp) =\u003e {\n            console.log(\"------------------------------\");\n            console.log(\"QUERY child stars of the EARTH\");\n            console.log(\"------------------------------\");\n            printResult(err, resp);\n        });\n    });\n});\n\n// Handler to print result of scan / query\nfunction printResult(err, result) {\n    if(err) {\n        console.error(\"Error:\", err.stack);\n    } else {\n        ResultSet.printScanResult(result);\n    }\n}\n```\n\n__outputs__\n\n```bash\n$ node sample/sqlish-sample.js\n-----------------------\nSCAN all items of stars\n-----------------------\nCount: 10\nROWNUM diameter rotation role      mass      gravity density escapeVelocity name    orbitOrder mainStar\n     1     3475    655.7 satellite    0.0073     1.6    3340            2.4 MOON             1 EARTH\n     2     4879   1407.6 planet       0.33       3.7    5427            4.3 MERCURY          1 SUN\n     3    12104  -5832.0 planet       4.87       8.9    5243           10.4 VENUS            2 SUN\n     4    12756     23.9 planet       5.97       9.8    5514           11.2 EARTH            3 SUN\n     5     6792     24.6 planet       0.642      3.7    3933            5.0 MARS             4 SUN\n     6   142984      9.9 planet    1898.0       23.1    1326           59.5 JUPITER          5 SUN\n     7   120536     10.7 planet     568.0        9.0     687           35.5 SATURN           6 SUN\n     8    51118    -17.2 planet      86.8        8.7    1271           21.3 URANUS           7 SUN\n     9    49528     16.1 planet     102.0       11.0    1638           23.5 NEPTUNE          8 SUN\n    10     2370   -153.3 planet       0.0146     0.7    2095            1.3 PLUTO            9 SUN\nScannedCount: 10\n--------------\nSCAN the EARTH\n--------------\nCount: 10\nROWNUM diameter rotation role   mass gravity density escapeVelocity name  orbitOrder mainStar\n     1    12756     23.9 planet 5.97     9.8    5514           11.2 EARTH          3 SUN\nScannedCount: 10\n------------------------------\nQUERY child stars of the EARTH\n------------------------------\nCount: 1\nROWNUM name orbitOrder mainStar\n     1 MOON          1 EARTH\nScannedCount: 1\n\n```\n\nScan / QueryStatement run and next method\n-----------------------------------------\n\nIf the `LIMIT` feature is used for the Scan or QueryStatement,\nIn the callback specified for `run()` method,\nthe `next()` method is available to get followed items.\n\nHere is sample codes.\n\n__sample/scan-next-sample.js__\n\n```JavaScript\n\"use strict\";\nconst awsNodeUtil = require(\"aws-node-util\");\nconst ScanStatement = awsNodeUtil.dynamodb.ScanStatement;\nconst ResultSet = awsNodeUtil.dynamodb.ResultSet;\n\n// Connect (change each value for your account)\nawsNodeUtil.connect(\n//    { accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2' }\n);\n\n// Prepare 'Scan' statement\nvar scanStatement = new ScanStatement(\n        \"FROM stars LIMIT 3\");\nscanStatement.dynamodb = awsNodeUtil.getService(\"DynamoDB\");\n\nscanStatement.run({}, (err, data) =\u003e {\n    if(err) {\n        console.error(\"Error: \", err.message);\n    } else if(data) {\n        ResultSet.printScanResult(data);\n        scanStatement.next();\n    } else if(data == null) {\n        console.error(\"OK\");\n    }\n});\n```\n\n__output__\n\n```sh\n$ node sample/scan-next-sample.js\nCount: 3\nROWNUM diameter rotation role      mass   gravity density escapeVelocity name    orbitOrder mainStar\n     1     3475    655.7 satellite 0.0073     1.6    3340            2.4 MOON             1 EARTH\n     2     4879   1407.6 planet    0.33       3.7    5427            4.3 MERCURY          1 SUN\n     3    12104  -5832.0 planet    4.87       8.9    5243           10.4 VENUS            2 SUN\nLastEvaluatedKey: {\"orbitOrder\":{\"N\":\"2\"},\"mainStar\":{\"S\":\"SUN\"}}\nScannedCount: 3\nCount: 3\nROWNUM diameter rotation role   mass     gravity density escapeVelocity name    orbitOrder mainStar\n     1    12756     23.9 planet    5.97      9.8    5514           11.2 EARTH            3 SUN\n     2     6792     24.6 planet    0.642     3.7    3933            5.0 MARS             4 SUN\n     3   142984      9.9 planet 1898.0      23.1    1326           59.5 JUPITER          5 SUN\nLastEvaluatedKey: {\"orbitOrder\":{\"N\":\"5\"},\"mainStar\":{\"S\":\"SUN\"}}\nScannedCount: 3\nCount: 3\nROWNUM diameter rotation role   mass  gravity density escapeVelocity name    orbitOrder mainStar\n     1   120536     10.7 planet 568.0     9.0     687           35.5 SATURN           6 SUN\n     2    51118    -17.2 planet  86.8     8.7    1271           21.3 URANUS           7 SUN\n     3    49528     16.1 planet 102.0    11.0    1638           23.5 NEPTUNE          8 SUN\nLastEvaluatedKey: {\"orbitOrder\":{\"N\":\"8\"},\"mainStar\":{\"S\":\"SUN\"}}\nScannedCount: 3\nCount: 1\nROWNUM diameter rotation role   mass   gravity density escapeVelocity name  orbitOrder mainStar\n     1     2370   -153.3 planet 0.0146     0.7    2095            1.3 PLUTO          9 SUN\nScannedCount: 1\nOK\n```\n\n__sample/query-next-sample.js__\n\n```JavaScript\n\"use strict\";\nconst awsNodeUtil = require(\"aws-node-util\");\nconst QueryStatement = awsNodeUtil.dynamodb.QueryStatement;\nconst ResultSet = awsNodeUtil.dynamodb.ResultSet;\n\n// Connect (change each value for your account)\nawsNodeUtil.connect(\n//    { accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2' }\n);\n\n// Prepare 'Query' statement\nvar queryStatement = new QueryStatement(\n        \"FROM stars WHERE mainStar=:ms LIMIT 2\");\nqueryStatement.dynamodb = awsNodeUtil.getService(\"DynamoDB\");\n\nqueryStatement.run({\":ms\": \"SUN\" }, (err, data) =\u003e {\n    if(err) {\n        console.error(\"Error: \", err.message);\n    } else if(data) {\n        ResultSet.printScanResult(data);\n        queryStatement.next();\n    } else if(data == null) {\n        console.error(\"OK\");\n    }\n});\n```\n\n__output__\n\n```sh\n$ node sample/query-next-sample.js\nCount: 2\nROWNUM diameter rotation role   mass gravity density escapeVelocity name    orbitOrder mainStar\n     1     4879   1407.6 planet 0.33     3.7    5427            4.3 MERCURY          1 SUN\n     2    12104  -5832.0 planet 4.87     8.9    5243           10.4 VENUS            2 SUN\nLastEvaluatedKey: {\"orbitOrder\":{\"N\":\"2\"},\"mainStar\":{\"S\":\"SUN\"}}\nScannedCount: 2\nCount: 2\nROWNUM diameter rotation role   mass  gravity density escapeVelocity name orbitOrder mainStar\n     1    12756     23.9 planet 5.97      9.8    5514           11.2 EARTH         3 SUN\n     2     6792     24.6 planet 0.642     3.7    3933            5.0 MARS          4 SUN\nLastEvaluatedKey: {\"orbitOrder\":{\"N\":\"4\"},\"mainStar\":{\"S\":\"SUN\"}}\nScannedCount: 2\nCount: 2\nROWNUM diameter rotation role   mass gravity density escapeVelocity name    orbitOrder mainStar\n     1   142984      9.9 planet 1898    23.1    1326           59.5 JUPITER          5 SUN\n     2   120536     10.7 planet  568     9.0     687           35.5 SATURN           6 SUN\nLastEvaluatedKey: {\"orbitOrder\":{\"N\":\"6\"},\"mainStar\":{\"S\":\"SUN\"}}\nScannedCount: 2\nCount: 2\nROWNUM diameter rotation role   mass  gravity density escapeVelocity name    orbitOrder mainStar\n     1    51118    -17.2 planet  86.8     8.7    1271           21.3 URANUS           7 SUN\n     2    49528     16.1 planet 102.0    11.0    1638           23.5 NEPTUNE          8 SUN\nLastEvaluatedKey: {\"orbitOrder\":{\"N\":\"8\"},\"mainStar\":{\"S\":\"SUN\"}}\nScannedCount: 2\nCount: 1\nROWNUM diameter rotation role   mass   gravity density escapeVelocity name  orbitOrder mainStar\n     1     2370   -153.3 planet 0.0146     0.7    2095            1.3 PLUTO          9 SUN\nScannedCount: 1\nOK\n```\n\n__sample/put-and-delete-item.js__\n\n```javascript\n\"use strict\";\nconst awsNodeUtil = require(\"aws-node-util\");\nconst QueryStatement = awsNodeUtil.dynamodb.QueryStatement;\nconst PutItemStatement = awsNodeUtil.dynamodb.PutItemStatement;\nconst DeleteItemStatement = awsNodeUtil.dynamodb.DeleteItemStatement;\nconst ResultSet = awsNodeUtil.dynamodb.ResultSet;\n\n// Connect (change each value for your account)\nawsNodeUtil.connect(\n//    { accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2' }\n);\nconst dynamodbApi = awsNodeUtil.getService(\"DynamoDB\");\n\n// Handler to print result of scan / query\nfunction printResult(result) {\n    ResultSet.printScanResult(result);\n}\n\n// Prepare 'PutItem' statement\nvar putItemStatement = new PutItemStatement(\n    [\"INSERT INTO stars (\",\n        \"mainStar, role, orbitOrder, name\",\n    \") VALUES (\",\n        \"'SUN', 'planet', 10, 'X'\",\n    \")\"].join(\" \"));\nputItemStatement.dynamodb = dynamodbApi;\n\n// Add planet X\nputStar(putItemStatement, {}).then( () =\u003e {\n\n    // Add planet Y\n    putItemStatement.setValues([\n        \"SUN\", \"planet\", 25, \"Y\"\n    ]);\n    return putStar( putItemStatement, {});\n\n}).then( () =\u003e {\n\n    // Add planet Z\n    return putStar( putItemStatement, {\n        orbitOrder:35, name:\"Z\"\n    });// mainStar and role is not changed from previous.\n\n}).then( () =\u003e {\n    return queryStar(\"mainStar, orbitOrder, name, role\", \"mainStar = 'SUN'\");\n}).then(resp =\u003e {\n    console.log(\"----------------------------\");\n    console.log(\"QUERY child stars of the SUN\");\n    console.log(\"----------------------------\");\n    printResult(resp);\n}).then( () =\u003e {\n\n    //Delete planets named X, Y and Z.\n    return deleteWhere( \"mainStar = 'SUN' AND orbitOrder \u003e= 10\" );\n\n}).then( () =\u003e {\n    return queryStar(\"mainStar, orbitOrder, name, role\", \"mainStar = 'SUN'\");\n}).then(resp =\u003e {\n    console.log(\"----------------------------\");\n    console.log(\"QUERY child stars of the SUN\");\n    console.log(\"----------------------------\");\n    printResult(resp);\n}).catch( err =\u003e {\n    console.error(\"Error:\", err.stack);\n});\n\nfunction deleteWhere(condition) {\n    return queryStar( \"mainStar, orbitOrder\", condition ).then(result =\u003e {\n        let resultSet = new ResultSet(result);\n        return Promise.all(resultSet.getItems().map(item =\u003e {\n            return deleteStar([\n                \"mainStar = '\" + item.mainStar + \"'\",\n                \"AND orbitOrder = \" + item.orbitOrder\n            ].join(\" \"));\n        }));\n    });\n}\n\nfunction putStar(statement, args) {\n    return new Promise( (resolve, reject) =\u003e {\n        statement.run(args, err =\u003e {\n            if(err) {\n                reject(err);\n            } else {\n                resolve();\n            }\n        });\n    });\n}\n\nfunction queryStar(select, condition) {\n    return new Promise( (resolve, reject) =\u003e {\n        const statement = new QueryStatement([\n            \"SELECT\", select, \"FROM stars\",\n            \"WHERE\", condition\n        ].join(\" \"));\n        statement.dynamodb = dynamodbApi;\n        statement.run({}, (err, result) =\u003e {\n            if(err) {\n                reject(err);\n            } else {\n                resolve(result);\n            }\n        });\n    });\n}\n\nfunction deleteStar(condition) {\n    return new Promise( (resolve, reject) =\u003e {\n        console.log(\"DELETE\", condition);\n        const statement = new DeleteItemStatement([\n            \"DELETE FROM stars WHERE\",\n            condition\n        ].join(\" \"));\n        statement.dynamodb = dynamodbApi;\n        statement.run({}, (err) =\u003e {\n            if(err) {\n                reject(err);\n            } else {\n                resolve();\n            }\n        })\n    });\n}\n```\n\n__outputs__\n\n```sh\n$ node sample/put-and-delete-item.js\n----------------------------\nQUERY child stars of the SUN\n----------------------------\nCount: 12\nROWNUM role   name    orbitOrder mainStar\n     1 planet MERCURY          1 SUN\n     2 planet VENUS            2 SUN\n     3 planet EARTH            3 SUN\n     4 planet MARS             4 SUN\n     5 planet JUPITER          5 SUN\n     6 planet SATURN           6 SUN\n     7 planet URANUS           7 SUN\n     8 planet NEPTUNE          8 SUN\n     9 planet PLUTO            9 SUN\n    10 planet X               10 SUN\n    11 planet Y               25 SUN\n    12 planet Z               35 SUN\nScannedCount: 12\nDELETE mainStar = 'SUN' AND orbitOrder = 10\nDELETE mainStar = 'SUN' AND orbitOrder = 25\nDELETE mainStar = 'SUN' AND orbitOrder = 35\n----------------------------\nQUERY child stars of the SUN\n----------------------------\nCount: 9\nROWNUM role   name    orbitOrder mainStar\n     1 planet MERCURY          1 SUN\n     2 planet VENUS            2 SUN\n     3 planet EARTH            3 SUN\n     4 planet MARS             4 SUN\n     5 planet JUPITER          5 SUN\n     6 planet SATURN           6 SUN\n     7 planet URANUS           7 SUN\n     8 planet NEPTUNE          8 SUN\n     9 planet PLUTO            9 SUN\nScannedCount: 9\n\n```\n\nCLI-Commands for Amazon Dynamo\n------------------------------\n\n1. __aws-dynamodb-delete-item__ - delete item on the table\n1. __aws-dynamodb-put-item__ - put item to the table\n1. __aws-dynamodb-query__ - query and display items in the table\n1. __aws-dynamodb-scan__ - scan and display items in the table\n1. __aws-dynamodb-create-table__ - create table with a json file. the file desc2create output can use.\n1. __aws-dynamodb-delete-table__ - delete the table\n1. __aws-dynamodb-desc2create__ - Convert a JSON to create the table from its description\n1. __aws-dynamodb-describe-table__ - describe the table\n1. __aws-dynamodb-list-tables__ - display the table names\n\nThese commands are designed to recognize the keywords\nin the expressions and to generate placeholders automatically.\n\n### 1. aws-dynamodb-delete-item\n\nDelete -- delete the item from the table.\n\n```bash\n$ aws-dynamodb-delete-item `\u003ctable-name\u003e` `\u003citem-expression\u003e`\n```\n\n__Parameters__\n\n|Parameter          |Content                         |\n|:------------------|:-------------------------------|\n| table-name        | Target table name              |\n| key               | Item to delete from the table  |\n\n* __key__ is a comma separated string representing\nkey attribute names and values\nlike `\u003cattr-name1\u003e = \u003cvalue\u003e, \u003cattr-name2\u003e = \u003cvalue\u003e, ...`.\n* All the keys must be included\n* The value type will be determined automatically from its notation.\n\n### 2. aws-dynamodb-put-item\n\nPut -- insert or update the item to the table from command line.\n\n```bash\n$ aws-dynamodb-put-item `\u003ctable-name\u003e` `\u003citem-expression\u003e` ...\n```\n\n__Parameters__\n\n|Parameter          |Content                     |\n|:------------------|:---------------------------|\n| table-name        | Target table name          |\n| item-expression   | Items to put to the table  |\n\n* __item-expression__ is comma separated strings representing\nattribute names and values\nlike `\u003cattr-name1\u003e = \u003cvalue\u003e, \u003cattr-name2\u003e = \u003cvalue\u003e, ...`.\n* All the keys must be included to specify whether the items\nwill be inserted or updated.\n* The attribute name can be `path.to.the.item` (See the example below).\n* The value type will be determined automatically from its notation.\n\n__Example__\n\nComamnd line:\n\n```bash\n$ aws-dynamodb-put-item testTable '\n    id=\"123\",\n    timestamp=145678900,\n    test.name=\"foo\",\n    test.pass=true,\n    value.version=\"0.6.6\"\n'\n```\n\nThen Item to be added to the table:\n\n```javascript\n{\n    \"id\":       {\"S\": \"123\"},\n    \"timestamp\":{\"N\": \"145678900\"},\n    \"test\": {\n        \"M\": {\n            \"name\": {\"S\": \"foo\"},\n            \"pass\": {\"BOOL\": true}\n        }\n    },\n    \"value\" : {\"M\" : {\"version\": {\"S\": \"0.6.6\"}}}\n}\n```\n\n__Available Types Assumed In Automatic__\n\n| value        | type       |\n|:------------:|:-----------|\n| true / false | boolean    |\n| \"ABC\" / '123'| string     |\n| 123.4        | number     |\n\n\n### 3. aws-dynamodb-query\n\nQuery -- This reports the retrieved data that matches key-conditions given\nfrom command-line without consideration about the placeholder.\n\n```bash\nUsage:\n1) aws-dynamodb-query [OPTIONS] \u003ctableName\u003e \u003ckeyConditionExpression\u003e\n2) aws-dynamodb-query [OPTIONS] -q \u003cSQL-ish-statement\u003e\n\n  -c, --max-items=ARG                 The total number of items to return\n  -n, --starting-token=ARG            A token to specify where to start\n                                      paginating\n  -s, --sort-item=ARG                 JSON path to the sort item\n  -p, --projection-expression=ARG     comma separated attribute names to\n                                      project\n  -k, --key-condition-expression=ARG  key condition expression of query\n  -f, --filter-expression=ARG         filter expression applied after\n                                      query\n  -d, --desc                          Sorting direction to descendent\n  -j, --output-json                   output a json to read\n  -J, --output-json-oneline           output a json in oneline\n  -t, --dry-run                       Print options of the query and exit\n  -q, --sql-ish                       Query by SQL-ish-statement(beta)\n  -h, --help                          display this help\n\nPARAMETERS:\n\n  tableName              The table name defined in DynamoDB.\n  keyConditionExpression KeyConditionExpression for the DynamoDB table.\n  SQL-ish-statement      SQL-ish text that represents a query\n\n  1) In all expression parameter, option value or SQL-ish,the field names\n  could be represented as is for its declared name in the table without\n  considering the placeh older of AWS DynamoDB.\n\n  2) Here is an examples showing a syntax for SQL-ish-statement of query.\n\n    [ SELECT \u003cprojection-expression\u003e ]\n    FROM \u003ctableName\u003e\n    WHERE \u003ckeyConditionExpression\u003e\n    [ FILTER \u003cfilter-expression\u003e ]\n    [ LIMIT \u003cmax-items\u003e ]\n\n  This says the FROM and WHERE clauses are mandatory and the SELECT,\n  FILTER and LIMIT are optional.\n\n```\n\n__EXAMPLE__\n\n```bash\n$ aws-dynamodb-query stars \\\n\u003e \"mainStar='SUN' AND orbitOrder BETWEEN 1 AND 9\" \\\n\u003e --projection-expression \"name, mass, diameter\" \\\n\u003e --sort-item orbitOrder\nCount: 9\nROWNUM diameter mass      name\n     1     4879    0.33   MERCURY\n     2    12104    4.87   VENUS\n     3    12756    5.97   EARTH\n     4     6792    0.642  MARS\n     5   142984 1898.0    JUPITER\n     6   120536  568.0    SATURN\n     7    51118   86.8    URANUS\n     8    49528  102.0    NEPTUNE\n     9     2370    0.0146 PLUTO\nScannedCount: 9\n```\n\nSQL-ish statement:\n\n```bash\n$ aws-dynamodb-query -q \"SELECT name, mass, diameter \\\n\u003e FROM stars \\\n\u003e WHERE mainStar='SUN' AND orbitOrder BETWEEN 1 AND 9\" \\\n\u003e --sort-item orbitOrder\nCount: 9\nROWNUM diameter mass      name\n     1     4879    0.33   MERCURY\n     2    12104    4.87   VENUS\n     3    12756    5.97   EARTH\n     4     6792    0.642  MARS\n     5   142984 1898.0    JUPITER\n     6   120536  568.0    SATURN\n     7    51118   86.8    URANUS\n     8    49528  102.0    NEPTUNE\n     9     2370    0.0146 PLUTO\nScannedCount: 9\n```\n\n### 4. aws-dynamodb-scan\n\n```bash\nUsage:\n1) aws-dynamodb-scan [OPTIONS] \u003ctableName\u003e\n2) aws-dynamodb-scan [OPTIONS] -q \u003cSQL-ish-statement\u003e\n\n  -c, --max-items=ARG              The total number of items to return\n  -n, --starting-token=ARG         A token to specify where to start\n                                   paginating\n  -s, --sort-item=ARG              JSON path to the sort item\n  -p, --projection-expression=ARG  comma separated attribute names to\n                                   project\n  -f, --filter-expression=ARG      filter expression\n  -d, --desc                       Sorting direction to descendent\n  -j, --output-json                output a json to read\n  -J, --output-json-oneline        output a json in oneline\n  -t, --dry-run                    Print options of the scan and exit\n  -q, --sql-ish                    Query by SQL-ish-statement(beta)\n  -h, --help                       display this help\n\nPARAMETERS:\n\n  tableName              The table name defined in DynamoDB.\n  SQL-ish-statement      SQL-ish text that represents a scan\n\n  1) In all expression parameter, option value or SQL-ish,the field names\n  could be represented as is for its declared name in the table without\n  considering the placeh older of AWS DynamoDB.\n\n  2) Here is an examples showing a syntax for SQL-ish-statement of scan.\n\n    [ SELECT \u003cprojection-expression\u003e ]\n    FROM \u003ctableName\u003e\n    [ WHERE \u003cfilter-expression\u003e ]\n    [ LIMIT \u003cmax-items\u003e ]\n\n  This says the FROM clauses is mandatory and the SELECT, WHERE and LIMIT\n  are optional.\n```\n\n__EXAMPLE__\n\nComamnd line:\n\n```bash\n\n$ aws-dynamodb-scan stars\nCount: 10\nROWNUM diameter rotation role      mass      gravity density escapeVelocity name    orbitOrder mainStar\n     1     3475    655.7 satellite    0.0073     1.6    3340            2.4 MOON             1 EARTH\n     2     4879   1407.6 planet       0.33       3.7    5427            4.3 MERCURY          1 SUN\n     3    12104  -5832.0 planet       4.87       8.9    5243           10.4 VENUS            2 SUN\n     4    12756     23.9 planet       5.97       9.8    5514           11.2 EARTH            3 SUN\n     5     6792     24.6 planet       0.642      3.7    3933            5.0 MARS             4 SUN\n     6   142984      9.9 planet    1898.0       23.1    1326           59.5 JUPITER          5 SUN\n     7   120536     10.7 planet     568.0        9.0     687           35.5 SATURN           6 SUN\n     8    51118    -17.2 planet      86.8        8.7    1271           21.3 URANUS           7 SUN\n     9    49528     16.1 planet     102.0       11.0    1638           23.5 NEPTUNE          8 SUN\n    10     2370   -153.3 planet       0.0146     0.7    2095            1.3 PLUTO            9 SUN\nScannedCount: 10\n\n```\n\nSQL-ish statement:\n\n```bash\n\n$ aws-dynamodb-scan -q \"FROM stars\"\nCount: 10\nROWNUM diameter rotation role      mass      gravity density escapeVelocity name    orbitOrder mainStar\n     1     3475    655.7 satellite    0.0073     1.6    3340            2.4 MOON             1 EARTH\n     2     4879   1407.6 planet       0.33       3.7    5427            4.3 MERCURY          1 SUN\n     3    12104  -5832.0 planet       4.87       8.9    5243           10.4 VENUS            2 SUN\n     4    12756     23.9 planet       5.97       9.8    5514           11.2 EARTH            3 SUN\n     5     6792     24.6 planet       0.642      3.7    3933            5.0 MARS             4 SUN\n     6   142984      9.9 planet    1898.0       23.1    1326           59.5 JUPITER          5 SUN\n     7   120536     10.7 planet     568.0        9.0     687           35.5 SATURN           6 SUN\n     8    51118    -17.2 planet      86.8        8.7    1271           21.3 URANUS           7 SUN\n     9    49528     16.1 planet     102.0       11.0    1638           23.5 NEPTUNE          8 SUN\n    10     2370   -153.3 planet       0.0146     0.7    2095            1.3 PLUTO            9 SUN\nScannedCount: 10\n\n```\n\n### Don't Worry The Placeholders\n\nFor the expressions of dynamodb query and scan commands,\nYou can write the attribute names or its values directly.\nBecause,\n__the placeholders are recognized and created in automatic__ by the commands\nSo, you don't need to worry about it.\n\n----\n\nCLI-commands for AWS Lambda\n---------------------------\n\n1. __aws-lambda-get__ - Download a lambda function\n2. __aws-lambda-upload__ - Upload the function code\n3. __aws-lambda-create__ - Create and upload the function code\n\nFollowing utilities are required to download and extract a ZIP on aws-lambda-get / upload.\n\n* Curl\n* Zip/Unzip\n\n### 1. __aws-lambda-get__ - Download a lambda function\n\n```\n$ aws-lambda-get \u003cfunction-name\u003e\n```\n\n* A Zip file is downloaded from AWS Lambda and extracted to a sub directory named same to the function.\n\n### 2. __aws-lambda-upload__ - Upload the function code\n\nUpdate the function to upload a zip file which is created in automatic\nand contains all the files in subdirectory of the same name as the\nfunction.\n\n```\n$ aws-lambda-upload \u003csub-directory-name\u003e\n```\n\n* Note: this cannot create a new function.\n\n### 3. __aws-lambda-create__ - Create and upload the function code\n\nCreate the function to upload a zip file which is created in automatic\nand contains all the files in subdirectory of the same name as the\nfunction.\n\n```\n$ aws-lambda-create \u003csub-directory-name\u003e \u003crole-arn\u003e\n```\n\n----\n\nCLI-commands for AWS IoT\n------------------------\n\n1. __aws-iot-list-all-resources__ - list all the IoT resouces\n2. __aws-iot-create-keys-and-certificate__ - create certificate and attach the thing and/or policy\n3. __aws-iot-create-policy__ - create a policy\n4. __aws-iot-create-thing__ - create a thing\n5. __aws-iot-delete-thing__ - delete the thing\n6. __aws-iot-describe-thing__ - describe the thing\n7. __aws-iot-get-policy__ - print the policy\n\n\nCLI-commands for AWS API Gateway\n--------------------------------\n\n1. __aws-apigw-describe-api__ - describe an api content to json. it includes all the resources and all the methods.\n2. __aws-apigw-create-rest-api__\n3. __aws-apigw-create-resource__\n4. __aws-apigw-list-resources__\n\nCLI-commands for AWS IAM\n------------------------\n\n1. __aws-iam-list-roles__ - list names and created date of all the role\n2. __aws-iam-get-role__ - print role's JSON document to stdout\n3. __aws-iam-create-role__ - create role by the name and a JSON file that describes an assume-role-policy-document\n4. __aws-iam-attach-role-policy__ - attach a policy represented by arn to the role\n\nLICENSE\n-------\n\nThis software is released under the MIT License, see [LICENSE](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakamin%2Faws-node-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakamin%2Faws-node-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakamin%2Faws-node-util/lists"}