cfn_manage 0.2.5 → 0.2.7
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.
- checksums.yaml +4 -4
- data/lib/rds_start_stop_handler.rb +2 -2
- metadata +3 -4
- data/lib/dynamodb_start_stop_handler.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7819e8e194008b4957fc32b3cc6d0edf3ac11104
|
4
|
+
data.tar.gz: f1bf8e22cfa7b556fbd64fed45edb0d7ad99606a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99f8e91118aa0ce5225e4906df71176201f580e2910edc815ff5472dfd7f8cf8e7806038e8f6178b4451c34305be8193589c464f90a236f4a9430788f27811f6
|
7
|
+
data.tar.gz: 9fe7809595bcf2249bfea75cb1ad62e811079e7f2a6e2e4f191c5470a42470de9280a3997dc21ff770a7872ee78ced64545f4f6168314de36831d1f0aae8a61e
|
@@ -38,7 +38,7 @@ module Base2
|
|
38
38
|
if configuration['is_multi_az']
|
39
39
|
$log.info("Converting to Multi-AZ instance after start (instance #{@instance_id})")
|
40
40
|
set_rds_instance_multi_az( true)
|
41
|
-
end
|
41
|
+
end unless configuration.nil?
|
42
42
|
end
|
43
43
|
|
44
44
|
def stop
|
@@ -48,7 +48,7 @@ module Base2
|
|
48
48
|
}
|
49
49
|
# RDS stop start does not support Aurora yet. Ignore if engine is aurora
|
50
50
|
if @rds_instance.engine == 'aurora'
|
51
|
-
$log.info("RDS Instance #{instance_id} engine is aurora and cannot be stoped yet...")
|
51
|
+
$log.info("RDS Instance #{@instance_id} engine is aurora and cannot be stoped yet...")
|
52
52
|
return configuration
|
53
53
|
end
|
54
54
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfn_manage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Base2Services
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -47,7 +47,6 @@ files:
|
|
47
47
|
- lib/cf_common.rb
|
48
48
|
- lib/cf_progress_tracker.rb
|
49
49
|
- lib/cf_start_stop_environment.rb
|
50
|
-
- lib/dynamodb_start_stop_handler.rb
|
51
50
|
- lib/ec2_start_stop_handler.rb
|
52
51
|
- lib/rds_start_stop_handler.rb
|
53
52
|
- lib/start_stop_handler_factory.rb
|
@@ -71,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
70
|
version: '0'
|
72
71
|
requirements: []
|
73
72
|
rubyforge_project:
|
74
|
-
rubygems_version: 2.6.
|
73
|
+
rubygems_version: 2.6.8
|
75
74
|
signing_key:
|
76
75
|
specification_version: 4
|
77
76
|
summary: Manage AWS Cloud Formation stacks
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require_relative '../lib/aws_credentials'
|
2
|
-
|
3
|
-
module Base2
|
4
|
-
|
5
|
-
class DynamoDbStartStopHandler
|
6
|
-
|
7
|
-
@table
|
8
|
-
@table_name
|
9
|
-
@gsi_names
|
10
|
-
|
11
|
-
def initialize(table_name)
|
12
|
-
credentials = Base2::AWSCredentials.get_session_credentials("stoprun_#{instance_id}")
|
13
|
-
ec2_client = Aws::DynamoDB::Client.new(credentials: credentials)
|
14
|
-
@table = Aws::DynamoDB::Resource.new(client: ec2_client).table(table_name)
|
15
|
-
@table_name = table_name
|
16
|
-
@table.global_secondary_indexes.each do |gsi|
|
17
|
-
@gsi_names << gsi.index_name
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def start(configuration)
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
def stop
|
26
|
-
configuration = {
|
27
|
-
read_capacity: @table.provisioned_throughput.read_capacity_units,
|
28
|
-
write_capacity: @table.provisioned_throughput.write_capacity_units
|
29
|
-
}
|
30
|
-
|
31
|
-
$log.info("Current dynamo table #{@table.name} capacity: #{configuration}")
|
32
|
-
|
33
|
-
# check if environment vairable set for
|
34
|
-
if ENV.key? ('cfn_manage_dynamodb_stop_capacity')
|
35
|
-
stop_capacity = ENV['cfn_manage_dynamodb_stop_capacity'].to_i
|
36
|
-
|
37
|
-
$log.info("Downsizing read/write capacity to #{stop_capacity}")
|
38
|
-
@table.update({
|
39
|
-
provisioned_throughput: {
|
40
|
-
read_capacity_units: stop_capacity, # required
|
41
|
-
write_capacity_units: stop_capacity, # required
|
42
|
-
}
|
43
|
-
})
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
configuration
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|