npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aws-node-util

v0.9.24

Published

Accessing the DynamoDB with SQL-ish statement and AWS services from CLI

Downloads

90

Readme

AWS-Node-Util

Build Status

DESCRIPTION

This module provides SQL-ish statement classes to manipulate DynamoDB.

The latest API reference is available.

Statement classes:

  1. ScanStatement
  2. QueryStatement
  3. PutItemStatement (*1)
  4. DeleteItemStatement (*1)

(*1) - Currently, These cannot be parameterized. So the prepared execution is unavailable.

And also provides CLI commands that manipulate AWS services. Some of these are depending on AWS CLI or shell script.

SQL-ish feature

See the sample code below to use the SQL-ish classes.

Sample of SQL-ish statements

sample/sqlish-sample.js

To run this sample, a DynamoDB table named 'stars' is required.

On that table, the attribute named 'mainStar' is a HASH-key typed as String and 'orbitOrder' is a RANGE-key typed as number.

"use strict";
const awsNodeUtil = require("aws-node-util");
const ScanStatement = awsNodeUtil.dynamodb.ScanStatement;
const QueryStatement = awsNodeUtil.dynamodb.QueryStatement;
const ResultSet = awsNodeUtil.dynamodb.ResultSet;

// Connect (change each value for your account)
awsNodeUtil.connect(
//    { accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2' }
);

// Prepare a scanning-all-statement without parameters.
var scanAllStatement = new ScanStatement("FROM stars");

// Prepare 'Scan' statement to filter by name.
// The name is parameterized.
var scanByNameStatement = new ScanStatement(
        "FROM stars WHERE name=:name");

// Prepare 'Query' statement to get children of specific main star.
// The name of a main star is parameterized.
var queryChildrenStatement = new QueryStatement(
        "SELECT mainStar, orbitOrder, name " +
        "FROM stars " +
        "WHERE mainStar=:mainStar");

// Set DynamoDB API interface to each statementa
const dynamodbApi = awsNodeUtil.getService("DynamoDB");
scanAllStatement.dynamodb = dynamodbApi;
scanByNameStatement.dynamodb = dynamodbApi;
queryChildrenStatement.dynamodb = dynamodbApi;

// Run the statements
scanAllStatement.run({}, (err, resp) => {
    console.log("-----------------------");
    console.log("SCAN all items of stars");
    console.log("-----------------------");
    printResult(err, resp);
    scanByNameStatement.run({ ":name": "EARTH" }, (err, resp) => {
        console.log("--------------");
        console.log("SCAN the EARTH");
        console.log("--------------");
        printResult(err, resp);

        queryChildrenStatement.run({ ":mainStar": "EARTH" }, (err, resp) => {
            console.log("------------------------------");
            console.log("QUERY child stars of the EARTH");
            console.log("------------------------------");
            printResult(err, resp);
        });
    });
});

// Handler to print result of scan / query
function printResult(err, result) {
    if(err) {
        console.error("Error:", err.stack);
    } else {
        ResultSet.printScanResult(result);
    }
}

outputs

$ node sample/sqlish-sample.js
-----------------------
SCAN all items of stars
-----------------------
Count: 10
ROWNUM diameter rotation role      mass      gravity density escapeVelocity name    orbitOrder mainStar
     1     3475    655.7 satellite    0.0073     1.6    3340            2.4 MOON             1 EARTH
     2     4879   1407.6 planet       0.33       3.7    5427            4.3 MERCURY          1 SUN
     3    12104  -5832.0 planet       4.87       8.9    5243           10.4 VENUS            2 SUN
     4    12756     23.9 planet       5.97       9.8    5514           11.2 EARTH            3 SUN
     5     6792     24.6 planet       0.642      3.7    3933            5.0 MARS             4 SUN
     6   142984      9.9 planet    1898.0       23.1    1326           59.5 JUPITER          5 SUN
     7   120536     10.7 planet     568.0        9.0     687           35.5 SATURN           6 SUN
     8    51118    -17.2 planet      86.8        8.7    1271           21.3 URANUS           7 SUN
     9    49528     16.1 planet     102.0       11.0    1638           23.5 NEPTUNE          8 SUN
    10     2370   -153.3 planet       0.0146     0.7    2095            1.3 PLUTO            9 SUN
