node package manager

aws-node-util

AWS-Node-Util

DESCRIPTION

The command sets to manipulate AWS with the local command line interface.

These are wrapper for the AWS CLI with shell script or Node.js. So, this command set needs AWS CLI and Node.js.

Utils 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

Put -- 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

$ aws-dynamodb-query <table-name> <key-condition-expression> [options]

  • table-name - target table name
  • key-condition-expression - query condition about key of the table.

OPTIONS

  • --filter-expression / --key-condition-expression

The conditional expression for the query.

  • --projection-expression

Specify a comma separated attribute names to retrieve specific attributes.

EXAMPLE

Comamnd line:

 
$ aws-dynamodb-query \
    planetTable "mainStar='theSun' AND orbitOrder BETWEEN 1 AND 9" \
    --projection-expression "name, mass, diameter" \
    --sort-item orbitOrder
 

4. aws-dynamodb-scan

$ aws-dynamodb-scan <table-name> [options]

  • table-name - target table name

OPTIONS

  • --filter-expression

The conditional expression for the query.

  • --projection-expression

Specify a comma separated attribute names to retrieve specific attributes.

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.


Utils 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>

Utils 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

Utils 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

Utils 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