• Stars
    star
    238
  • Rank 169,306 (Top 4 %)
  • Language
    JavaScript
  • Created over 13 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[DEPRECATED - use aws-sdk for node.js] AWS (Amazon Web Services) APIs client implementation for node.js

About build status NPM version

Amazon Web Services node.js client.

Installation

npm install aws2js

Requires these libraries:

Project and Design goals

  • HTTPS-only APIs communication (exceptions allowed for HTTP-only APIs)
  • Proper error reporting
  • Simple to write clients for a specific AWS service (abstracts most of the low level plumbing)
  • Modular design
  • Simple to use AWS API calls
  • Higher level clients for specific work flows
  • Proper documentation

Migrating from pre 0.9

The library loader used by aws2js from v0.3 up to v0.8 is deprecated. Creating a new instance for each service is the preferred way. Creating a new client without specifying the AWS credentials is not allowed, therefore the loader doesn't support this style anymore:

var ec2 = require('aws2js').load('ec2');
ec2.setCredentials('AKIAccessKeyId', 'SecretAccessKey');

You have to add the credentials to the load call even for the deprecated mode:

var ec2 = require('aws2js').load('ec2', 'AKIAccessKeyId', 'SecretAccessKey');

The presence of the AWS credentials is now checked when the client is instantiated instead of checking that with each AWS request. It is the right thing to do at the cost of backward incompatibility.

The String Request Body Handler is removed. http-request was implemented without String support for PUT/POST request bodies, which is a deliberate decision. Use a Buffer instance instead. It can be created from a String:

var body = new Buffer('string to use as buffer');

Supported Amazon Web Services

  • EC2 (Elastic Compute Cloud)
  • RDS (Relational Database Service)
  • SES (Simple Email Service)
  • ELB (Elastic Load Balancing)
  • IAM (Identity and Access Management)
  • AS (Auto Scaling)
  • CW (CloudWatch)
  • EC (ElastiCache)
  • SQS (Simple Queue Service)
  • CFN (CloudFormation)
  • SDB (SimpleDB)
  • STS (Security Token Service)
  • DDB (DynamoDB)
  • SNS (Simple Notification Service)
  • EMR (Elastic MapReduce)
  • S3 (Simple Storage Service)

Examples

var aws = require('aws2js');

var EC2 = aws.EC2;
var ec2 = new EC2('accessKeyId', 'secretAccessKey'); // Elastic Compute Cloud