ScannedCount: 10
--------------
SCAN the EARTH
--------------
Count: 10
ROWNUM diameter rotation role   mass gravity density escapeVelocity name  orbitOrder mainStar
     1    12756     23.9 planet 5.97     9.8    5514           11.2 EARTH          3 SUN
ScannedCount: 10
------------------------------
QUERY child stars of the EARTH
------------------------------
Count: 1
ROWNUM name orbitOrder mainStar
     1 MOON          1 EARTH
ScannedCount: 1

Scan / QueryStatement run and next method

If the LIMIT feature is used for the Scan or QueryStatement, In the callback specified for run() method, the next() method is available to get followed items.

Here is sample codes.

sample/scan-next-sample.js

"use strict";
const awsNodeUtil = require("aws-node-util");
const ScanStatement = awsNodeUtil.dynamodb.ScanStatement;
const ResultSet = awsNodeUtil.dynamodb.ResultSet;

// Connect (change each value for your account)
awsNodeUtil.connect(
//    { accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2' }
);

// Prepare 'Scan' statement
var scanStatement = new ScanStatement(
        "FROM stars LIMIT 3");
scanStatement.dynamodb = awsNodeUtil.getService("DynamoDB");

scanStatement.run({}, (err, data) => {
    if(err) {
        console.error("Error: ", err.message);
    } else if(data) {
        ResultSet.printScanResult(data);
        scanStatement.next();
    } else if(data == null) {
        console.error("OK");
    }
});

output

$ node sample/scan-next-sample.js
Count: 3
ROWNUM diameter rotation role      mass   gravity density escapeVelocity name    orbitOrder mainStar
     1     3475    655.7 satellite 0.0073     1.6    3340            2.4 MOON             1 EARTH
     2     4879   1407.6 planet    0.33       3.7    5427            4.3 MERCURY          1 SUN
     3    12104  -5832.0 planet    4.87       8.9    5243           10.4 VENUS            2 SUN
LastEvaluatedKey: {"orbitOrder":{"N":"2"},"mainStar":{"S":"SUN"}}
ScannedCount: 3
Count: 3
ROWNUM diameter rotation role   mass     gravity density escapeVelocity name    orbitOrder mainStar
     1    12756     23.9 planet    5.97      9.8    5514           11.2 EARTH            3 SUN
     2     6792     24.6 planet    0.642     3.7    3933            5.0 MARS             4 SUN
     3   142984      9.9 planet 1898.0      23.1    1326           59.5 JUPITER          5 SUN
LastEvaluatedKey: {"orbitOrder":{"N":"5"},"mainStar":{"S":"SUN"}}
ScannedCount: 3
Count: 3
ROWNUM diameter rotation role   mass  gravity density escapeVelocity name    orbitOrder mainStar
     1   120536     10.7 planet 568.0     9.0     687           35.5 SATURN           6 SUN
     2    51118    -17.2 planet  86.8     8.7    1271           21.3 URANUS           7 SUN
     3    49528     16.1 planet 102.0    11.0    1638           23.5 NEPTUNE          8 SUN
LastEvaluatedKey: {"orbitOrder":{"N":"8"},"mainStar":{"S":"SUN"}}
ScannedCount: 3
Count: 1
ROWNUM diameter rotation role   mass   gravity density escapeVelocity name  orbitOrder mainStar
     1     2370   -153.3 planet 0.0146     0.7    2095            1.3 PLUTO          9 SUN
ScannedCount: 1
OK

sample/query-next-sample.js

