lib/rds/right_rds_interface.rb
# Create a new RDS instance of the type and size specified by you. The default storage engine for RDS Instances is InnoDB.
#
# Mandatory arguments: +aws_id+, +master_username+, +master_user_password+
# Optional params: +:allocated_storage+ (25 by def), +:instance_class+, +:engine+ ('MySQL' by def),
# +:endpoint_port+, +:db_name+, +:db_security_groups+, +:db_parameter_group+,  +:availability_zone+, +:preferred_maintenance_window+
# +:backup_retention_period+, +:preferred_backup_window+, +:multi_az+, +:engine_version+, +:auto_minor_version_upgrade+,
# +:license_model+, +:iops+, +:db_subnet_group_name+, +:character_set_name+, +:option_group_name+
#
#   rds.create_db_instance('kd-delete-me-01', 'username', 'password',
#                           :instance_class    => 'db.m1.small',
#                           :multi_az          => true,
#                           :auto_minor_version_upgrade => false ) #=>
#    {:instance_class=>"db.m1.small",
#      :multi_az=>true,
#      :status=>"creating",
#      :backup_retention_period=>1,
#      :read_replica_db_instance_identifiers=>[],
#      :master_username=>"username",
#      :preferred_maintenance_window=>"sun:05:00-sun:09:00",
#      :auto_minor_version_upgrade=>false,
#      :db_parameter_group=>{:status=>"in-sync", :name=>"default.mysql5.1"},
#      :engine=>"mysql",
#      :allocated_storage=>25,
#      :aws_id=>"kd-delete-me-01",
#      :preferred_backup_window=>"03:00-05:00",
#      :engine_version=>"5.1.50",
#      :pending_modified_values=>{:master_user_password=>"****"},
#      :db_security_groups=>[{:status=>"active", :name=>"default"}]}
#
Create a new RDS instance of the type and size specified by you. The default storage engine for RDS Instances is InnoDB.


Create a new RDS instance of the type and size specified by you . The default storage engine for RDS Instances is InnoDB .
def create_db_instance(aws_id, master_username, master_user_password, params={})
      request_hash = {}
      request_hash['DBInstanceIdentifier'] = aws_id
      request_hash['MasterUsername']       = master_username
      request_hash['MasterUserPassword']   = master_user_password
       with default values
      request_hash['DBInstanceClass']            = params[:instance_class].right_blank?    ? DEFAULT_INSTANCE_CLASS : params[:instance_class].to_s
      request_hash['AllocatedStorage']           = params[:allocated_storage].right_blank? ? 25                     : params[:allocated_storage]
      request_hash['Engine']                     = params[:engine].right_blank?            ? 'mysql'                : params[:engine]
      request_hash['Port']                       = params[:endpoint_port]                   unless params[:endpoint_port].right_blank?
      request_hash['DBName']                     = params[:db_name]                         unless params[:db_name].right_blank?
      request_hash['AvailabilityZone']           = params[:availability_zone]               unless params[:availability_zone].right_blank?
      request_hash['MultiAZ']                    = params[:multi_az].to_s                   unless params[:multi_az].nil?
      request_hash['PreferredMaintenanceWindow'] = params[:preferred_maintenance_window]    unless params[:preferred_maintenance_window].right_blank?
      request_hash['BackupRetentionPeriod']      = params[:backup_retention_period]         unless params[:backup_retention_period].right_blank?
      request_hash['PreferredBackupWindow']      = params[:preferred_backup_window]         unless params[:preferred_backup_window].right_blank?
      request_hash['DBParameterGroupName']       = params[:db_parameter_group]              unless params[:db_parameter_group].right_blank?
      request_hash['EngineVersion']              = params[:engine_version]                  unless params[:engine_version].right_blank?
      request_hash['AutoMinorVersionUpgrade']    = params[:auto_minor_version_upgrade].to_s unless params[:auto_minor_version_upgrade].nil?
      request_hash['LicenseModel']               = params[:license_model]                   unless params[:license_model].right_blank?
      request_hash['CharacterSetName']           = params[:character_set_name]              unless params[:character_set_name].right_blank?
      request_hash['DBSubnetGroupName']          = params[:db_subnet_group_name]            unless params[:db_subnet_group_name].right_blank?
      request_hash['Iops']                       = params[:iops]                            unless params[:iops].right_blank?
      request_hash['OptionGroupName']            = params[:option_group_name]               unless params[:option_group_name].right_blank?
      request_hash.merge!(amazonize_list('DBSecurityGroups.member',  params[:db_security_groups]))
      link = generate_request('CreateDBInstance', request_hash)
      request_info(link, DescribeDbInstancesParser.new(:logger => @logger))[:db_instances].first
    end