ec2.request('DescribeInstances', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var RDS = aws.RDS;
var rds = new RDS('accessKeyId', 'secretAccessKey'); // Relational Database Service

rds.request('DescribeDBInstances', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var SES = aws.SES;
var ses = new SES('accessKeyId', 'secretAccessKey'); // Simple Email Service

ses.request('ListVerifiedEmailAddresses', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var ELB = aws.ELB;
var elb = new ELB('accessKeyId', 'secretAccessKey'); // Elastic Load Balancing

ses.request('DescribeLoadBalancers', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var IAM = aws.IAM;
var iam = new IAM('accessKeyId', 'secretAccessKey'); // Identity and Access Management

iam.request('ListUsers', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var AS = aws.AS;
var as = new AS('accessKeyId', 'secretAccessKey'); // Auto Scaling

as.request('DescribeScalingActivities', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var CW = aws.CW;
var cw = new CW('accessKeyId', 'secretAccessKey'); // CloudWatch

cw.request('DescribeAlarms', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var EC = aws.EC;
var ec = new EC('accessKeyId', 'secretAccessKey'); // ElastiCache

ec.request('DescribeCacheClusters', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var SQS = aws.SQS;
var sqs = new SQS('accessKeyId', 'secretAccessKey'); // Simple Queue Service

sqs.request('ListQueues', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var CFN = aws.CFN;
var cfn = new CFN('accessKeyId', 'secretAccessKey'); // CloudFormation

cfn.request('DescribeStacks', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var SDB = aws.SDB;
var sdb = new SDB('accessKeyId', 'secretAccessKey'); // SimpleDB

sdb.request('ListDomains', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var STS = aws.sts;
var sts = new STS('accessKeyId', 'secretAccessKey'); // Security Token Service

sts.request('GetSessionToken', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	var credentials = result.GetSessionTokenResult.Credentials;
	
	var DDB = aws.DDB;
	var ddb = new DDB(credentials.AccessKeyId, credentials.SecretAccessKey, credentials.SessionToken); // DynamoDB
	ddb.request('ListTables', function (err, res) {
		if (err) {
			console.error(err);
			return;
		}
		
		console.log(res);
	});
});

var SNS = aws.SNS;
var sns = new SNS('accessKeyId', 'secretAccessKey'); // Simple Notification Service

sns.request('ListSubscriptions', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

var EMR = aws.EMR;
var emr = new EMR('accessKeyId', 'secretAccessKey'); // Elastic MapReduce

emr.request('DescribeJobFlows', function (error, result) {
	if (error) {
		console.error(error);
		return;
	}
	
	console.log(result);
});

More Repositories

1

romanian-programmers-mac

Aranjament de tastatură "Romanian - Programmers" pentru Mac OS X / macOS
Shell
133
star
2

http-request

General purpose HTTP / HTTPS client for node.js. Supports transparent gzip / deflate decoding. Successor of http-get.
JavaScript
81
star
3

sploit-tools

My own tools for easing the task of pentesting / exploit writing
Python
51
star
4

mime-magic

Proper MIME type detection library for node.js that wraps the libmagic functionality
JavaScript
35
star
5

libxml-to-js

XML to JavaScript object converter based on libxmljs
JavaScript
33
star
6

aircrack-db

A list of wireless cards tested with the dual-card injection test and in the field
Smarty
24
star
7

ftp-get

Simple to use node.js FTP client for downloading remote files
JavaScript
17
star
8

virustotal.js

VirusTotal API client for node.js.
JavaScript
14
star
9

serverspec-aws

Serverspec resources for AWS
Ruby
12
star
10

PasswordHash2

Portable password hashing framework for PHP. Uses the bcrypt and the SHA2 crypt() alternative schemes.
PHP
8
star
11

dynamo-backup-streams

Backup / Restore DynamoDB node.js streams
JavaScript
5
star
12

kitchen-docker-host-vagrant

[DEPRECATED] Docker host VM created with kitchen-docker in mind
Ruby
5
star
13

sysadmin-tools

My own tools for automatic the repetitive tasks
JavaScript
3
star
14

envelope-encryption-tools

Lightweight encryption toolkit to support envelope encryption schemes
JavaScript
3
star
15

rtl8812au

RTL8812AU driver with patch for building it on Raspberry Pi
C
3
star
16

exploit-list

Stuff written by following various resources about writing exploits
Python
2
star
17

pwned-password-downloader

Have I Been Pwned breached password list downloader
Crystal
2
star
18

oauth2-cli

CLI utility to get OAuth2 tokens for three-leggged flows
Ruby
2
star
19

pwned-password-checker

Offline search tooling into a pwned password list
Ruby
2
star
20

phbench

PHP Benchmark Test
PHP
2
star
21

keepass-static

Ruby bindings to libkpass as static built native extensions
C
2
star
22

simple-schedule

Simple scheduler for dispatching a number of batch tasks at defined intervals
JavaScript
2
star
23

unitformat-js

Unit formatter for JavaScript
JavaScript
1
star
24

dynflare

Dynamic DNS script built on top of the CloudFlare API
Python
1
star
25

XVE-Various-Embed

XVE is a WordPress plug-in for embedding media content to your blog.
PHP
1
star
26

remote_apt

Chef cookbook to handle the installation of remotely hosted apt packages
Ruby
1
star
27

salt-modules

Just a place to dump my custom SaltStack modules.
Python
1
star