"use strict";
const awsNodeUtil = require("aws-node-util");
const QueryStatement = awsNodeUtil.dynamodb.QueryStatement;
const ResultSet = awsNodeUtil.dynamodb.ResultSet;

// Connect (change each value for your account)
awsNodeUtil.connect(
//    { accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2' }
);

// Prepare 'Query' statement
var queryStatement = new QueryStatement(
        "FROM stars WHERE mainStar=:ms LIMIT 2");
queryStatement.dynamodb = awsNodeUtil.getService("DynamoDB");

queryStatement.run({":ms": "SUN" }, (err, data) => {
    if(err) {
        console.error("Error: ", err.message);
    } else if(data) {
        ResultSet.printScanResult(data);
        queryStatement.next();
    } else if(data == null) {
        console.error("OK");
    }
});

output

$ node sample/query-next-sample.js
Count: 2
ROWNUM diameter rotation role   mass gravity density escapeVelocity name    orbitOrder mainStar
     1     4879   1407.6 planet 0.33     3.7    5427            4.3 MERCURY          1 SUN
     2    12104  -5832.0 planet 4.87     8.9    5243           10.4 VENUS            2 SUN
LastEvaluatedKey: {"orbitOrder":{"N":"2"},"mainStar":{"S":"SUN"}}
ScannedCount: 2
Count: 2
ROWNUM diameter rotation role   mass  gravity density escapeVelocity name orbitOrder mainStar
     1    12756     23.9 planet 5.97      9.8    5514           11.2 EARTH         3 SUN
     2     6792     24.6 planet 0.642     3.7    3933            5.0 MARS          4 SUN
LastEvaluatedKey: {"orbitOrder":{"N":"4"},"mainStar":{"S":"SUN"}}
ScannedCount: 2
Count: 2
ROWNUM diameter rotation role   mass gravity density escapeVelocity name    orbitOrder mainStar
     1   142984      9.9 planet 1898    23.1    1326           59.5 JUPITER          5 SUN
     2   120536     10.7 planet  568     9.0     687           35.5 SATURN           6 SUN
LastEvaluatedKey: {"orbitOrder":{"N":"6"},"mainStar":{"S":"SUN"}}
ScannedCount: 2
Count: 2
ROWNUM diameter rotation role   mass  gravity density escapeVelocity name    orbitOrder mainStar
     1    51118    -17.2 planet  86.8     8.7    1271           21.3 URANUS           7 SUN
     2    49528     16.1 planet 102.0    11.0    1638           23.5 NEPTUNE          8 SUN
LastEvaluatedKey: {"orbitOrder":{"N":"8"},"mainStar":{"S":"SUN"}}
ScannedCount: 2
Count: 1
ROWNUM diameter rotation role   mass   gravity density escapeVelocity name  orbitOrder mainStar
     1     2370   -153.3 planet 0.0146     0.7    2095            1.3 PLUTO          9 SUN
ScannedCount: 1
OK

sample/put-and-delete-item.js

"use strict";
const awsNodeUtil = require("aws-node-util");
const QueryStatement = awsNodeUtil.dynamodb.QueryStatement;
const PutItemStatement = awsNodeUtil.dynamodb.PutItemStatement;
const DeleteItemStatement = awsNodeUtil.dynamodb.DeleteItemStatement;
const ResultSet = awsNodeUtil.dynamodb.ResultSet;

// Connect (change each value for your account)
awsNodeUtil.connect(
//    { accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2' }
);
const dynamodbApi = awsNodeUtil.getService("DynamoDB");

// Handler to print result of scan / query
function printResult(result) {
    ResultSet.printScanResult(result);
}

// Prepare 'PutItem' statement
var putItemStatement = new PutItemStatement(
    ["INSERT INTO stars (",
        "mainStar, role, orbitOrder, name",
    ") VALUES (",
        "'SUN', 'planet', 10, 'X'",
    ")"].join(" "));
putItemStatement.dynamodb = dynamodbApi;

