aws_tracker 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -115
- data/lib/aws_tracker/version.rb +1 -1
- metadata +76 -104
data/README.md
CHANGED
@@ -1,118 +1,6 @@
|
|
1
1
|
AWS Tracker
|
2
2
|
================
|
3
|
-
Models the state of one or more Amazon Web Services accounts in an ActiveRecord object graph.
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
----------------
|
9
|
-
What is it?
|
10
|
-
----------------
|
11
|
-
The AWS Tracker monitors one or more AWS accounts and the current state of their associated "resources" -- Instances, EBS volumes, RDS servers, and so on. The Tracker periodically polls the Amazon Web Services API for the latest information on each account's resources, and then maintains the corresponding rows in an ActiveRecord-compatible database. Users of the library can thereafter run multiple complex queries on the state of their AWS assets, with no network overhead.
|
12
|
-
|
13
|
-
|
14
|
-
----------------
|
15
|
-
Why is it?
|
16
|
-
----------------
|
17
|
-
The AWS Tracker is intended to be a foundation library, on top of which more complex AWS applications can be built. It decouples the process of downloading AWS state information from the process of displaying and/or acting on that information. Although an executable 'tracker' command-line program is included, the library is primarily intended for use from within Rails, or some other ActiveRecord context. An ActiveRecord database connection must be initialized before the aws_tracker library is loaded from within Ruby.
|
18
|
-
|
19
|
-
|
20
|
-
----------------
|
21
|
-
Installation
|
22
|
-
----------------
|
23
|
-
1) Install the AWS Tracker gem (use _sudo_ as necessary).
|
24
|
-
|
25
|
-
gem install aws_tracker
|
26
|
-
|
27
|
-
2) Install your database adaptor of choice. Sqlite3 is installed with AWS Tracker, so this step may be optional.
|
28
|
-
|
29
|
-
|
30
|
-
----------------
|
31
|
-
Usage [from the command line]
|
32
|
-
----------------
|
33
|
-
1) First, generate an ActiveRecord-style configuration file.
|
34
|
-
|
35
|
-
Here are the sample contents of `tracker_db.yml`:
|
36
|
-
|
37
|
-
adapter: sqlite3
|
38
|
-
database: aws_tracker.sqlite3
|
39
|
-
pool: 5
|
40
|
-
timeout: 5000
|
41
|
-
|
42
|
-
2) Create the database to contain the data. This is not necessary if using sqlite.
|
43
|
-
|
44
|
-
3) The AWS Account information is stored in a (YAML) configuration file. Name this `accounts.yml` and store it alongside the above `tracker_db.yml` file.
|
45
|
-
|
46
|
-
development account:
|
47
|
-
account_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
48
|
-
access_key_id: xxxxxxxxxxxxxxxxxxxx
|
49
|
-
secret_access_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
50
|
-
|
51
|
-
testing account:
|
52
|
-
account_id: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
|
53
|
-
access_key_id: xxxxxxxxxxxxxxxxxxxx
|
54
|
-
secret_access_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
55
|
-
|
56
|
-
When the tracker command-line program runs, these accounts are written into the database, but without the secret information. This allows external processes to read the AWS state database safely.
|
57
|
-
|
58
|
-
4) Run the tracker, and point it at the database config file
|
59
|
-
|
60
|
-
tracker tracker_db.yml --migrate
|
61
|
-
|
62
|
-
The `--migrate` argument updates the database to the latest version of the schema, and is only necessary for new databases, or when upgrading to a new version of the Tracker gem.
|
63
|
-
|
64
|
-
|
65
|
-
----------------
|
66
|
-
Usage [from within Ruby]
|
67
|
-
----------------
|
68
|
-
1) Insert the necessary tables into your database.
|
69
|
-
First, `require 'AWSTracker/tasks'` from your Rakefile, then run
|
70
|
-
|
71
|
-
rake db:migrate:tracker
|
72
|
-
|
73
|
-
2) In your Ruby app, first set up an ActiveRecord connection. In Rails, this is done for you automatically, but here's an example for a non-Rails app:
|
74
|
-
|
75
|
-
require 'active_record'
|
76
|
-
ActiveRecord::Base.establish_connection({
|
77
|
-
:adapter => 'sqlite3', :database => 'aws_tracker.sqlite3'
|
78
|
-
})
|
79
|
-
|
80
|
-
3) Now `require 'aws_tracker'`. This will load the models and allow you to perform queries on the following AWS resources and their relationships:
|
81
|
-
|
82
|
-
* AWSTracker::AWSAccount
|
83
|
-
* AWSTracker::SecurityGroup
|
84
|
-
* AWSTracker::Instance
|
85
|
-
* AWSTracker::EBSVolume
|
86
|
-
|
87
|
-
4) Then load your AWSAccounts from YAML, and use a Tracker object to fetch their status from AWS:
|
88
|
-
|
89
|
-
include AWSTracker # Load model class names into namespace
|
90
|
-
accounts = AWSAccount.from_yaml_file('config/accounts.yml')
|
91
|
-
accounts.each {|a| a.save!} # Save them in the database
|
92
|
-
t = Tracker.new # A Tracker updates all accounts in the DB
|
93
|
-
t.delay = 15 # Update every 15 seconds
|
94
|
-
t.start # Runs in the background. Call 'stop' later
|
95
|
-
|
96
|
-
|
97
|
-
----------------
|
98
|
-
Development
|
99
|
-
----------------
|
100
|
-
This project is still in its early stages, but most of the framework is in place. More AWS resources need to be modeled, but the patterns for the code to do so are now laid out. Helping hands are appreciated!
|
101
|
-
|
102
|
-
1) Fetch the project code and bundle up...
|
103
|
-
|
104
|
-
git clone https://github.com/benton/aws_tracker.git
|
105
|
-
cd aws_tracker
|
106
|
-
bundle install
|
107
|
-
|
108
|
-
2) Create a database config and the necessary tables
|
109
|
-
|
110
|
-
cp config/database.yml.example config/database.yml
|
111
|
-
rake db:migrate:tracker
|
112
|
-
|
113
|
-
3) To run the tests, first export the credentials as environment variables, then `rake spec`.
|
114
|
-
|
115
|
-
export AWS_ACCOUNT_NUMBER=[your AWS account number]
|
116
|
-
export AWS_ACCESS_KEY_ID=[your EC2 access key ID]
|
117
|
-
export AWS_ACCESS_KEY_SECRET=[your EC2 access key secret]
|
118
|
-
rake spec
|
4
|
+
This project has been closed out - no further updates are forthcoming.
|
5
|
+
However, its functionality lives on in the
|
6
|
+
[Cloud Cost Tracker](https://github.com/benton/cloud_cost_tracker)
|
data/lib/aws_tracker/version.rb
CHANGED
metadata
CHANGED
@@ -1,116 +1,91 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_tracker
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Benton Roberts
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-06-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: activerecord
|
22
|
-
|
23
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70164083661540 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
32
23
|
prerelease: false
|
33
|
-
|
34
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *70164083661540
|
25
|
+
- !ruby/object:Gem::Dependency
|
35
26
|
name: right_aws
|
36
|
-
|
37
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70164083693060 !ruby/object:Gem::Requirement
|
38
28
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
- 0
|
45
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
46
34
|
prerelease: false
|
47
|
-
|
48
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *70164083693060
|
36
|
+
- !ruby/object:Gem::Dependency
|
49
37
|
name: sqlite3
|
50
|
-
|
51
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70164083691640 !ruby/object:Gem::Requirement
|
52
39
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
|
58
|
-
- 0
|
59
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
60
45
|
prerelease: false
|
61
|
-
|
62
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *70164083691640
|
47
|
+
- !ruby/object:Gem::Dependency
|
63
48
|
name: rake
|
64
|
-
|
65
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
49
|
+
requirement: &70164083689920 !ruby/object:Gem::Requirement
|
66
50
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
71
|
-
|
72
|
-
- 0
|
73
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
74
56
|
prerelease: false
|
75
|
-
|
76
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *70164083689920
|
58
|
+
- !ruby/object:Gem::Dependency
|
77
59
|
name: rspec
|
78
|
-
|
79
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
60
|
+
requirement: &70164083688620 !ruby/object:Gem::Requirement
|
80
61
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
85
|
-
|
86
|
-
- 0
|
87
|
-
version: "0"
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
88
67
|
prerelease: false
|
89
|
-
|
90
|
-
- !ruby/object:Gem::Dependency
|
68
|
+
version_requirements: *70164083688620
|
69
|
+
- !ruby/object:Gem::Dependency
|
91
70
|
name: bundler
|
92
|
-
|
93
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
71
|
+
requirement: &70164083687760 !ruby/object:Gem::Requirement
|
94
72
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
|
99
|
-
|
100
|
-
- 0
|
101
|
-
version: "0"
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
102
78
|
prerelease: false
|
103
|
-
|
104
|
-
description: This gem peridically queries AWS for information about Instances, SecurityGroups,
|
105
|
-
|
79
|
+
version_requirements: *70164083687760
|
80
|
+
description: This gem peridically queries AWS for information about Instances, SecurityGroups,
|
81
|
+
EBSVolumes, etc., and saves the data as interconnected ActiveRecord objects.aws_tracker
|
82
|
+
email:
|
106
83
|
- benton@bentonroberts.com
|
107
|
-
executables:
|
84
|
+
executables:
|
108
85
|
- tracker
|
109
86
|
extensions: []
|
110
|
-
|
111
87
|
extra_rdoc_files: []
|
112
|
-
|
113
|
-
files:
|
88
|
+
files:
|
114
89
|
- .gitignore
|
115
90
|
- .rspec
|
116
91
|
- Gemfile
|
@@ -150,38 +125,35 @@ files:
|
|
150
125
|
- spec/support/create_testing_objects.rb
|
151
126
|
homepage: http://github.com/benton/aws_tracker
|
152
127
|
licenses: []
|
153
|
-
|
154
128
|
post_install_message:
|
155
129
|
rdoc_options: []
|
156
|
-
|
157
|
-
require_paths:
|
130
|
+
require_paths:
|
158
131
|
- lib
|
159
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
133
|
none: false
|
161
|
-
requirements:
|
162
|
-
- -
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
|
165
|
-
segments:
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
segments:
|
166
139
|
- 0
|
167
|
-
|
168
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
hash: 4487828262727353232
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
142
|
none: false
|
170
|
-
requirements:
|
171
|
-
- -
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
|
174
|
-
segments:
|
143
|
+
requirements:
|
144
|
+
- - ! '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
segments:
|
175
148
|
- 0
|
176
|
-
|
149
|
+
hash: 4487828262727353232
|
177
150
|
requirements: []
|
178
|
-
|
179
151
|
rubyforge_project: aws_tracker
|
180
|
-
rubygems_version: 1.
|
152
|
+
rubygems_version: 1.8.15
|
181
153
|
signing_key:
|
182
154
|
specification_version: 3
|
183
155
|
summary: Models the state of Amazon Web Services accounts in ActiveRecord
|
184
|
-
test_files:
|
156
|
+
test_files:
|
185
157
|
- spec/lib/aws_tracker/models/aws_account_spec.rb
|
186
158
|
- spec/lib/aws_tracker/models/ebs_volume_spec.rb
|
187
159
|
- spec/lib/aws_tracker/models/instance_spec.rb
|