def create_db_instance ( aws_id , master_username , master_user_password , params = { } ) request_hash = { } request_hash [ 'DBInstanceIdentifier' ] = aws_id request_hash [ 'MasterUsername' ] = master_username request_hash [ 'MasterUserPassword' ] = master_user_password request_hash [ 'DBInstanceClass' ] = params [ :instance_class ] . right_blank? ? DEFAULT_INSTANCE_CLASS : params [ :instance_class ] . to_s request_hash [ 'AllocatedStorage' ] = params [ :allocated_storage ] . right_blank? ? 25 : params [ :allocated_storage ] request_hash [ 'Engine' ] = params [ :engine ] . right_blank? ? 'mysql' : params [ :engine ] request_hash [ 'Port' ] = params [ :endpoint_port ] unless params [ :endpoint_port ] . right_blank? request_hash [ 'DBName' ] = params [ :db_name ] unless params [ :db_name ] . right_blank? request_hash [ 'AvailabilityZone' ] = params [ :availability_zone ] unless params [ :availability_zone ] . right_blank? request_hash [ 'MultiAZ' ] = params [ :multi_az ] . to_s unless params [ :multi_az ] . nil? request_hash [ 'PreferredMaintenanceWindow' ] = params [ :preferred_maintenance_window ] unless params [ :preferred_maintenance_window ] . right_blank? request_hash [ 'BackupRetentionPeriod' ] = params [ :backup_retention_period ] unless params [ :backup_retention_period ] . right_blank? request_hash [ 'PreferredBackupWindow' ] = params [ :preferred_backup_window ] unless params [ :preferred_backup_window ] . right_blank? request_hash [ 'DBParameterGroupName' ] = params [ :db_parameter_group ] unless params [ :db_parameter_group ] . right_blank? request_hash [ 'EngineVersion' ] = params [ :engine_version ] unless params [ :engine_version ] . right_blank? request_hash [ 'AutoMinorVersionUpgrade' ] = params [ :auto_minor_version_upgrade ] . to_s unless params [ :auto_minor_version_upgrade ] . nil? request_hash [ 'LicenseModel' ] = params [ :license_model ] unless params [ :license_model ] . right_blank? request_hash [ 'CharacterSetName' ] = params [ :character_set_name ] unless params [ :character_set_name ] . right_blank? request_hash [ 'DBSubnetGroupName' ] = params [ :db_subnet_group_name ] unless params [ :db_subnet_group_name ] . right_blank? request_hash [ 'Iops' ] = params [ :iops ] unless params [ :iops ] . right_blank? request_hash [ 'OptionGroupName' ] = params [ :option_group_name ] unless params [ :option_group_name ] . right_blank? request_hash . merge! ( amazonize_list ( 'DBSecurityGroups.member' , params [ :db_security_groups ] ) ) link = generate_request ( 'CreateDBInstance' , request_hash ) request_info ( link , DescribeDbInstancesParser . new ( :logger => @logger ) ) [ :db_instances ] . first end
Create a new RDS instance of the type and size specified by you.
Create a new RDS instance of the type and size specified by you .
# Mandatory # Mandatory with default values # Optional
aws_id
<not_specific>
master_username
<not_specific>
master_user_password
<not_specific>
params
<not_specific>