// Add planet X
putStar(putItemStatement, {}).then( () => {

    // Add planet Y
    putItemStatement.setValues([
        "SUN", "planet", 25, "Y"
    ]);
    return putStar( putItemStatement, {});

}).then( () => {

    // Add planet Z
    return putStar( putItemStatement, {
        orbitOrder:35, name:"Z"
    });// mainStar and role is not changed from previous.

}).then( () => {
    return queryStar("mainStar, orbitOrder, name, role", "mainStar = 'SUN'");
}).then(resp => {
    console.log("----------------------------");
    console.log("QUERY child stars of the SUN");
    console.log("----------------------------");
    printResult(resp);
}).then( () => {

    //Delete planets named X, Y and Z.
    return deleteWhere( "mainStar = 'SUN' AND orbitOrder >= 10" );

}).then( () => {
    return queryStar("mainStar, orbitOrder, name, role", "mainStar = 'SUN'");
}).then(resp => {
    console.log("----------------------------");
    console.log("QUERY child stars of the SUN");
    console.log("----------------------------");
    printResult(resp);
}).catch( err => {
    console.error("Error:", err.stack);
});

function deleteWhere(condition) {
    return queryStar( "mainStar, orbitOrder", condition ).then(result => {
        let resultSet = new ResultSet(result);
        return Promise.all(resultSet.getItems().map(item => {
            return deleteStar([
                "mainStar = '" + item.mainStar + "'",
                "AND orbitOrder = " + item.orbitOrder
            ].join(" "));
        }));
    });
}

function putStar(statement, args) {
    return new Promise( (resolve, reject) => {
        statement.run(args, err => {
            if(err) {
                reject(err);
            } else {
                resolve();
            }
        });
    });
}

function queryStar(select, condition) {
    return new Promise( (resolve, reject) => {
        const statement = new QueryStatement([
            "SELECT", select, "FROM stars",
            "WHERE", condition
        ].join(" "));
        statement.dynamodb = dynamodbApi;
        statement.run({}, (err, result) => {
            if(err) {
                reject(err);
            } else {
                resolve(result);
            }
        });
    });
}

function deleteStar(condition) {
    return new Promise( (resolve, reject) => {
        console.log("DELETE", condition);
        const statement = new DeleteItemStatement([
            "DELETE FROM stars WHERE",
            condition
        ].join(" "));
        statement.dynamodb = dynamodbApi;
        statement.run({}, (err) => {
            if(err) {
                reject(err);
            } else {
                resolve();
            }
        })
    });
}

outputs

$ node sample/put-and-delete-item.js
----------------------------
QUERY child stars of the SUN
----------------------------
Count: 12
ROWNUM role   name    orbitOrder mainStar
     1 planet MERCURY          1 SUN
     2 planet VENUS            2 SUN
     3 planet EARTH            3 SUN
     4 planet MARS             4 SUN
     5 planet JUPITER          5 SUN
     6 planet SATURN           6 SUN
     7 planet URANUS           7 SUN
     8 planet NEPTUNE          8 SUN
     9 planet PLUTO            9 SUN
    10 planet X               10 SUN
    11 planet Y               25 SUN
    12 planet Z               35 SUN
ScannedCount: 12
DELETE mainStar = 'SUN' AND orbitOrder = 10
DELETE mainStar = 'SUN' AND orbitOrder = 25
DELETE mainStar = 'SUN' AND orbitOrder = 35
----------------------------
QUERY child stars of the SUN
----------------------------
Count: 9
ROWNUM role   name    orbitOrder mainStar
     1 planet MERCURY          1 SUN
     2 planet VENUS            2 SUN
     3 planet EARTH            3 SUN
     4 planet MARS             4 SUN
     5 planet JUPITER          5 SUN
     6 planet SATURN           6 SUN
     7 planet URANUS           7 SUN
     8 planet NEPTUNE          8 SUN
     9 planet PLUTO            9 SUN
