aws-rds 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0b1c285ef2c67a30c80ce7fd061f7273bcd45900108bfaad8ab58a8fe989b1b7
4
+ data.tar.gz: 79b4b75bde18f848c3ec519688240a039a2b735361b6fe462dc8a55caf0000fe
5
+ SHA512:
6
+ metadata.gz: a93719e69cf274d15a7d05eccab34346c2e0b532b4fe633f13ca36071cfe1ff0b718d9db83d0c95529a5b7e39957c6d8cd4f47d03c1125bd1333abb54c7dbb07
7
+ data.tar.gz: ee807978b0406cc7444b713a4b53f5773d347f0f15a4e3a6d294025082c81abb8fc5e01c496f8933a66c8664fc9698364bffa47c22c82fe5462f79c24e329752
@@ -0,0 +1,16 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ InstalledFiles
7
+ _yardoc
8
+ coverage
9
+ doc/
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
@@ -0,0 +1,7 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
+
6
+ ## [0.1.0]
7
+ - initial release
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem dependencies in aws_rds.gemspec
4
+ gemspec
5
+
6
+ gem "codeclimate-test-reporter", group: :test, require: nil
@@ -0,0 +1,121 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ aws-rds (0.0.1)
5
+ activesupport
6
+ aws-sdk-ec2
7
+ aws-sdk-rds
8
+ colorize
9
+ hashie
10
+ thor
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ activesupport (5.1.4)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (~> 0.7)
18
+ minitest (~> 5.1)
19
+ tzinfo (~> 1.1)
20
+ aws-partitions (1.55.0)
21
+ aws-sdk-core (3.14.0)
22
+ aws-partitions (~> 1.0)
23
+ aws-sigv4 (~> 1.0)
24
+ jmespath (~> 1.0)
25
+ aws-sdk-ec2 (1.25.0)
26
+ aws-sdk-core (~> 3)
27
+ aws-sigv4 (~> 1.0)
28
+ aws-sdk-rds (1.11.0)
29
+ aws-sdk-core (~> 3)
30
+ aws-sigv4 (~> 1.0)
31
+ aws-sigv4 (1.0.2)
32
+ byebug (9.1.0)
33
+ celluloid (0.16.0)
34
+ timers (~> 4.0.0)
35
+ codeclimate-test-reporter (0.4.4)
36
+ simplecov (>= 0.7.1, < 1.0.0)
37
+ coderay (1.1.0)
38
+ colorize (0.8.1)
39
+ concurrent-ruby (1.0.5)
40
+ diff-lcs (1.2.5)
41
+ docile (1.1.5)
42
+ ffi (1.9.6)
43
+ formatador (0.2.5)
44
+ guard (2.10.5)
45
+ formatador (>= 0.2.4)
46
+ listen (~> 2.7)
47
+ lumberjack (~> 1.0)
48
+ nenv (~> 0.1)
49
+ pry (>= 0.9.12)
50
+ thor (>= 0.18.1)
51
+ guard-bundler (2.1.0)
52
+ bundler (~> 1.0)
53
+ guard (~> 2.2)
54
+ guard-compat (~> 1.1)
55
+ guard-compat (1.2.0)
56
+ guard-rspec (4.5.0)
57
+ guard (~> 2.1)
58
+ guard-compat (~> 1.1)
59
+ rspec (>= 2.99.0, < 4.0)
60
+ hashie (3.5.7)
61
+ hitimes (1.2.2)
62
+ i18n (0.9.1)
63
+ concurrent-ruby (~> 1.0)
64
+ jmespath (1.3.1)
65
+ listen (2.8.4)
66
+ celluloid (>= 0.15.2)
67
+ rb-fsevent (>= 0.9.3)
68
+ rb-inotify (>= 0.9)
69
+ lumberjack (1.0.9)
70
+ method_source (0.8.2)
71
+ minitest (5.11.1)
72
+ multi_json (1.10.1)
73
+ nenv (0.1.1)
74
+ pry (0.10.1)
75
+ coderay (~> 1.1.0)
76
+ method_source (~> 0.8.1)
77
+ slop (~> 3.4)
78
+ rake (10.4.2)
79
+ rb-fsevent (0.9.4)
80
+ rb-inotify (0.9.5)
81
+ ffi (>= 0.5.0)
82
+ rspec (3.1.0)
83
+ rspec-core (~> 3.1.0)
84
+ rspec-expectations (~> 3.1.0)
85
+ rspec-mocks (~> 3.1.0)
86
+ rspec-core (3.1.7)
87
+ rspec-support (~> 3.1.0)
88
+ rspec-expectations (3.1.2)
89
+ diff-lcs (>= 1.2.0, < 2.0)
90
+ rspec-support (~> 3.1.0)
91
+ rspec-mocks (3.1.3)
92
+ rspec-support (~> 3.1.0)
93
+ rspec-support (3.1.2)
94
+ simplecov (0.9.1)
95
+ docile (~> 1.1.0)
96
+ multi_json (~> 1.0)
97
+ simplecov-html (~> 0.8.0)
98
+ simplecov-html (0.8.0)
99
+ slop (3.6.0)
100
+ thor (0.19.1)
101
+ thread_safe (0.3.6)
102
+ timers (4.0.1)
103
+ hitimes
104
+ tzinfo (1.2.4)
105
+ thread_safe (~> 0.1)
106
+
107
+ PLATFORMS
108
+ ruby
109
+
110
+ DEPENDENCIES
111
+ aws-rds!
112
+ bundler
113
+ byebug
114
+ codeclimate-test-reporter
115
+ guard
116
+ guard-bundler
117
+ guard-rspec
118
+ rake
119
+
120
+ BUNDLED WITH
121
+ 1.16.1
@@ -0,0 +1,19 @@
1
+ guard "bundler", cmd: "bundle" do
2
+ watch("Gemfile")
3
+ watch(/^.+\.gemspec/)
4
+ end
5
+
6
+ guard :rspec, cmd: "bundle exec rspec" do
7
+ require "guard/rspec/dsl"
8
+ dsl = Guard::RSpec::Dsl.new(self)
9
+
10
+ # RSpec files
11
+ rspec = dsl.rspec
12
+ watch(rspec.spec_helper) { rspec.spec_dir }
13
+ watch(rspec.spec_support) { rspec.spec_dir }
14
+ watch(rspec.spec_files)
15
+
16
+ # Ruby files
17
+ ruby = dsl.ruby
18
+ dsl.watch_spec_files_for(ruby.lib_files)
19
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Tung Nguyen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ # AWS RDS Tool
2
+
3
+ Simple tool to create AWS RDS db instances consistently with pre-configured settings. The pre-configured settings are stored in files in the profiles folder of the current directory.
4
+
5
+ For example, say you have:
6
+
7
+ * profiles/default.yml: default settings. Takes the lowest precedence.
8
+ * profiles/mydb.yml: mydb settings get combined with the default settings
9
+
10
+ ## Usage
11
+
12
+ ```sh
13
+ aws-rds create mydb --profile mydb --db-name mydbname
14
+ ```
15
+
16
+ * mydb will be the RDS database identifier show on the AWS console
17
+ * mydbname is the database name that contains the tables
18
+
19
+ In a nutshell, the profile parameters are passed to the ruby aws-sdk [AWS::RDS::Client#create_db_instance](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/RDS/Client.html#create_db_instance-instance_method) method. So you can specify any parameter you wish that is available there.
20
+
21
+ ## config
22
+
23
+ This is where you put common global settings. The required settings are listed below. Example:
24
+
25
+ `config/development.yml`
26
+
27
+ ```yaml
28
+ vpc_id: vpc-123 # falls back to this vpc if not specified in the profile
29
+ db_subnet_group_name: private-subnet-group-name # fallback db_subnet_group_name whe not set
30
+ ```
31
+
32
+ ## Security Group Creation
33
+
34
+ The tool automatically creates a security group and associates it with the newly created db. This is done so that you can use it to control access to the database in finely tune manner. Otherwise, the default security group is associated with the db.
35
+
36
+ ## Convention
37
+
38
+ By convention, the security-group and profile will match the db identifier. So if the db identifier matches the commands the be simplified. Examples:
39
+
40
+ ```
41
+ aws-rds create mydb --security-group-name mydb --profile mydb
42
+ aws-rds create mydb # same as above
43
+ ```
44
+
45
+ ## Installation
46
+
47
+ ```sh
48
+ gem install aws-rds
49
+ ```
50
+
51
+ ## Contributing
52
+
53
+ 1. Fork it
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am "Add some feature"`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ task :default => :spec
5
+
6
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "aws_rds/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "aws-rds"
8
+ spec.version = AwsRds::VERSION
9
+ spec.authors = ["Tung Nguyen"]
10
+ spec.email = ["tongueroo@gmail.com"]
11
+ spec.description = %q{Simple tool to create AWS RDS db instances consistently with pre-configured settings}
12
+ spec.summary = %q{RDS DB creation tool}
13
+ spec.homepage = "https://github.com/tongueroo/aws-rds"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "thor"
23
+ spec.add_dependency "hashie"
24
+ spec.add_dependency "colorize"
25
+ spec.add_dependency "aws-sdk-rds"
26
+ spec.add_dependency "aws-sdk-ec2"
27
+ spec.add_dependency "activesupport"
28
+
29
+ spec.add_development_dependency "bundler"
30
+ spec.add_development_dependency "byebug"
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "rspec"
33
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Trap ^C
4
+ Signal.trap("INT") {
5
+ puts "\nCtrl-C detected. Exiting..."
6
+ sleep 1
7
+ exit
8
+ }
9
+
10
+ $:.unshift(File.expand_path("../../lib", __FILE__))
11
+ require "aws-rds"
12
+ require "aws_rds/cli"
13
+
14
+ AwsRds::CLI.start(ARGV)
@@ -0,0 +1,15 @@
1
+ $:.unshift(File.expand_path("../", __FILE__))
2
+ require "aws_rds/version"
3
+
4
+ module AwsRds
5
+ autoload :Help, "aws_rds/help"
6
+ autoload :Command, "aws_rds/command"
7
+ autoload :CLI, "aws_rds/cli"
8
+ autoload :AwsServices, "aws_rds/aws_services"
9
+ autoload :Create, "aws_rds/create"
10
+ autoload :SecurityGroup, "aws_rds/security_group"
11
+ autoload :Config, "aws_rds/config"
12
+ autoload :Core, "aws_rds/core"
13
+
14
+ extend Core
15
+ end
@@ -0,0 +1,12 @@
1
+ require 'aws-sdk-rds'
2
+ require 'aws-sdk-ec2'
3
+
4
+ module AwsRds::AwsServices
5
+ def rds
6
+ @rds ||= Aws::RDS::Client.new
7
+ end
8
+
9
+ def ec2
10
+ @ec2 ||= Aws::EC2::Client.new
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ module AwsRds
2
+ class CLI < Command
3
+ class_option :verbose, type: :boolean
4
+ class_option :noop, type: :boolean
5
+ class_option :profile, desc: "profile to use"
6
+
7
+ desc "create NAME", "create database"
8
+ long_desc Help.text(:create)
9
+ option :db_name, desc: "database name"
10
+ option :db_user, desc: "database user"
11
+ option :db_password, desc: "database password"
12
+ option :security_group, type: :boolean, default: true, desc: "use separate security group"
13
+ option :security_group_name, desc: "optional. security group name"
14
+ def create(name)
15
+ Create.new(options.merge(name: name)).run
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,25 @@
1
+ require "thor"
2
+
3
+ module AwsRds
4
+ class Command < Thor
5
+ class << self
6
+ def dispatch(m, args, options, config)
7
+ # Allow calling for help via:
8
+ # aws_rds command help
9
+ # aws_rds command -h
10
+ # aws_rds command --help
11
+ # aws_rds command -D
12
+ #
13
+ # as well thor's normal way:
14
+ #
15
+ # aws_rds help command
16
+ help_flags = Thor::HELP_MAPPINGS + ["help"]
17
+ if args.length > 1 && !(args & help_flags).empty?
18
+ args -= help_flags
19
+ args.insert(-2, "help")
20
+ end
21
+ super
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ require 'yaml'
2
+
3
+ module AwsRds
4
+ class Config
5
+ def initialize(path="#{AwsRds.root}/config/#{AwsRds.env}.yml")
6
+ @path = path
7
+ end
8
+
9
+ def settings
10
+ YAML.load_file(@path)
11
+ rescue Errno::ENOENT => e
12
+ puts e.message
13
+ puts "The #{@path} does not exist. Please double check that it exists."
14
+ exit
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ module AwsRds
2
+ module Core
3
+ @@config = nil
4
+ def config
5
+ @@config ||= Config.new.settings
6
+ end
7
+
8
+ def env
9
+ ENV['AWS_RDS_ENV'] || 'development'
10
+ end
11
+
12
+ def root
13
+ ENV['AWS_RDS_ROOT'] || '.'
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,106 @@
1
+ require 'yaml'
2
+ require 'active_support/core_ext/hash'
3
+
4
+ module AwsRds
5
+ class Create
6
+ include AwsServices
7
+
8
+ def initialize(options)
9
+ @options = options
10
+ end
11
+
12
+ def run
13
+ puts "Creating RDS database #{@options[:name]} with the following parameters:"
14
+ pretty_display(params)
15
+ if @options[:noop]
16
+ puts "NOOP mode enabled. RDS instance not created."
17
+ return
18
+ end
19
+
20
+ resp = rds.create_db_instance(params)
21
+ puts "RDS database #{@options[:name]} created! 🎉"
22
+ puts "Visit https://console.aws.amazon.com/rds/home?#dbinstances to check on the status"
23
+ end
24
+
25
+ # params are taken from the profile file
26
+ def params
27
+ params = load_profiles(profile_name)
28
+ params = use_database_cli_options(params)
29
+ params = set_security_groups(params)
30
+ params = set_db_subnet_group(params)
31
+ params.symbolize_keys
32
+ end
33
+
34
+ def set_db_subnet_group(params)
35
+ params["db_subnet_group_name"] ||= AwsRds.config["db_subnet_group_name"]
36
+ params
37
+ end
38
+
39
+ def set_security_groups(params)
40
+ return params unless @options[:security_group]
41
+ return params if @options[:noop]
42
+
43
+ security_group_name = @options[:security_group_name] || @options[:name]
44
+ sg = SecurityGroup.find_or_create(security_group_name)
45
+ params['vpc_security_group_ids'] ||= [sg.group_id]
46
+ params
47
+ end
48
+
49
+ # Be able to set the common database options with the CLI options.
50
+ # Other options can be set with the profile files.
51
+ def use_database_cli_options(params)
52
+ params['db_instance_identifier'] = @options[:name] # required
53
+ params['db_name'] = @options[:db_name] if @options[:db_name]
54
+ params['master_username'] = @options[:db_user] if @options[:db_user]
55
+ params['master_user_password'] = @options[:db_password] if @options[:db_password]
56
+ params
57
+ end
58
+
59
+ def load_profiles(profile_name)
60
+ profile_file = "#{root}/profiles/#{profile_name}.yml"
61
+ base_path = File.dirname(profile_file)
62
+ default_file = "#{base_path}/default.yml"
63
+
64
+ params_exit_check!(profile_file, default_file)
65
+
66
+ defaults = load_profile(default_file)
67
+ params = load_profile(profile_file)
68
+ params = defaults.merge(params)
69
+ end
70
+
71
+ def params_exit_check!(profile_file, default_file)
72
+ return if File.exist?(profile_file) or File.exist?(default_file)
73
+
74
+ puts "Unable to find a #{profile_file} or #{default_file} profile file."
75
+ puts "Please double check."
76
+ exit # EXIT HERE
77
+ end
78
+
79
+ def load_profile(file)
80
+ return {} unless File.exist?(file)
81
+
82
+ puts "Using profile: #{file}"
83
+ data = YAML.load_file(file)
84
+ data ? data : {} # in case the file is empty
85
+ end
86
+
87
+ def profile_name
88
+ # allow user to specify the path also
89
+ if @options[:profile] && File.exist?(@options[:profile])
90
+ profile = File.basename(@options[:profile], '.yml')
91
+ end
92
+
93
+ # conventional profile is the name of the ec2 instance
94
+ profile || @options[:profile] || @options[:name]
95
+ end
96
+
97
+ def root
98
+ ENV['AWS_RDS_ROOT'] || '.'
99
+ end
100
+
101
+ def pretty_display(data)
102
+ data = data.deep_stringify_keys
103
+ puts YAML.dump(data)
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,9 @@
1
+ ---
2
+ allocated_storage: 20
3
+ db_instance_class: db.t2.micro
4
+ db_instance_identifier: my-db
5
+ master_user_password: MyPassword
6
+ master_username: MyUser
7
+ engine: postgres
8
+ # For more help with the available params see:
9
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/RDS/Client.html#create_db_instance-instance_method
@@ -0,0 +1,9 @@
1
+ module AwsRds::Help
2
+ class << self
3
+ def text(namespaced_command)
4
+ path = namespaced_command.to_s.gsub(':','/')
5
+ path = File.expand_path("../help/#{path}.md", __FILE__)
6
+ IO.read(path) if File.exist?(path)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ The create command creates an RDS database with a profile file with some pre-configured parameters in the profiles folder. If a profile does not exist, it will only use the `profiles/default.yml` parameters. If a profile exists then it will merged specified profile with the default profile.
2
+
3
+ For example, say you have:
4
+
5
+ * profiles/default.yml
6
+ * profiles/my-db.yml
7
+
8
+ Then `my-db.yml` gets combined with `default.yml` profile. The `default.yml` takes the lowest precedence.
9
+
10
+ Examples:
11
+
12
+ $ aws-rds create my-db --profile my-db
13
+
14
+ By convention, the profile is name of the db. So the command above can be shortened to:
15
+
16
+ $ aws-rds create my-db
17
+
18
+ Security Groups:
19
+
20
+ By default, instead of using the default security group, a new security group is created and associated with the database.
21
+
22
+ This security group is named the same as the database name by convention. This can be overridden at with `--security-group-name`. If the security group already exists, it will use the existing security group that matches the name.
23
+
24
+ If you do not want to specify the security group name every time, you can configure the security group id in the profile file by setting vpc_security_group_ids.
@@ -0,0 +1,35 @@
1
+ require "byebug"
2
+
3
+ module AwsRds
4
+ class SecurityGroup
5
+ include AwsServices
6
+
7
+ # Returns Aws::EC2::Types::SecurityGroup
8
+ def find_or_create(name)
9
+ resp = ec2.describe_security_groups(
10
+ filters: [
11
+ {name: 'vpc-id', values: [AwsRds.config["vpc_id"]]},
12
+ {name: 'group-name', values: [name]}]
13
+ )
14
+ sg = resp.security_groups.first
15
+ return sg if sg
16
+
17
+ puts "Creating security group #{name}"
18
+ result = ec2.create_security_group(
19
+ group_name: name,
20
+ description: name,
21
+ vpc_id: AwsRds.config["vpc_id"],
22
+ )
23
+ ec2.create_tags(
24
+ resources: [result.group_id],
25
+ tags: [{ key: "Name", value: name }],
26
+ )
27
+ resp = ec2.describe_security_groups(group_ids: [result.group_id])
28
+ resp.security_groups.first
29
+ end
30
+
31
+ def self.find_or_create(name)
32
+ new.find_or_create(name)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ module AwsRds
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,19 @@
1
+ require "spec_helper"
2
+
3
+ # to run specs with what"s remembered from vcr
4
+ # $ rake
5
+ #
6
+ # to run specs with new fresh data from aws api calls
7
+ # $ rake clean:vcr ; time rake
8
+ describe AwsRds::CLI do
9
+ before(:all) do
10
+ @args = "--from Tung"
11
+ end
12
+
13
+ describe "aws-rds" do
14
+ it "should hello world" do
15
+ out = execute("exe/aws-rds hello world #{@args}")
16
+ expect(out).to include("from: Tung\nHello world")
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ ENV["TEST"] = "1"
2
+
3
+ # require "simplecov"
4
+ # SimpleCov.start
5
+
6
+ require "pp"
7
+
8
+ root = File.expand_path("../../", __FILE__)
9
+ require "#{root}/lib/aws-rds"
10
+
11
+ module Helpers
12
+ def execute(cmd)
13
+ puts "Running: #{cmd}" if ENV["DEBUG"]
14
+ out = `#{cmd}`
15
+ puts out if ENV["DEBUG"]
16
+ out
17
+ end
18
+ end
19
+
20
+ RSpec.configure do |c|
21
+ c.include Helpers
22
+ end
metadata ADDED
@@ -0,0 +1,213 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aws-rds
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tung Nguyen
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-01-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashie
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: colorize
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: aws-sdk-rds
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: aws-sdk-ec2
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activesupport
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: byebug
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Simple tool to create AWS RDS db instances consistently with pre-configured
154
+ settings
155
+ email:
156
+ - tongueroo@gmail.com
157
+ executables:
158
+ - aws-rds
159
+ extensions: []
160
+ extra_rdoc_files: []
161
+ files:
162
+ - ".gitignore"
163
+ - ".rspec"
164
+ - CHANGELOG.md
165
+ - Gemfile
166
+ - Gemfile.lock
167
+ - Guardfile
168
+ - LICENSE.txt
169
+ - README.md
170
+ - Rakefile
171
+ - aws-rds.gemspec
172
+ - exe/aws-rds
173
+ - lib/aws-rds.rb
174
+ - lib/aws_rds/aws_services.rb
175
+ - lib/aws_rds/cli.rb
176
+ - lib/aws_rds/command.rb
177
+ - lib/aws_rds/config.rb
178
+ - lib/aws_rds/core.rb
179
+ - lib/aws_rds/create.rb
180
+ - lib/aws_rds/default.yml
181
+ - lib/aws_rds/help.rb
182
+ - lib/aws_rds/help/create.md
183
+ - lib/aws_rds/security_group.rb
184
+ - lib/aws_rds/version.rb
185
+ - spec/lib/cli_spec.rb
186
+ - spec/spec_helper.rb
187
+ homepage: https://github.com/tongueroo/aws-rds
188
+ licenses:
189
+ - MIT
190
+ metadata: {}
191
+ post_install_message:
192
+ rdoc_options: []
193
+ require_paths:
194
+ - lib
195
+ required_ruby_version: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ required_rubygems_version: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ requirements: []
206
+ rubyforge_project:
207
+ rubygems_version: 2.7.3
208
+ signing_key:
209
+ specification_version: 4
210
+ summary: RDS DB creation tool
211
+ test_files:
212
+ - spec/lib/cli_spec.rb
213
+ - spec/spec_helper.rb