aws_pipes 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +12 -0
- data/bin/aws_db +43 -0
- data/lib/aws_pipes/version.rb +1 -1
- metadata +4 -2
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
## Overview
|
2
|
+
|
1
3
|
### Communicating
|
2
4
|
|
3
5
|
Send messages between Amazon EC2 instances through Unix pipes.
|
@@ -52,6 +54,9 @@ queue](https://console.aws.amazon.com/sqs/) in the Amazon Web Console.
|
|
52
54
|
# View log entries for "bar" within a date range
|
53
55
|
aws_log show bar --after "1970-01-01" --before "2020-02-02 13:42:12.123"
|
54
56
|
|
57
|
+
Each line sent to the log gets marked with a timestamp and the external
|
58
|
+
IP address of the machine which added it.
|
59
|
+
|
55
60
|
You can combine queuing and logging in
|
56
61
|
a single command using Bash [process
|
57
62
|
substitution](http://www.gnu.org/software/bash/manual/bashref.html#Proce
|
@@ -61,6 +66,13 @@ ss-Substitution):
|
|
61
66
|
# while logging stderr to a log named "bar"
|
62
67
|
your_program 1> >(aws_queue write foo) 2> >(aws_log record bar)
|
63
68
|
|
69
|
+
### aws_db
|
70
|
+
|
71
|
+
# save each tab-delimited line of as a row in DynamoDB table foo
|
72
|
+
# filling in columns a, b, and c
|
73
|
+
your_program | aws_db foo a b c
|
74
|
+
|
75
|
+
|
64
76
|
## Installation
|
65
77
|
|
66
78
|
1. Sign up for an [AWS account](http://aws.amazon.com/).
|
data/bin/aws_db
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/aws_pipes'
|
4
|
+
require 'trollop'
|
5
|
+
require 'aws-sdk'
|
6
|
+
require 'open-uri'
|
7
|
+
|
8
|
+
opts = AwsPipes.common_aws_options(
|
9
|
+
"aws_db",
|
10
|
+
<<-EOS
|
11
|
+
Write rows to Amazom DynamoDB.
|
12
|
+
|
13
|
+
Usage:
|
14
|
+
aws_db [options] table-name col1 [col2 col3 ...]
|
15
|
+
Save each tab-delimited line of STDIN as a row in Amazon DynamoDB
|
16
|
+
EOS
|
17
|
+
)
|
18
|
+
|
19
|
+
table_name = ARGV.shift
|
20
|
+
unless table_name
|
21
|
+
Trollop::die "Please provide table name"
|
22
|
+
end
|
23
|
+
|
24
|
+
col_names = ARGV
|
25
|
+
if col_names.length == 0
|
26
|
+
Trollop::die "Please provide column names"
|
27
|
+
end
|
28
|
+
|
29
|
+
db = AWS::DynamoDB.new(
|
30
|
+
:access_key_id => AwsPipes.access_key_id(opts),
|
31
|
+
:secret_access_key => AwsPipes.secret_access_key(opts)
|
32
|
+
)
|
33
|
+
|
34
|
+
begin
|
35
|
+
$stdin.sync = true
|
36
|
+
table = db.tables[table_name]
|
37
|
+
table.load_schema
|
38
|
+
while row = $stdin.gets
|
39
|
+
table.items.create Hash[col_names.zip(row.split "\t")]
|
40
|
+
end
|
41
|
+
rescue Interrupt
|
42
|
+
exit 0
|
43
|
+
end
|
data/lib/aws_pipes/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_pipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -47,6 +47,7 @@ description: Send messages between Amazon EC2 instances through Unix pipes.
|
|
47
47
|
email:
|
48
48
|
- cred+github@begriffs.com
|
49
49
|
executables:
|
50
|
+
- aws_db
|
50
51
|
- aws_log
|
51
52
|
- aws_queue
|
52
53
|
extensions: []
|
@@ -58,6 +59,7 @@ files:
|
|
58
59
|
- README.md
|
59
60
|
- Rakefile
|
60
61
|
- aws_pipes.gemspec
|
62
|
+
- bin/aws_db
|
61
63
|
- bin/aws_log
|
62
64
|
- bin/aws_queue
|
63
65
|
- lib/aws_pipes.rb
|