ScannedCount: 9

CLI-Commands for Amazon Dynamo

  1. aws-dynamodb-delete-item - delete item on the table
  2. aws-dynamodb-put-item - put item to the table
  3. aws-dynamodb-query - query and display items in the table
  4. aws-dynamodb-scan - scan and display items in the table
  5. aws-dynamodb-create-table - create table with a json file. the file desc2create output can use.
  6. aws-dynamodb-delete-table - delete the table
  7. aws-dynamodb-desc2create - Convert a JSON to create the table from its description
  8. aws-dynamodb-describe-table - describe the table
  9. aws-dynamodb-list-tables - display the table names

These commands are designed to recognize the keywords in the expressions and to generate placeholders automatically.

1. aws-dynamodb-delete-item

Delete -- delete the item from the table.

$ aws-dynamodb-delete-item `<table-name>` `<item-expression>`

Parameters

|Parameter |Content | |:------------------|:-------------------------------| | table-name | Target table name | | key | Item to delete from the table |

  • key is a comma separated string representing key attribute names and values like <attr-name1> = <value>, <attr-name2> = <value>, ....
  • All the keys must be included
  • The value type will be determined automatically from its notation.

2. aws-dynamodb-put-item

Put -- insert or update the item to the table from command line.

$ aws-dynamodb-put-item `<table-name>` `<item-expression>` ...

Parameters

|Parameter |Content | |:------------------|:---------------------------| | table-name | Target table name | | item-expression | Items to put to the table |

  • item-expression is comma separated strings representing attribute names and values like <attr-name1> = <value>, <attr-name2> = <value>, ....
  • All the keys must be included to specify whether the items will be inserted or updated.
  • The attribute name can be path.to.the.item (See the example below).
  • The value type will be determined automatically from its notation.

Example

Comamnd line:

$ aws-dynamodb-put-item testTable '
    id="123",
    timestamp=145678900,
    test.name="foo",
    test.pass=true,
    value.version="0.6.6"
'

Then Item to be added to the table:

{
    "id":       {"S": "123"},
    "timestamp":{"N": "145678900"},
    "test": {
        "M": {
            "name": {"S": "foo"},
            "pass": {"BOOL": true}
        }
    },
    "value" : {"M" : {"version": {"S": "0.6.6"}}}
}

Available Types Assumed In Automatic

| value | type | |:------------:|:-----------| | true / false | boolean | | "ABC" / '123'| string | | 123.4 | number |

3. aws-dynamodb-query

Query -- This reports the retrieved data that matches key-conditions given from command-line without consideration about the placeholder.

Usage:
1) aws-dynamodb-query [OPTIONS] <tableName> <keyConditionExpression>
2) aws-dynamodb-query [OPTIONS] -q <SQL-ish-statement>

  -c, --max-items=ARG                 The total number of items to return
  -n, --starting-token=ARG            A token to specify where to start
                                      paginating
  -s, --sort-item=ARG                 JSON path to the sort item
  -p, --projection-expression=ARG     comma separated attribute names to
                                      project
  -k, --key-condition-expression=ARG  key condition expression of query
  -f, --filter-expression=ARG         filter expression applied after
                                      query
  -d, --desc                          Sorting direction to descendent
  -j, --output-json                   output a json to read
  -J, --output-json-oneline           output a json in oneline
  -t, --dry-run                       Print options of the query and exit
  -q, --sql-ish                       Query by SQL-ish-statement(beta)
  -h, --help                          display this help

PARAMETERS:

  tableName              The table name defined in DynamoDB.
  keyConditionExpression KeyConditionExpression for the DynamoDB table.
  SQL-ish-statement      SQL-ish text that represents a query

  1) In all expression parameter, option value or SQL-ish,the field names
  could be represented as is for its declared name in the table without
  considering the placeh older of AWS DynamoDB.

  2) Here is an examples showing a syntax for SQL-ish-statement of query.

    [ SELECT <projection-expression> ]
    FROM <tableName>
    WHERE <keyConditionExpression>
    [ FILTER <filter-expression> ]
    [ LIMIT <max-items> ]

  This says the FROM and WHERE clauses are mandatory and the SELECT,
  FILTER and LIMIT are optional.

