@@ -24,7 +24,7 @@ def get_instance(db_instance_identifier)
2424 def does_db_exist? ( db_instance_identifier )
2525 get_instance ( db_instance_identifier ) . instance_create_time
2626 true
27- rescue Aws :: RDS :: Errors :: DBInstanceNotFound
27+ rescue
2828 false
2929 end
3030
@@ -46,6 +46,32 @@ def delete_db_instance(db_instance_identifier, db_snapshot_identifier = nil)
4646 end
4747 end
4848
49+ # Modify the security groups for a RDS instance
50+ # @param db_instance_identifier [String] RDS instance identifier
51+ # @param vpc_security_group_ids [Array] Array of security groups to apply
52+ # @return [Hash] Hash represnting the return from AWS
53+ def modify_security_group ( db_instance_identifier , vpc_security_groups )
54+ modify_db_instance ( db_instance_identifier : db_instance_identifier , vpc_security_group_ids : vpc_security_groups )
55+ end
56+
57+ # Modify the options group for a RDS instance
58+ # @param db_instance_identifier [String] RDS instance identifier
59+ # @param option_group_name [Sting] Name od the options group to apply
60+ # @return [Hash] Hash represnting the return from AWS
61+ def modify_option_group ( db_instance_identifier , option_group_name )
62+ modify_db_instance ( db_instance_identifier : db_instance_identifier , option_group_name : option_group_name )
63+ end
64+
65+ # Base function to modify DB, resets defualts for apply_immediately and copy_tags_to_snapshot
66+ # @param options [hash] Hash represnting the configuration for the RDS restore
67+ # @return [Hash] Hash represnting the return from AWS
68+ def modify_db_instance ( options )
69+ options [ :apply_immediately ] = options [ :apply_immediately ] . nil? ? true : options [ :apply_immediately ]
70+ options [ :copy_tags_to_snapshot ] = options [ :copy_tags_to_snapshot ] . nil? ? true : options [ :copy_tags_to_snapshot ]
71+
72+ @rds . modify_db_instance ( options )
73+ end
74+
4975 # Restore DB from a snapshot
5076 # @param db_instance_identifier [String] RDS instance identifier
5177 # @param db_snapshot_identifier [String] Name for final snapshot, default is nil
@@ -57,6 +83,7 @@ def restore_db(db_instance_identifier, restore_from, options = {})
5783 options [ :db_instance_identifier ] = db_instance_identifier
5884 options [ :db_snapshot_identifier ] = db_snapshot_identifier
5985 @rds . restore_db_instance_from_db_snapshot ( options )
86+ @rds . wait_until ( :db_instance_deleted , db_instance_identifier : db_instance_identifier )
6087 end
6188
6289 # Delete a givne db instance
0 commit comments