EXAMPLE

$ aws-dynamodb-query stars \
> "mainStar='SUN' AND orbitOrder BETWEEN 1 AND 9" \
> --projection-expression "name, mass, diameter" \
> --sort-item orbitOrder
Count: 9
ROWNUM diameter mass      name
     1     4879    0.33   MERCURY
     2    12104    4.87   VENUS
     3    12756    5.97   EARTH
     4     6792    0.642  MARS
     5   142984 1898.0    JUPITER
     6   120536  568.0    SATURN
     7    51118   86.8    URANUS
     8    49528  102.0    NEPTUNE
     9     2370    0.0146 PLUTO
ScannedCount: 9

SQL-ish statement:

$ aws-dynamodb-query -q "SELECT name, mass, diameter \
> FROM stars \
> WHERE mainStar='SUN' AND orbitOrder BETWEEN 1 AND 9" \
> --sort-item orbitOrder
Count: 9
ROWNUM diameter mass      name
     1     4879    0.33   MERCURY
     2    12104    4.87   VENUS
     3    12756    5.97   EARTH
     4     6792    0.642  MARS
     5   142984 1898.0    JUPITER
     6   120536  568.0    SATURN
     7    51118   86.8    URANUS
     8    49528  102.0    NEPTUNE
     9     2370    0.0146 PLUTO
ScannedCount: 9

4. aws-dynamodb-scan

Usage:
1) aws-dynamodb-scan [OPTIONS] <tableName>
2) aws-dynamodb-scan [OPTIONS] -q <SQL-ish-statement>

  -c, --max-items=ARG              The total number of items to return
  -n, --starting-token=ARG         A token to specify where to start
                                   paginating
  -s, --sort-item=ARG              JSON path to the sort item
  -p, --projection-expression=ARG  comma separated attribute names to
                                   project
  -f, --filter-expression=ARG      filter expression
  -d, --desc                       Sorting direction to descendent
  -j, --output-json                output a json to read
  -J, --output-json-oneline        output a json in oneline
  -t, --dry-run                    Print options of the scan and exit
  -q, --sql-ish                    Query by SQL-ish-statement(beta)
  -h, --help                       display this help

PARAMETERS:

  tableName              The table name defined in DynamoDB.
  SQL-ish-statement      SQL-ish text that represents a scan

  1) In all expression parameter, option value or SQL-ish,the field names
  could be represented as is for its declared name in the table without
  considering the placeh older of AWS DynamoDB.

  2) Here is an examples showing a syntax for SQL-ish-statement of scan.

    [ SELECT <projection-expression> ]
    FROM <tableName>
    [ WHERE <filter-expression> ]
    [ LIMIT <max-items> ]

  This says the FROM clauses is mandatory and the SELECT, WHERE and LIMIT
  are optional.

EXAMPLE

Comamnd line:


$ aws-dynamodb-scan stars
Count: 10
ROWNUM diameter rotation role      mass      gravity density escapeVelocity name    orbitOrder mainStar
     1     3475    655.7 satellite    0.0073     1.6    3340            2.4 MOON             1 EARTH
     2     4879   1407.6 planet       0.33       3.7    5427            4.3 MERCURY          1 SUN
     3    12104  -5832.0 planet       4.87       8.9    5243           10.4 VENUS            2 SUN
     4    12756     23.9 planet       5.97       9.8    5514           11.2 EARTH            3 SUN
     5     6792     24.6 planet       0.642      3.7    3933            5.0 MARS             4 SUN
     6   142984      9.9 planet    1898.0       23.1    1326           59.5 JUPITER          5 SUN
     7   120536     10.7 planet     568.0        9.0     687           35.5 SATURN           6 SUN
     8    51118    -17.2 planet      86.8        8.7    1271           21.3 URANUS           7 SUN
     9    49528     16.1 planet     102.0       11.0    1638           23.5 NEPTUNE          8 SUN
    10     2370   -153.3 planet       0.0146     0.7    2095            1.3 PLUTO            9 SUN
ScannedCount: 10

SQL-ish statement:


$ aws-dynamodb-scan -q "FROM stars"
Count: 10
ROWNUM diameter rotation role      mass      gravity density escapeVelocity name    orbitOrder mainStar
     1     3475    655.7 satellite    0.0073     1.6    3340            2.4 MOON             1 EARTH
     2     4879   1407.6 planet       0.33       3.7    5427            4.3 MERCURY          1 SUN
     3    12104  -5832.0 planet       4.87       8.9    5243           10.4 VENUS            2 SUN
     4    12756     23.9 planet       5.97       9.8    5514           11.2 EARTH            3 SUN
     5     6792     24.6 planet       0.642      3.7    3933            5.0 MARS             4 SUN
     6   142984      9.9 planet    1898.0       23.1    1326           59.5 JUPITER          5 SUN
     7   120536     10.7 planet     568.0        9.0     687           35.5 SATURN           6 SUN
     8    51118    -17.2 planet      86.8        8.7    1271           21.3 URANUS           7 SUN
     9    49528     16.1 planet     102.0       11.0    1638           23.5 NEPTUNE          8 SUN
    10     2370   -153.3 planet       0.0146     0.7    2095            1.3 PLUTO            9 SUN
ScannedCount: 10

Don't Worry The Placeholders

For the expressions of dynamodb query and scan commands, You can write the attribute names or its values directly. Because, the placeholders are recognized and created in automatic by the commands So, you don't need to worry about it.


CLI-commands for AWS Lambda

  1. aws-lambda-get - Download a lambda function
  2. aws-lambda-upload - Upload the function code
  3. aws-lambda-create - Create and upload the function code

Following utilities are required to download and extract a ZIP on aws-lambda-get / upload.

  • Curl
  • Zip/Unzip

1. aws-lambda-get - Download a lambda function

$ aws-lambda-get <function-name>
  • A Zip file is downloaded from AWS Lambda and extracted to a sub directory named same to the function.

2. aws-lambda-upload - Upload the function code

Update the function to upload a zip file which is created in automatic and contains all the files in subdirectory of the same name as the function.

$ aws-lambda-upload <sub-directory-name>
  • Note: this cannot create a new function.

3. aws-lambda-create - Create and upload the function code

Create the function to upload a zip file which is created in automatic and contains all the files in subdirectory of the same name as the function.

$ aws-lambda-create <sub-directory-name> <role-arn>

CLI-commands for AWS IoT

  1. aws-iot-list-all-resources - list all the IoT resouces
  2. aws-iot-create-keys-and-certificate - create certificate and attach the thing and/or policy
  3. aws-iot-create-policy - create a policy
  4. aws-iot-create-thing - create a thing
  5. aws-iot-delete-thing - delete the thing
  6. aws-iot-describe-thing - describe the thing
  7. aws-iot-get-policy - print the policy

CLI-commands for AWS API Gateway

  1. aws-apigw-describe-api - describe an api content to json. it includes all the resources and all the methods.
  2. aws-apigw-create-rest-api
  3. aws-apigw-create-resource
  4. aws-apigw-list-resources

CLI-commands for AWS IAM

  1. aws-iam-list-roles - list names and created date of all the role
  2. aws-iam-get-role - print role's JSON document to stdout
  3. aws-iam-create-role - create role by the name and a JSON file that describes an assume-role-policy-document
  4. aws-iam-attach-role-policy - attach a policy represented by arn to the role

LICENSE

This software is released under the MIT License, see LICENSE