1 # Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved 2 # 3 # Permission is hereby granted, free of charge, to any person obtaining a 4 # copy of this software and associated documentation files (the 5 # "Software"), to deal in the Software without restriction, including 6 # without limitation the rights to use, copy, modify, merge, publish, dis- 7 # tribute, sublicense, and/or sell copies of the Software, and to permit 8 # persons to whom the Software is furnished to do so, subject to the fol- 9 # lowing conditions: 10 # 11 # The above copyright notice and this permission notice shall be included 12 # in all copies or substantial portions of the Software. 13 # 14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 # IN THE SOFTWARE. 21 # 22 23 import boto 24 from boto.connection import AWSQueryConnection 25 from boto.regioninfo import RegionInfo 26 from boto.exception import JSONResponseError 27 from boto.rds2 import exceptions 28 from boto.compat import json 29 30 31 class RDSConnection(AWSQueryConnection): 32 """ 33 Amazon Relational Database Service 34 Amazon Relational Database Service (Amazon RDS) is a web service 35 that makes it easier to set up, operate, and scale a relational 36 database in the cloud. It provides cost-efficient, resizable 37 capacity for an industry-standard relational database and manages 38 common database administration tasks, freeing up developers to 39 focus on what makes their applications and businesses unique. 40 41 Amazon RDS gives you access to the capabilities of a familiar 42 MySQL or Oracle database server. This means the code, 43 applications, and tools you already use today with your existing 44 MySQL or Oracle databases work with Amazon RDS without 45 modification. Amazon RDS automatically backs up your database and 46 maintains the database software that powers your DB instance. 47 Amazon RDS is flexible: you can scale your database instance's 48 compute resources and storage capacity to meet your application's 49 demand. As with all Amazon Web Services, there are no up-front 50 investments, and you pay only for the resources you use. 51 52 This is the Amazon RDS API Reference . It contains a comprehensive 53 description of all Amazon RDS Query APIs and data types. Note that 54 this API is asynchronous and some actions may require polling to 55 determine when an action has been applied. See the parameter 56 description to determine if a change is applied immediately or on 57 the next instance reboot or during the maintenance window. For 58 more information on Amazon RDS concepts and usage scenarios, go to 59 the `Amazon RDS User Guide`_. 60 """ 61 APIVersion = "2013-09-09" 62 DefaultRegionName = "us-east-1" 63 DefaultRegionEndpoint = "rds.us-east-1.amazonaws.com" 64 ResponseError = JSONResponseError 65 66 _faults = { 67 "InvalidSubnet": exceptions.InvalidSubnet, 68 "DBParameterGroupQuotaExceeded": exceptions.DBParameterGroupQuotaExceeded, 69 "DBSubnetGroupAlreadyExists": exceptions.DBSubnetGroupAlreadyExists, 70 "DBSubnetGroupQuotaExceeded": exceptions.DBSubnetGroupQuotaExceeded, 71 "InstanceQuotaExceeded": exceptions.InstanceQuotaExceeded, 72 "InvalidRestore": exceptions.InvalidRestore, 73 "InvalidDBParameterGroupState": exceptions.InvalidDBParameterGroupState, 74 "AuthorizationQuotaExceeded": exceptions.AuthorizationQuotaExceeded, 75 "DBSecurityGroupAlreadyExists": exceptions.DBSecurityGroupAlreadyExists, 76 "InsufficientDBInstanceCapacity": exceptions.InsufficientDBInstanceCapacity, 77 "ReservedDBInstanceQuotaExceeded": exceptions.ReservedDBInstanceQuotaExceeded, 78 "DBSecurityGroupNotFound": exceptions.DBSecurityGroupNotFound, 79 "DBInstanceAlreadyExists": exceptions.DBInstanceAlreadyExists, 80 "ReservedDBInstanceNotFound": exceptions.ReservedDBInstanceNotFound, 81 "DBSubnetGroupDoesNotCoverEnoughAZs": exceptions.DBSubnetGroupDoesNotCoverEnoughAZs, 82 "InvalidDBSecurityGroupState": exceptions.InvalidDBSecurityGroupState, 83 "InvalidVPCNetworkState": exceptions.InvalidVPCNetworkState, 84 "ReservedDBInstancesOfferingNotFound": exceptions.ReservedDBInstancesOfferingNotFound, 85 "SNSTopicArnNotFound": exceptions.SNSTopicArnNotFound, 86 "SNSNoAuthorization": exceptions.SNSNoAuthorization, 87 "SnapshotQuotaExceeded": exceptions.SnapshotQuotaExceeded, 88 "OptionGroupQuotaExceeded": exceptions.OptionGroupQuotaExceeded, 89 "DBParameterGroupNotFound": exceptions.DBParameterGroupNotFound, 90 "SNSInvalidTopic": exceptions.SNSInvalidTopic, 91 "InvalidDBSubnetGroupState": exceptions.InvalidDBSubnetGroupState, 92 "DBSubnetGroupNotFound": exceptions.DBSubnetGroupNotFound, 93 "InvalidOptionGroupState": exceptions.InvalidOptionGroupState, 94 "SourceNotFound": exceptions.SourceNotFound, 95 "SubscriptionCategoryNotFound": exceptions.SubscriptionCategoryNotFound, 96 "EventSubscriptionQuotaExceeded": exceptions.EventSubscriptionQuotaExceeded, 97 "DBSecurityGroupNotSupported": exceptions.DBSecurityGroupNotSupported, 98 "InvalidEventSubscriptionState": exceptions.InvalidEventSubscriptionState, 99 "InvalidDBSubnetState": exceptions.InvalidDBSubnetState, 100 "InvalidDBSnapshotState": exceptions.InvalidDBSnapshotState, 101 "SubscriptionAlreadyExist": exceptions.SubscriptionAlreadyExist, 102 "DBSecurityGroupQuotaExceeded": exceptions.DBSecurityGroupQuotaExceeded, 103 "ProvisionedIopsNotAvailableInAZ": exceptions.ProvisionedIopsNotAvailableInAZ, 104 "AuthorizationNotFound": exceptions.AuthorizationNotFound, 105 "OptionGroupAlreadyExists": exceptions.OptionGroupAlreadyExists, 106 "SubscriptionNotFound": exceptions.SubscriptionNotFound, 107 "DBUpgradeDependencyFailure": exceptions.DBUpgradeDependencyFailure, 108 "PointInTimeRestoreNotEnabled": exceptions.PointInTimeRestoreNotEnabled, 109 "AuthorizationAlreadyExists": exceptions.AuthorizationAlreadyExists, 110 "DBSubnetQuotaExceeded": exceptions.DBSubnetQuotaExceeded, 111 "OptionGroupNotFound": exceptions.OptionGroupNotFound, 112 "DBParameterGroupAlreadyExists": exceptions.DBParameterGroupAlreadyExists, 113 "DBInstanceNotFound": exceptions.DBInstanceNotFound, 114 "ReservedDBInstanceAlreadyExists": exceptions.ReservedDBInstanceAlreadyExists, 115 "InvalidDBInstanceState": exceptions.InvalidDBInstanceState, 116 "DBSnapshotNotFound": exceptions.DBSnapshotNotFound, 117 "DBSnapshotAlreadyExists": exceptions.DBSnapshotAlreadyExists, 118 "StorageQuotaExceeded": exceptions.StorageQuotaExceeded, 119 "SubnetAlreadyInUse": exceptions.SubnetAlreadyInUse, 120 } 121 122 123 def __init__(self, **kwargs): 124 region = kwargs.pop('region', None) 125 if not region: 126 region = RegionInfo(self, self.DefaultRegionName, 127 self.DefaultRegionEndpoint) 128 129 if 'host' not in kwargs: 130 kwargs['host'] = region.endpoint 131 132 super(RDSConnection, self).__init__(**kwargs) 133 self.region = region 134 135 def _required_auth_capability(self): 136 return ['hmac-v4'] 137 138 def add_source_identifier_to_subscription(self, subscription_name, 139 source_identifier): 140 """ 141 Adds a source identifier to an existing RDS event notification 142 subscription. 143 144 :type subscription_name: string 145 :param subscription_name: The name of the RDS event notification 146 subscription you want to add a source identifier to. 147 148 :type source_identifier: string 149 :param source_identifier: 150 The identifier of the event source to be added. An identifier must 151 begin with a letter and must contain only ASCII letters, digits, 152 and hyphens; it cannot end with a hyphen or contain two consecutive 153 hyphens. 154 155 Constraints: 156 157 158 + If the source type is a DB instance, then a `DBInstanceIdentifier` 159 must be supplied. 160 + If the source type is a DB security group, a `DBSecurityGroupName` 161 must be supplied. 162 + If the source type is a DB parameter group, a `DBParameterGroupName` 163 must be supplied. 164 + If the source type is a DB snapshot, a `DBSnapshotIdentifier` must be 165 supplied. 166 167 """ 168 params = { 169 'SubscriptionName': subscription_name, 170 'SourceIdentifier': source_identifier, 171 } 172 return self._make_request( 173 action='AddSourceIdentifierToSubscription', 174 verb='POST', 175 path='/', params=params) 176 177 def add_tags_to_resource(self, resource_name, tags): 178 """ 179 Adds metadata tags to an Amazon RDS resource. These tags can 180 also be used with cost allocation reporting to track cost 181 associated with Amazon RDS resources, or used in Condition 182 statement in IAM policy for Amazon RDS. 183 184 For an overview on tagging Amazon RDS resources, see `Tagging 185 Amazon RDS Resources`_. 186 187 :type resource_name: string 188 :param resource_name: The Amazon RDS resource the tags will be added 189 to. This value is an Amazon Resource Name (ARN). For information 190 about creating an ARN, see ` Constructing an RDS Amazon Resource 191 Name (ARN)`_. 192 193 :type tags: list 194 :param tags: The tags to be assigned to the Amazon RDS resource. 195 196 """ 197 params = {'ResourceName': resource_name, } 198 self.build_complex_list_params( 199 params, tags, 200 'Tags.member', 201 ('Key', 'Value')) 202 return self._make_request( 203 action='AddTagsToResource', 204 verb='POST', 205 path='/', params=params) 206 207 def authorize_db_security_group_ingress(self, db_security_group_name, 208 cidrip=None, 209 ec2_security_group_name=None, 210 ec2_security_group_id=None, 211 ec2_security_group_owner_id=None): 212 """ 213 Enables ingress to a DBSecurityGroup using one of two forms of 214 authorization. First, EC2 or VPC security groups can be added 215 to the DBSecurityGroup if the application using the database 216 is running on EC2 or VPC instances. Second, IP ranges are 217 available if the application accessing your database is 218 running on the Internet. Required parameters for this API are 219 one of CIDR range, EC2SecurityGroupId for VPC, or 220 (EC2SecurityGroupOwnerId and either EC2SecurityGroupName or 221 EC2SecurityGroupId for non-VPC). 222 You cannot authorize ingress from an EC2 security group in one 223 Region to an Amazon RDS DB instance in another. You cannot 224 authorize ingress from a VPC security group in one VPC to an 225 Amazon RDS DB instance in another. 226 For an overview of CIDR ranges, go to the `Wikipedia 227 Tutorial`_. 228 229 :type db_security_group_name: string 230 :param db_security_group_name: The name of the DB security group to add 231 authorization to. 232 233 :type cidrip: string 234 :param cidrip: The IP range to authorize. 235 236 :type ec2_security_group_name: string 237 :param ec2_security_group_name: Name of the EC2 security group to 238 authorize. For VPC DB security groups, `EC2SecurityGroupId` must be 239 provided. Otherwise, EC2SecurityGroupOwnerId and either 240 `EC2SecurityGroupName` or `EC2SecurityGroupId` must be provided. 241 242 :type ec2_security_group_id: string 243 :param ec2_security_group_id: Id of the EC2 security group to 244 authorize. For VPC DB security groups, `EC2SecurityGroupId` must be 245 provided. Otherwise, EC2SecurityGroupOwnerId and either 246 `EC2SecurityGroupName` or `EC2SecurityGroupId` must be provided. 247 248 :type ec2_security_group_owner_id: string 249 :param ec2_security_group_owner_id: AWS Account Number of the owner of 250 the EC2 security group specified in the EC2SecurityGroupName 251 parameter. The AWS Access Key ID is not an acceptable value. For 252 VPC DB security groups, `EC2SecurityGroupId` must be provided. 253 Otherwise, EC2SecurityGroupOwnerId and either 254 `EC2SecurityGroupName` or `EC2SecurityGroupId` must be provided. 255 256 """ 257 params = {'DBSecurityGroupName': db_security_group_name, } 258 if cidrip is not None: 259 params['CIDRIP'] = cidrip 260 if ec2_security_group_name is not None: 261 params['EC2SecurityGroupName'] = ec2_security_group_name 262 if ec2_security_group_id is not None: 263 params['EC2SecurityGroupId'] = ec2_security_group_id 264 if ec2_security_group_owner_id is not None: 265 params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id 266 return self._make_request( 267 action='AuthorizeDBSecurityGroupIngress', 268 verb='POST', 269 path='/', params=params) 270 271 def copy_db_snapshot(self, source_db_snapshot_identifier, 272 target_db_snapshot_identifier, tags=None): 273 """ 274 Copies the specified DBSnapshot. The source DBSnapshot must be 275 in the "available" state. 276 277 :type source_db_snapshot_identifier: string 278 :param source_db_snapshot_identifier: The identifier for the source DB 279 snapshot. 280 Constraints: 281 282 283 + Must be the identifier for a valid system snapshot in the "available" 284 state. 285 286 287 Example: `rds:mydb-2012-04-02-00-01` 288 289 :type target_db_snapshot_identifier: string 290 :param target_db_snapshot_identifier: The identifier for the copied 291 snapshot. 292 Constraints: 293 294 295 + Cannot be null, empty, or blank 296 + Must contain from 1 to 255 alphanumeric characters or hyphens 297 + First character must be a letter 298 + Cannot end with a hyphen or contain two consecutive hyphens 299 300 301 Example: `my-db-snapshot` 302 303 :type tags: list 304 :param tags: A list of tags. 305 306 """ 307 params = { 308 'SourceDBSnapshotIdentifier': source_db_snapshot_identifier, 309 'TargetDBSnapshotIdentifier': target_db_snapshot_identifier, 310 } 311 if tags is not None: 312 self.build_complex_list_params( 313 params, tags, 314 'Tags.member', 315 ('Key', 'Value')) 316 return self._make_request( 317 action='CopyDBSnapshot', 318 verb='POST', 319 path='/', params=params) 320 321 def create_db_instance(self, db_instance_identifier, allocated_storage, 322 db_instance_class, engine, master_username, 323 master_user_password, db_name=None, 324 db_security_groups=None, 325 vpc_security_group_ids=None, 326 availability_zone=None, db_subnet_group_name=None, 327 preferred_maintenance_window=None, 328 db_parameter_group_name=None, 329 backup_retention_period=None, 330 preferred_backup_window=None, port=None, 331 multi_az=None, engine_version=None, 332 auto_minor_version_upgrade=None, 333 license_model=None, iops=None, 334 option_group_name=None, character_set_name=None, 335 publicly_accessible=None, tags=None): 336 """ 337 Creates a new DB instance. 338 339 :type db_name: string 340 :param db_name: The meaning of this parameter differs according to the 341 database engine you use. 342 **MySQL** 343 344 The name of the database to create when the DB instance is created. If 345 this parameter is not specified, no database is created in the DB 346 instance. 347 348 Constraints: 349 350 351 + Must contain 1 to 64 alphanumeric characters 352 + Cannot be a word reserved by the specified database engine 353 354 355 Type: String 356 357 **Oracle** 358 359 The Oracle System ID (SID) of the created DB instance. 360 361 Default: `ORCL` 362 363 Constraints: 364 365 366 + Cannot be longer than 8 characters 367 368 369 **SQL Server** 370 371 Not applicable. Must be null. 372 373 :type db_instance_identifier: string 374 :param db_instance_identifier: The DB instance identifier. This 375 parameter is stored as a lowercase string. 376 Constraints: 377 378 379 + Must contain from 1 to 63 alphanumeric characters or hyphens (1 to 15 380 for SQL Server). 381 + First character must be a letter. 382 + Cannot end with a hyphen or contain two consecutive hyphens. 383 384 385 Example: `mydbinstance` 386 387 :type allocated_storage: integer 388 :param allocated_storage: The amount of storage (in gigabytes) to be 389 initially allocated for the database instance. 390 **MySQL** 391 392 Constraints: Must be an integer from 5 to 1024. 393 394 Type: Integer 395 396 **Oracle** 397 398 Constraints: Must be an integer from 10 to 1024. 399 400 **SQL Server** 401 402 Constraints: Must be an integer from 200 to 1024 (Standard Edition and 403 Enterprise Edition) or from 30 to 1024 (Express Edition and Web 404 Edition) 405 406 :type db_instance_class: string 407 :param db_instance_class: The compute and memory capacity of the DB 408 instance. 409 Valid Values: `db.t1.micro | db.m1.small | db.m1.medium | db.m1.large | 410 db.m1.xlarge | db.m2.xlarge |db.m2.2xlarge | db.m2.4xlarge` 411 412 :type engine: string 413 :param engine: The name of the database engine to be used for this 414 instance. 415 Valid Values: `MySQL` | `oracle-se1` | `oracle-se` | `oracle-ee` | 416 `sqlserver-ee` | `sqlserver-se` | `sqlserver-ex` | `sqlserver-web` 417 418 :type master_username: string 419 :param master_username: 420 The name of master user for the client DB instance. 421 422 **MySQL** 423 424 Constraints: 425 426 427 + Must be 1 to 16 alphanumeric characters. 428 + First character must be a letter. 429 + Cannot be a reserved word for the chosen database engine. 430 431 432 Type: String 433 434 **Oracle** 435 436 Constraints: 437 438 439 + Must be 1 to 30 alphanumeric characters. 440 + First character must be a letter. 441 + Cannot be a reserved word for the chosen database engine. 442 443 444 **SQL Server** 445 446 Constraints: 447 448 449 + Must be 1 to 128 alphanumeric characters. 450 + First character must be a letter. 451 + Cannot be a reserved word for the chosen database engine. 452 453 :type master_user_password: string 454 :param master_user_password: The password for the master database user. 455 Can be any printable ASCII character except "/", '"', or "@". 456 Type: String 457 458 **MySQL** 459 460 Constraints: Must contain from 8 to 41 characters. 461 462 **Oracle** 463 464 Constraints: Must contain from 8 to 30 characters. 465 466 **SQL Server** 467 468 Constraints: Must contain from 8 to 128 characters. 469 470 :type db_security_groups: list 471 :param db_security_groups: A list of DB security groups to associate 472 with this DB instance. 473 Default: The default DB security group for the database engine. 474 475 :type vpc_security_group_ids: list 476 :param vpc_security_group_ids: A list of EC2 VPC security groups to 477 associate with this DB instance. 478 Default: The default EC2 VPC security group for the DB subnet group's 479 VPC. 480 481 :type availability_zone: string 482 :param availability_zone: The EC2 Availability Zone that the database 483 instance will be created in. 484 Default: A random, system-chosen Availability Zone in the endpoint's 485 region. 486 487 Example: `us-east-1d` 488 489 Constraint: The AvailabilityZone parameter cannot be specified if the 490 MultiAZ parameter is set to `True`. The specified Availability Zone 491 must be in the same region as the current endpoint. 492 493 :type db_subnet_group_name: string 494 :param db_subnet_group_name: A DB subnet group to associate with this 495 DB instance. 496 If there is no DB subnet group, then it is a non-VPC DB instance. 497 498 :type preferred_maintenance_window: string 499 :param preferred_maintenance_window: The weekly time range (in UTC) 500 during which system maintenance can occur. 501 Format: `ddd:hh24:mi-ddd:hh24:mi` 502 503 Default: A 30-minute window selected at random from an 8-hour block of 504 time per region, occurring on a random day of the week. To see the 505 time blocks available, see ` Adjusting the Preferred Maintenance 506 Window`_ in the Amazon RDS User Guide. 507 508 Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun 509 510 Constraints: Minimum 30-minute window. 511 512 :type db_parameter_group_name: string 513 :param db_parameter_group_name: 514 The name of the DB parameter group to associate with this DB instance. 515 If this argument is omitted, the default DBParameterGroup for the 516 specified engine will be used. 517 518 Constraints: 519 520 521 + Must be 1 to 255 alphanumeric characters 522 + First character must be a letter 523 + Cannot end with a hyphen or contain two consecutive hyphens 524 525 :type backup_retention_period: integer 526 :param backup_retention_period: 527 The number of days for which automated backups are retained. Setting 528 this parameter to a positive number enables backups. Setting this 529 parameter to 0 disables automated backups. 530 531 Default: 1 532 533 Constraints: 534 535 536 + Must be a value from 0 to 8 537 + Cannot be set to 0 if the DB instance is a master instance with read 538 replicas 539 540 :type preferred_backup_window: string 541 :param preferred_backup_window: The daily time range during which 542 automated backups are created if automated backups are enabled, 543 using the `BackupRetentionPeriod` parameter. 544 Default: A 30-minute window selected at random from an 8-hour block of 545 time per region. See the Amazon RDS User Guide for the time blocks 546 for each region from which the default backup windows are assigned. 547 548 Constraints: Must be in the format `hh24:mi-hh24:mi`. Times should be 549 Universal Time Coordinated (UTC). Must not conflict with the 550 preferred maintenance window. Must be at least 30 minutes. 551 552 :type port: integer 553 :param port: The port number on which the database accepts connections. 554 **MySQL** 555 556 Default: `3306` 557 558 Valid Values: `1150-65535` 559 560 Type: Integer 561 562 **Oracle** 563 564 Default: `1521` 565 566 Valid Values: `1150-65535` 567 568 **SQL Server** 569 570 Default: `1433` 571 572 Valid Values: `1150-65535` except for `1434` and `3389`. 573 574 :type multi_az: boolean 575 :param multi_az: Specifies if the DB instance is a Multi-AZ deployment. 576 You cannot set the AvailabilityZone parameter if the MultiAZ 577 parameter is set to true. 578 579 :type engine_version: string 580 :param engine_version: The version number of the database engine to 581 use. 582 **MySQL** 583 584 Example: `5.1.42` 585 586 Type: String 587 588 **Oracle** 589 590 Example: `11.2.0.2.v2` 591 592 Type: String 593 594 **SQL Server** 595 596 Example: `10.50.2789.0.v1` 597 598 :type auto_minor_version_upgrade: boolean 599 :param auto_minor_version_upgrade: Indicates that minor engine upgrades 600 will be applied automatically to the DB instance during the 601 maintenance window. 602 Default: `True` 603 604 :type license_model: string 605 :param license_model: License model information for this DB instance. 606 Valid values: `license-included` | `bring-your-own-license` | `general- 607 public-license` 608 609 :type iops: integer 610 :param iops: The amount of Provisioned IOPS (input/output operations 611 per second) to be initially allocated for the DB instance. 612 Constraints: Must be an integer greater than 1000. 613 614 :type option_group_name: string 615 :param option_group_name: Indicates that the DB instance should be 616 associated with the specified option group. 617 Permanent options, such as the TDE option for Oracle Advanced Security 618 TDE, cannot be removed from an option group, and that option group 619 cannot be removed from a DB instance once it is associated with a 620 DB instance 621 622 :type character_set_name: string 623 :param character_set_name: For supported engines, indicates that the DB 624 instance should be associated with the specified CharacterSet. 625 626 :type publicly_accessible: boolean 627 :param publicly_accessible: Specifies the accessibility options for the 628 DB instance. A value of true specifies an Internet-facing instance 629 with a publicly resolvable DNS name, which resolves to a public IP 630 address. A value of false specifies an internal instance with a DNS 631 name that resolves to a private IP address. 632 Default: The default behavior varies depending on whether a VPC has 633 been requested or not. The following list shows the default 634 behavior in each case. 635 636 637 + **Default VPC:**true 638 + **VPC:**false 639 640 641 If no DB subnet group has been specified as part of the request and the 642 PubliclyAccessible value has not been set, the DB instance will be 643 publicly accessible. If a specific DB subnet group has been 644 specified as part of the request and the PubliclyAccessible value 645 has not been set, the DB instance will be private. 646 647 :type tags: list 648 :param tags: A list of tags. 649 650 """ 651 params = { 652 'DBInstanceIdentifier': db_instance_identifier, 653 'AllocatedStorage': allocated_storage, 654 'DBInstanceClass': db_instance_class, 655 'Engine': engine, 656 'MasterUsername': master_username, 657 'MasterUserPassword': master_user_password, 658 } 659 if db_name is not None: 660 params['DBName'] = db_name 661 if db_security_groups is not None: 662 self.build_list_params(params, 663 db_security_groups, 664 'DBSecurityGroups.member') 665 if vpc_security_group_ids is not None: 666 self.build_list_params(params, 667 vpc_security_group_ids, 668 'VpcSecurityGroupIds.member') 669 if availability_zone is not None: 670 params['AvailabilityZone'] = availability_zone 671 if db_subnet_group_name is not None: 672 params['DBSubnetGroupName'] = db_subnet_group_name 673 if preferred_maintenance_window is not None: 674 params['PreferredMaintenanceWindow'] = preferred_maintenance_window 675 if db_parameter_group_name is not None: 676 params['DBParameterGroupName'] = db_parameter_group_name 677 if backup_retention_period is not None: 678 params['BackupRetentionPeriod'] = backup_retention_period 679 if preferred_backup_window is not None: 680 params['PreferredBackupWindow'] = preferred_backup_window 681 if port is not None: 682 params['Port'] = port 683 if multi_az is not None: 684 params['MultiAZ'] = str( 685 multi_az).lower() 686 if engine_version is not None: 687 params['EngineVersion'] = engine_version 688 if auto_minor_version_upgrade is not None: 689 params['AutoMinorVersionUpgrade'] = str( 690 auto_minor_version_upgrade).lower() 691 if license_model is not None: 692 params['LicenseModel'] = license_model 693 if iops is not None: 694 params['Iops'] = iops 695 if option_group_name is not None: 696 params['OptionGroupName'] = option_group_name 697 if character_set_name is not None: 698 params['CharacterSetName'] = character_set_name 699 if publicly_accessible is not None: 700 params['PubliclyAccessible'] = str( 701 publicly_accessible).lower() 702 if tags is not None: 703 self.build_complex_list_params( 704 params, tags, 705 'Tags.member', 706 ('Key', 'Value')) 707 return self._make_request( 708 action='CreateDBInstance', 709 verb='POST', 710 path='/', params=params) 711 712 def create_db_instance_read_replica(self, db_instance_identifier, 713 source_db_instance_identifier, 714 db_instance_class=None, 715 availability_zone=None, port=None, 716 auto_minor_version_upgrade=None, 717 iops=None, option_group_name=None, 718 publicly_accessible=None, tags=None): 719 """ 720 Creates a DB instance that acts as a read replica of a source 721 DB instance. 722 723 All read replica DB instances are created as Single-AZ 724 deployments with backups disabled. All other DB instance 725 attributes (including DB security groups and DB parameter 726 groups) are inherited from the source DB instance, except as 727 specified below. 728 729 The source DB instance must have backup retention enabled. 730 731 :type db_instance_identifier: string 732 :param db_instance_identifier: The DB instance identifier of the read 733 replica. This is the unique key that identifies a DB instance. This 734 parameter is stored as a lowercase string. 735 736 :type source_db_instance_identifier: string 737 :param source_db_instance_identifier: The identifier of the DB instance 738 that will act as the source for the read replica. Each DB instance 739 can have up to five read replicas. 740 Constraints: Must be the identifier of an existing DB instance that is 741 not already a read replica DB instance. 742 743 :type db_instance_class: string 744 :param db_instance_class: The compute and memory capacity of the read 745 replica. 746 Valid Values: `db.m1.small | db.m1.medium | db.m1.large | db.m1.xlarge 747 | db.m2.xlarge |db.m2.2xlarge | db.m2.4xlarge` 748 749 Default: Inherits from the source DB instance. 750 751 :type availability_zone: string 752 :param availability_zone: The Amazon EC2 Availability Zone that the 753 read replica will be created in. 754 Default: A random, system-chosen Availability Zone in the endpoint's 755 region. 756 757 Example: `us-east-1d` 758 759 :type port: integer 760 :param port: The port number that the DB instance uses for connections. 761 Default: Inherits from the source DB instance 762 763 Valid Values: `1150-65535` 764 765 :type auto_minor_version_upgrade: boolean 766 :param auto_minor_version_upgrade: Indicates that minor engine upgrades 767 will be applied automatically to the read replica during the 768 maintenance window. 769 Default: Inherits from the source DB instance 770 771 :type iops: integer 772 :param iops: The amount of Provisioned IOPS (input/output operations 773 per second) to be initially allocated for the DB instance. 774 775 :type option_group_name: string 776 :param option_group_name: The option group the DB instance will be 777 associated with. If omitted, the default option group for the 778 engine specified will be used. 779 780 :type publicly_accessible: boolean 781 :param publicly_accessible: Specifies the accessibility options for the 782 DB instance. A value of true specifies an Internet-facing instance 783 with a publicly resolvable DNS name, which resolves to a public IP 784 address. A value of false specifies an internal instance with a DNS 785 name that resolves to a private IP address. 786 Default: The default behavior varies depending on whether a VPC has 787 been requested or not. The following list shows the default 788 behavior in each case. 789 790 791 + **Default VPC:**true 792 + **VPC:**false 793 794 795 If no DB subnet group has been specified as part of the request and the 796 PubliclyAccessible value has not been set, the DB instance will be 797 publicly accessible. If a specific DB subnet group has been 798 specified as part of the request and the PubliclyAccessible value 799 has not been set, the DB instance will be private. 800 801 :type tags: list 802 :param tags: A list of tags. 803 804 """ 805 params = { 806 'DBInstanceIdentifier': db_instance_identifier, 807 'SourceDBInstanceIdentifier': source_db_instance_identifier, 808 } 809 if db_instance_class is not None: 810 params['DBInstanceClass'] = db_instance_class 811 if availability_zone is not None: 812 params['AvailabilityZone'] = availability_zone 813 if port is not None: 814 params['Port'] = port 815 if auto_minor_version_upgrade is not None: 816 params['AutoMinorVersionUpgrade'] = str( 817 auto_minor_version_upgrade).lower() 818 if iops is not None: 819 params['Iops'] = iops 820 if option_group_name is not None: 821 params['OptionGroupName'] = option_group_name 822 if publicly_accessible is not None: 823 params['PubliclyAccessible'] = str( 824 publicly_accessible).lower() 825 if tags is not None: 826 self.build_complex_list_params( 827 params, tags, 828 'Tags.member', 829 ('Key', 'Value')) 830 return self._make_request( 831 action='CreateDBInstanceReadReplica', 832 verb='POST', 833 path='/', params=params) 834 835 def create_db_parameter_group(self, db_parameter_group_name, 836 db_parameter_group_family, description, 837 tags=None): 838 """ 839 Creates a new DB parameter group. 840 841 A DB parameter group is initially created with the default 842 parameters for the database engine used by the DB instance. To 843 provide custom values for any of the parameters, you must 844 modify the group after creating it using 845 ModifyDBParameterGroup . Once you've created a DB parameter 846 group, you need to associate it with your DB instance using 847 ModifyDBInstance . When you associate a new DB parameter group 848 with a running DB instance, you need to reboot the DB Instance 849 for the new DB parameter group and associated settings to take 850 effect. 851 852 :type db_parameter_group_name: string 853 :param db_parameter_group_name: 854 The name of the DB parameter group. 855 856 Constraints: 857 858 859 + Must be 1 to 255 alphanumeric characters 860 + First character must be a letter 861 + Cannot end with a hyphen or contain two consecutive hyphens 862 863 864 This value is stored as a lower-case string. 865 866 :type db_parameter_group_family: string 867 :param db_parameter_group_family: The DB parameter group family name. A 868 DB parameter group can be associated with one and only one DB 869 parameter group family, and can be applied only to a DB instance 870 running a database engine and engine version compatible with that 871 DB parameter group family. 872 873 :type description: string 874 :param description: The description for the DB parameter group. 875 876 :type tags: list 877 :param tags: A list of tags. 878 879 """ 880 params = { 881 'DBParameterGroupName': db_parameter_group_name, 882 'DBParameterGroupFamily': db_parameter_group_family, 883 'Description': description, 884 } 885 if tags is not None: 886 self.build_complex_list_params( 887 params, tags, 888 'Tags.member', 889 ('Key', 'Value')) 890 return self._make_request( 891 action='CreateDBParameterGroup', 892 verb='POST', 893 path='/', params=params) 894 895 def create_db_security_group(self, db_security_group_name, 896 db_security_group_description, tags=None): 897 """ 898 Creates a new DB security group. DB security groups control 899 access to a DB instance. 900 901 :type db_security_group_name: string 902 :param db_security_group_name: The name for the DB security group. This 903 value is stored as a lowercase string. 904 Constraints: 905 906 907 + Must be 1 to 255 alphanumeric characters 908 + First character must be a letter 909 + Cannot end with a hyphen or contain two consecutive hyphens 910 + Must not be "Default" 911 + May not contain spaces 912 913 914 Example: `mysecuritygroup` 915 916 :type db_security_group_description: string 917 :param db_security_group_description: The description for the DB 918 security group. 919 920 :type tags: list 921 :param tags: A list of tags. 922 923 """ 924 params = { 925 'DBSecurityGroupName': db_security_group_name, 926 'DBSecurityGroupDescription': db_security_group_description, 927 } 928 if tags is not None: 929 self.build_complex_list_params( 930 params, tags, 931 'Tags.member', 932 ('Key', 'Value')) 933 return self._make_request( 934 action='CreateDBSecurityGroup', 935 verb='POST', 936 path='/', params=params) 937 938 def create_db_snapshot(self, db_snapshot_identifier, 939 db_instance_identifier, tags=None): 940 """ 941 Creates a DBSnapshot. The source DBInstance must be in 942 "available" state. 943 944 :type db_snapshot_identifier: string 945 :param db_snapshot_identifier: The identifier for the DB snapshot. 946 Constraints: 947 948 949 + Cannot be null, empty, or blank 950 + Must contain from 1 to 255 alphanumeric characters or hyphens 951 + First character must be a letter 952 + Cannot end with a hyphen or contain two consecutive hyphens 953 954 955 Example: `my-snapshot-id` 956 957 :type db_instance_identifier: string 958 :param db_instance_identifier: 959 The DB instance identifier. This is the unique key that identifies a DB 960 instance. This parameter isn't case sensitive. 961 962 Constraints: 963 964 965 + Must contain from 1 to 63 alphanumeric characters or hyphens 966 + First character must be a letter 967 + Cannot end with a hyphen or contain two consecutive hyphens 968 969 :type tags: list 970 :param tags: A list of tags. 971 972 """ 973 params = { 974 'DBSnapshotIdentifier': db_snapshot_identifier, 975 'DBInstanceIdentifier': db_instance_identifier, 976 } 977 if tags is not None: 978 self.build_complex_list_params( 979 params, tags, 980 'Tags.member', 981 ('Key', 'Value')) 982 return self._make_request( 983 action='CreateDBSnapshot', 984 verb='POST', 985 path='/', params=params) 986 987 def create_db_subnet_group(self, db_subnet_group_name, 988 db_subnet_group_description, subnet_ids, 989 tags=None): 990 """ 991 Creates a new DB subnet group. DB subnet groups must contain 992 at least one subnet in at least two AZs in the region. 993 994 :type db_subnet_group_name: string 995 :param db_subnet_group_name: The name for the DB subnet group. This 996 value is stored as a lowercase string. 997 Constraints: Must contain no more than 255 alphanumeric characters or 998 hyphens. Must not be "Default". 999 1000 Example: `mySubnetgroup` 1001 1002 :type db_subnet_group_description: string 1003 :param db_subnet_group_description: The description for the DB subnet 1004 group. 1005 1006 :type subnet_ids: list 1007 :param subnet_ids: The EC2 Subnet IDs for the DB subnet group. 1008 1009 :type tags: list 1010 :param tags: A list of tags into tuples. 1011 1012 """ 1013 params = { 1014 'DBSubnetGroupName': db_subnet_group_name, 1015 'DBSubnetGroupDescription': db_subnet_group_description, 1016 } 1017 self.build_list_params(params, 1018 subnet_ids, 1019 'SubnetIds.member') 1020 if tags is not None: 1021 self.build_complex_list_params( 1022 params, tags, 1023 'Tags.member', 1024 ('Key', 'Value')) 1025 return self._make_request( 1026 action='CreateDBSubnetGroup', 1027 verb='POST', 1028 path='/', params=params) 1029 1030 def create_event_subscription(self, subscription_name, sns_topic_arn, 1031 source_type=None, event_categories=None, 1032 source_ids=None, enabled=None, tags=None): 1033 """ 1034 Creates an RDS event notification subscription. This action 1035 requires a topic ARN (Amazon Resource Name) created by either 1036 the RDS console, the SNS console, or the SNS API. To obtain an 1037 ARN with SNS, you must create a topic in Amazon SNS and 1038 subscribe to the topic. The ARN is displayed in the SNS 1039 console. 1040 1041 You can specify the type of source (SourceType) you want to be 1042 notified of, provide a list of RDS sources (SourceIds) that 1043 triggers the events, and provide a list of event categories 1044 (EventCategories) for events you want to be notified of. For 1045 example, you can specify SourceType = db-instance, SourceIds = 1046 mydbinstance1, mydbinstance2 and EventCategories = 1047 Availability, Backup. 1048 1049 If you specify both the SourceType and SourceIds, such as 1050 SourceType = db-instance and SourceIdentifier = myDBInstance1, 1051 you will be notified of all the db-instance events for the 1052 specified source. If you specify a SourceType but do not 1053 specify a SourceIdentifier, you will receive notice of the 1054 events for that source type for all your RDS sources. If you 1055 do not specify either the SourceType nor the SourceIdentifier, 1056 you will be notified of events generated from all RDS sources 1057 belonging to your customer account. 1058 1059 :type subscription_name: string 1060 :param subscription_name: The name of the subscription. 1061 Constraints: The name must be less than 255 characters. 1062 1063 :type sns_topic_arn: string 1064 :param sns_topic_arn: The Amazon Resource Name (ARN) of the SNS topic 1065 created for event notification. The ARN is created by Amazon SNS 1066 when you create a topic and subscribe to it. 1067 1068 :type source_type: string 1069 :param source_type: The type of source that will be generating the 1070 events. For example, if you want to be notified of events generated 1071 by a DB instance, you would set this parameter to db-instance. if 1072 this value is not specified, all events are returned. 1073 Valid values: db-instance | db-parameter-group | db-security-group | 1074 db-snapshot 1075 1076 :type event_categories: list 1077 :param event_categories: A list of event categories for a SourceType 1078 that you want to subscribe to. You can see a list of the categories 1079 for a given SourceType in the `Events`_ topic in the Amazon RDS 1080 User Guide or by using the **DescribeEventCategories** action. 1081 1082 :type source_ids: list 1083 :param source_ids: 1084 The list of identifiers of the event sources for which events will be 1085 returned. If not specified, then all sources are included in the 1086 response. An identifier must begin with a letter and must contain 1087 only ASCII letters, digits, and hyphens; it cannot end with a 1088 hyphen or contain two consecutive hyphens. 1089 1090 Constraints: 1091 1092 1093 + If SourceIds are supplied, SourceType must also be provided. 1094 + If the source type is a DB instance, then a `DBInstanceIdentifier` 1095 must be supplied. 1096 + If the source type is a DB security group, a `DBSecurityGroupName` 1097 must be supplied. 1098 + If the source type is a DB parameter group, a `DBParameterGroupName` 1099 must be supplied. 1100 + If the source type is a DB snapshot, a `DBSnapshotIdentifier` must be 1101 supplied. 1102 1103 :type enabled: boolean 1104 :param enabled: A Boolean value; set to **true** to activate the 1105 subscription, set to **false** to create the subscription but not 1106 active it. 1107 1108 :type tags: list 1109 :param tags: A list of tags. 1110 1111 """ 1112 params = { 1113 'SubscriptionName': subscription_name, 1114 'SnsTopicArn': sns_topic_arn, 1115 } 1116 if source_type is not None: 1117 params['SourceType'] = source_type 1118 if event_categories is not None: 1119 self.build_list_params(params, 1120 event_categories, 1121 'EventCategories.member') 1122 if source_ids is not None: 1123 self.build_list_params(params, 1124 source_ids, 1125 'SourceIds.member') 1126 if enabled is not None: 1127 params['Enabled'] = str( 1128 enabled).lower() 1129 if tags is not None: 1130 self.build_complex_list_params( 1131 params, tags, 1132 'Tags.member', 1133 ('Key', 'Value')) 1134 return self._make_request( 1135 action='CreateEventSubscription', 1136 verb='POST', 1137 path='/', params=params) 1138 1139 def create_option_group(self, option_group_name, engine_name, 1140 major_engine_version, option_group_description, 1141 tags=None): 1142 """ 1143 Creates a new option group. You can create up to 20 option 1144 groups. 1145 1146 :type option_group_name: string 1147 :param option_group_name: Specifies the name of the option group to be 1148 created. 1149 Constraints: 1150 1151 1152 + Must be 1 to 255 alphanumeric characters or hyphens 1153 + First character must be a letter 1154 + Cannot end with a hyphen or contain two consecutive hyphens 1155 1156 1157 Example: `myoptiongroup` 1158 1159 :type engine_name: string 1160 :param engine_name: Specifies the name of the engine that this option 1161 group should be associated with. 1162 1163 :type major_engine_version: string 1164 :param major_engine_version: Specifies the major version of the engine 1165 that this option group should be associated with. 1166 1167 :type option_group_description: string 1168 :param option_group_description: The description of the option group. 1169 1170 :type tags: list 1171 :param tags: A list of tags. 1172 1173 """ 1174 params = { 1175 'OptionGroupName': option_group_name, 1176 'EngineName': engine_name, 1177 'MajorEngineVersion': major_engine_version, 1178 'OptionGroupDescription': option_group_description, 1179 } 1180 if tags is not None: 1181 self.build_complex_list_params( 1182 params, tags, 1183 'Tags.member', 1184 ('Key', 'Value')) 1185 return self._make_request( 1186 action='CreateOptionGroup', 1187 verb='POST', 1188 path='/', params=params) 1189 1190 def delete_db_instance(self, db_instance_identifier, 1191 skip_final_snapshot=None, 1192 final_db_snapshot_identifier=None): 1193 """ 1194 The DeleteDBInstance action deletes a previously provisioned 1195 DB instance. A successful response from the web service 1196 indicates the request was received correctly. When you delete 1197 a DB instance, all automated backups for that instance are 1198 deleted and cannot be recovered. Manual DB snapshots of the DB 1199 instance to be deleted are not deleted. 1200 1201 If a final DB snapshot is requested the status of the RDS 1202 instance will be "deleting" until the DB snapshot is created. 1203 The API action `DescribeDBInstance` is used to monitor the 1204 status of this operation. The action cannot be canceled or 1205 reverted once submitted. 1206 1207 :type db_instance_identifier: string 1208 :param db_instance_identifier: 1209 The DB instance identifier for the DB instance to be deleted. This 1210 parameter isn't case sensitive. 1211 1212 Constraints: 1213 1214 1215 + Must contain from 1 to 63 alphanumeric characters or hyphens 1216 + First character must be a letter 1217 + Cannot end with a hyphen or contain two consecutive hyphens 1218 1219 :type skip_final_snapshot: boolean 1220 :param skip_final_snapshot: Determines whether a final DB snapshot is 1221 created before the DB instance is deleted. If `True` is specified, 1222 no DBSnapshot is created. If false is specified, a DB snapshot is 1223 created before the DB instance is deleted. 1224 The FinalDBSnapshotIdentifier parameter must be specified if 1225 SkipFinalSnapshot is `False`. 1226 1227 Default: `False` 1228 1229 :type final_db_snapshot_identifier: string 1230 :param final_db_snapshot_identifier: 1231 The DBSnapshotIdentifier of the new DBSnapshot created when 1232 SkipFinalSnapshot is set to `False`. 1233 1234 Specifying this parameter and also setting the SkipFinalShapshot 1235 parameter to true results in an error. 1236 1237 Constraints: 1238 1239 1240 + Must be 1 to 255 alphanumeric characters 1241 + First character must be a letter 1242 + Cannot end with a hyphen or contain two consecutive hyphens 1243 1244 """ 1245 params = {'DBInstanceIdentifier': db_instance_identifier, } 1246 if skip_final_snapshot is not None: 1247 params['SkipFinalSnapshot'] = str( 1248 skip_final_snapshot).lower() 1249 if final_db_snapshot_identifier is not None: 1250 params['FinalDBSnapshotIdentifier'] = final_db_snapshot_identifier 1251 return self._make_request( 1252 action='DeleteDBInstance', 1253 verb='POST', 1254 path='/', params=params) 1255 1256 def delete_db_parameter_group(self, db_parameter_group_name): 1257 """ 1258 Deletes a specified DBParameterGroup. The DBParameterGroup 1259 cannot be associated with any RDS instances to be deleted. 1260 The specified DB parameter group cannot be associated with any 1261 DB instances. 1262 1263 :type db_parameter_group_name: string 1264 :param db_parameter_group_name: 1265 The name of the DB parameter group. 1266 1267 Constraints: 1268 1269 1270 + Must be the name of an existing DB parameter group 1271 + You cannot delete a default DB parameter group 1272 + Cannot be associated with any DB instances 1273 1274 """ 1275 params = {'DBParameterGroupName': db_parameter_group_name, } 1276 return self._make_request( 1277 action='DeleteDBParameterGroup', 1278 verb='POST', 1279 path='/', params=params) 1280 1281 def delete_db_security_group(self, db_security_group_name): 1282 """ 1283 Deletes a DB security group. 1284 The specified DB security group must not be associated with 1285 any DB instances. 1286 1287 :type db_security_group_name: string 1288 :param db_security_group_name: 1289 The name of the DB security group to delete. 1290 1291 You cannot delete the default DB security group. 1292 1293 Constraints: 1294 1295 1296 + Must be 1 to 255 alphanumeric characters 1297 + First character must be a letter 1298 + Cannot end with a hyphen or contain two consecutive hyphens 1299 + Must not be "Default" 1300 + May not contain spaces 1301 1302 """ 1303 params = {'DBSecurityGroupName': db_security_group_name, } 1304 return self._make_request( 1305 action='DeleteDBSecurityGroup', 1306 verb='POST', 1307 path='/', params=params) 1308 1309 def delete_db_snapshot(self, db_snapshot_identifier): 1310 """ 1311 Deletes a DBSnapshot. 1312 The DBSnapshot must be in the `available` state to be deleted. 1313 1314 :type db_snapshot_identifier: string 1315 :param db_snapshot_identifier: The DBSnapshot identifier. 1316 Constraints: Must be the name of an existing DB snapshot in the 1317 `available` state. 1318 1319 """ 1320 params = {'DBSnapshotIdentifier': db_snapshot_identifier, } 1321 return self._make_request( 1322 action='DeleteDBSnapshot', 1323 verb='POST', 1324 path='/', params=params) 1325 1326 def delete_db_subnet_group(self, db_subnet_group_name): 1327 """ 1328 Deletes a DB subnet group. 1329 The specified database subnet group must not be associated 1330 with any DB instances. 1331 1332 :type db_subnet_group_name: string 1333 :param db_subnet_group_name: 1334 The name of the database subnet group to delete. 1335 1336 You cannot delete the default subnet group. 1337 1338 Constraints: 1339 1340 1341 + Must be 1 to 255 alphanumeric characters 1342 + First character must be a letter 1343 + Cannot end with a hyphen or contain two consecutive hyphens 1344 1345 """ 1346 params = {'DBSubnetGroupName': db_subnet_group_name, } 1347 return self._make_request( 1348 action='DeleteDBSubnetGroup', 1349 verb='POST', 1350 path='/', params=params) 1351 1352 def delete_event_subscription(self, subscription_name): 1353 """ 1354 Deletes an RDS event notification subscription. 1355 1356 :type subscription_name: string 1357 :param subscription_name: The name of the RDS event notification 1358 subscription you want to delete. 1359 1360 """ 1361 params = {'SubscriptionName': subscription_name, } 1362 return self._make_request( 1363 action='DeleteEventSubscription', 1364 verb='POST', 1365 path='/', params=params) 1366 1367 def delete_option_group(self, option_group_name): 1368 """ 1369 Deletes an existing option group. 1370 1371 :type option_group_name: string 1372 :param option_group_name: 1373 The name of the option group to be deleted. 1374 1375 You cannot delete default option groups. 1376 1377 """ 1378 params = {'OptionGroupName': option_group_name, } 1379 return self._make_request( 1380 action='DeleteOptionGroup', 1381 verb='POST', 1382 path='/', params=params) 1383 1384 def describe_db_engine_versions(self, engine=None, engine_version=None, 1385 db_parameter_group_family=None, 1386 max_records=None, marker=None, 1387 default_only=None, 1388 list_supported_character_sets=None): 1389 """ 1390 Returns a list of the available DB engines. 1391 1392 :type engine: string 1393 :param engine: The database engine to return. 1394 1395 :type engine_version: string 1396 :param engine_version: The database engine version to return. 1397 Example: `5.1.49` 1398 1399 :type db_parameter_group_family: string 1400 :param db_parameter_group_family: 1401 The name of a specific DB parameter group family to return details for. 1402 1403 Constraints: 1404 1405 1406 + Must be 1 to 255 alphanumeric characters 1407 + First character must be a letter 1408 + Cannot end with a hyphen or contain two consecutive hyphens 1409 1410 :type max_records: integer 1411 :param max_records: The maximum number of records to include in the 1412 response. If more than the `MaxRecords` value is available, a 1413 pagination token called a marker is included in the response so 1414 that the following results can be retrieved. 1415 Default: 100 1416 1417 Constraints: minimum 20, maximum 100 1418 1419 :type marker: string 1420 :param marker: An optional pagination token provided by a previous 1421 request. If this parameter is specified, the response includes only 1422 records beyond the marker, up to the value specified by 1423 `MaxRecords`. 1424 1425 :type default_only: boolean 1426 :param default_only: Indicates that only the default version of the 1427 specified engine or engine and major version combination is 1428 returned. 1429 1430 :type list_supported_character_sets: boolean 1431 :param list_supported_character_sets: If this parameter is specified, 1432 and if the requested engine supports the CharacterSetName parameter 1433 for CreateDBInstance, the response includes a list of supported 1434 character sets for each engine version. 1435 1436 """ 1437 params = {} 1438 if engine is not None: 1439 params['Engine'] = engine 1440 if engine_version is not None: 1441 params['EngineVersion'] = engine_version 1442 if db_parameter_group_family is not None: 1443 params['DBParameterGroupFamily'] = db_parameter_group_family 1444 if max_records is not None: 1445 params['MaxRecords'] = max_records 1446 if marker is not None: 1447 params['Marker'] = marker 1448 if default_only is not None: 1449 params['DefaultOnly'] = str( 1450 default_only).lower() 1451 if list_supported_character_sets is not None: 1452 params['ListSupportedCharacterSets'] = str( 1453 list_supported_character_sets).lower() 1454 return self._make_request( 1455 action='DescribeDBEngineVersions', 1456 verb='POST', 1457 path='/', params=params) 1458 1459 def describe_db_instances(self, db_instance_identifier=None, 1460 filters=None, max_records=None, marker=None): 1461 """ 1462 Returns information about provisioned RDS instances. This API 1463 supports pagination. 1464 1465 :type db_instance_identifier: string 1466 :param db_instance_identifier: 1467 The user-supplied instance identifier. If this parameter is specified, 1468 information from only the specific DB instance is returned. This 1469 parameter isn't case sensitive. 1470 1471 Constraints: 1472 1473 1474 + Must contain from 1 to 63 alphanumeric characters or hyphens 1475 + First character must be a letter 1476 + Cannot end with a hyphen or contain two consecutive hyphens 1477 1478 :type filters: list 1479 :param filters: 1480 1481 :type max_records: integer 1482 :param max_records: The maximum number of records to include in the 1483 response. If more records exist than the specified `MaxRecords` 1484 value, a pagination token called a marker is included in the 1485 response so that the remaining results may be retrieved. 1486 Default: 100 1487 1488 Constraints: minimum 20, maximum 100 1489 1490 :type marker: string 1491 :param marker: An optional pagination token provided by a previous 1492 DescribeDBInstances request. If this parameter is specified, the 1493 response includes only records beyond the marker, up to the value 1494 specified by `MaxRecords` . 1495 1496 """ 1497 params = {} 1498 if db_instance_identifier is not None: 1499 params['DBInstanceIdentifier'] = db_instance_identifier 1500 if filters is not None: 1501 self.build_complex_list_params( 1502 params, filters, 1503 'Filters.member', 1504 ('FilterName', 'FilterValue')) 1505 if max_records is not None: 1506 params['MaxRecords'] = max_records 1507 if marker is not None: 1508 params['Marker'] = marker 1509 return self._make_request( 1510 action='DescribeDBInstances', 1511 verb='POST', 1512 path='/', params=params) 1513 1514 def describe_db_log_files(self, db_instance_identifier, 1515 filename_contains=None, file_last_written=None, 1516 file_size=None, max_records=None, marker=None): 1517 """ 1518 Returns a list of DB log files for the DB instance. 1519 1520 :type db_instance_identifier: string 1521 :param db_instance_identifier: 1522 The customer-assigned name of the DB instance that contains the log 1523 files you want to list. 1524 1525 Constraints: 1526 1527 1528 + Must contain from 1 to 63 alphanumeric characters or hyphens 1529 + First character must be a letter 1530 + Cannot end with a hyphen or contain two consecutive hyphens 1531 1532 :type filename_contains: string 1533 :param filename_contains: Filters the available log files for log file 1534 names that contain the specified string. 1535 1536 :type file_last_written: long 1537 :param file_last_written: Filters the available log files for files 1538 written since the specified date, in POSIX timestamp format. 1539 1540 :type file_size: long 1541 :param file_size: Filters the available log files for files larger than 1542 the specified size. 1543 1544 :type max_records: integer 1545 :param max_records: The maximum number of records to include in the 1546 response. If more records exist than the specified MaxRecords 1547 value, a pagination token called a marker is included in the 1548 response so that the remaining results can be retrieved. 1549 1550 :type marker: string 1551 :param marker: The pagination token provided in the previous request. 1552 If this parameter is specified the response includes only records 1553 beyond the marker, up to MaxRecords. 1554 1555 """ 1556 params = {'DBInstanceIdentifier': db_instance_identifier, } 1557 if filename_contains is not None: 1558 params['FilenameContains'] = filename_contains 1559 if file_last_written is not None: 1560 params['FileLastWritten'] = file_last_written 1561 if file_size is not None: 1562 params['FileSize'] = file_size 1563 if max_records is not None: 1564 params['MaxRecords'] = max_records 1565 if marker is not None: 1566 params['Marker'] = marker 1567 return self._make_request( 1568 action='DescribeDBLogFiles', 1569 verb='POST', 1570 path='/', params=params) 1571 1572 def describe_db_parameter_groups(self, db_parameter_group_name=None, 1573 filters=None, max_records=None, 1574 marker=None): 1575 """ 1576 Returns a list of `DBParameterGroup` descriptions. If a 1577 `DBParameterGroupName` is specified, the list will contain 1578 only the description of the specified DB parameter group. 1579 1580 :type db_parameter_group_name: string 1581 :param db_parameter_group_name: 1582 The name of a specific DB parameter group to return details for. 1583 1584 Constraints: 1585 1586 1587 + Must be 1 to 255 alphanumeric characters 1588 + First character must be a letter 1589 + Cannot end with a hyphen or contain two consecutive hyphens 1590 1591 :type filters: list 1592 :param filters: 1593 1594 :type max_records: integer 1595 :param max_records: The maximum number of records to include in the 1596 response. If more records exist than the specified `MaxRecords` 1597 value, a pagination token called a marker is included in the 1598 response so that the remaining results may be retrieved. 1599 Default: 100 1600 1601 Constraints: minimum 20, maximum 100 1602 1603 :type marker: string 1604 :param marker: An optional pagination token provided by a previous 1605 `DescribeDBParameterGroups` request. If this parameter is 1606 specified, the response includes only records beyond the marker, up 1607 to the value specified by `MaxRecords`. 1608 1609 """ 1610 params = {} 1611 if db_parameter_group_name is not None: 1612 params['DBParameterGroupName'] = db_parameter_group_name 1613 if filters is not None: 1614 self.build_complex_list_params( 1615 params, filters, 1616 'Filters.member', 1617 ('FilterName', 'FilterValue')) 1618 if max_records is not None: 1619 params['MaxRecords'] = max_records 1620 if marker is not None: 1621 params['Marker'] = marker 1622 return self._make_request( 1623 action='DescribeDBParameterGroups', 1624 verb='POST', 1625 path='/', params=params) 1626 1627 def describe_db_parameters(self, db_parameter_group_name, source=None, 1628 max_records=None, marker=None): 1629 """ 1630 Returns the detailed parameter list for a particular DB 1631 parameter group. 1632 1633 :type db_parameter_group_name: string 1634 :param db_parameter_group_name: 1635 The name of a specific DB parameter group to return details for. 1636 1637 Constraints: 1638 1639 1640 + Must be 1 to 255 alphanumeric characters 1641 + First character must be a letter 1642 + Cannot end with a hyphen or contain two consecutive hyphens 1643 1644 :type source: string 1645 :param source: The parameter types to return. 1646 Default: All parameter types returned 1647 1648 Valid Values: `user | system | engine-default` 1649 1650 :type max_records: integer 1651 :param max_records: The maximum number of records to include in the 1652 response. If more records exist than the specified `MaxRecords` 1653 value, a pagination token called a marker is included in the 1654 response so that the remaining results may be retrieved. 1655 Default: 100 1656 1657 Constraints: minimum 20, maximum 100 1658 1659 :type marker: string 1660 :param marker: An optional pagination token provided by a previous 1661 `DescribeDBParameters` request. If this parameter is specified, the 1662 response includes only records beyond the marker, up to the value 1663 specified by `MaxRecords`. 1664 1665 """ 1666 params = {'DBParameterGroupName': db_parameter_group_name, } 1667 if source is not None: 1668 params['Source'] = source 1669 if max_records is not None: 1670 params['MaxRecords'] = max_records 1671 if marker is not None: 1672 params['Marker'] = marker 1673 return self._make_request( 1674 action='DescribeDBParameters', 1675 verb='POST', 1676 path='/', params=params) 1677 1678 def describe_db_security_groups(self, db_security_group_name=None, 1679 filters=None, max_records=None, 1680 marker=None): 1681 """ 1682 Returns a list of `DBSecurityGroup` descriptions. If a 1683 `DBSecurityGroupName` is specified, the list will contain only 1684 the descriptions of the specified DB security group. 1685 1686 :type db_security_group_name: string 1687 :param db_security_group_name: The name of the DB security group to 1688 return details for. 1689 1690 :type filters: list 1691 :param filters: 1692 1693 :type max_records: integer 1694 :param max_records: The maximum number of records to include in the 1695 response. If more records exist than the specified `MaxRecords` 1696 value, a pagination token called a marker is included in the 1697 response so that the remaining results may be retrieved. 1698 Default: 100 1699 1700 Constraints: minimum 20, maximum 100 1701 1702 :type marker: string 1703 :param marker: An optional pagination token provided by a previous 1704 DescribeDBSecurityGroups request. If this parameter is specified, 1705 the response includes only records beyond the marker, up to the 1706 value specified by `MaxRecords`. 1707 1708 """ 1709 params = {} 1710 if db_security_group_name is not None: 1711 params['DBSecurityGroupName'] = db_security_group_name 1712 if filters is not None: 1713 self.build_complex_list_params( 1714 params, filters, 1715 'Filters.member', 1716 ('FilterName', 'FilterValue')) 1717 if max_records is not None: 1718 params['MaxRecords'] = max_records 1719 if marker is not None: 1720 params['Marker'] = marker 1721 return self._make_request( 1722 action='DescribeDBSecurityGroups', 1723 verb='POST', 1724 path='/', params=params) 1725 1726 def describe_db_snapshots(self, db_instance_identifier=None, 1727 db_snapshot_identifier=None, 1728 snapshot_type=None, filters=None, 1729 max_records=None, marker=None): 1730 """ 1731 Returns information about DB snapshots. This API supports 1732 pagination. 1733 1734 :type db_instance_identifier: string 1735 :param db_instance_identifier: 1736 A DB instance identifier to retrieve the list of DB snapshots for. 1737 Cannot be used in conjunction with `DBSnapshotIdentifier`. This 1738 parameter is not case sensitive. 1739 1740 Constraints: 1741 1742 1743 + Must contain from 1 to 63 alphanumeric characters or hyphens 1744 + First character must be a letter 1745 + Cannot end with a hyphen or contain two consecutive hyphens 1746 1747 :type db_snapshot_identifier: string 1748 :param db_snapshot_identifier: 1749 A specific DB snapshot identifier to describe. Cannot be used in 1750 conjunction with `DBInstanceIdentifier`. This value is stored as a 1751 lowercase string. 1752 1753 Constraints: 1754 1755 1756 + Must be 1 to 255 alphanumeric characters 1757 + First character must be a letter 1758 + Cannot end with a hyphen or contain two consecutive hyphens 1759 + If this is the identifier of an automated snapshot, the 1760 `SnapshotType` parameter must also be specified. 1761 1762 :type snapshot_type: string 1763 :param snapshot_type: The type of snapshots that will be returned. 1764 Values can be "automated" or "manual." If not specified, the 1765 returned results will include all snapshots types. 1766 1767 :type filters: list 1768 :param filters: 1769 1770 :type max_records: integer 1771 :param max_records: The maximum number of records to include in the 1772 response. If more records exist than the specified `MaxRecords` 1773 value, a pagination token called a marker is included in the 1774 response so that the remaining results may be retrieved. 1775 Default: 100 1776 1777 Constraints: minimum 20, maximum 100 1778 1779 :type marker: string 1780 :param marker: An optional pagination token provided by a previous 1781 `DescribeDBSnapshots` request. If this parameter is specified, the 1782 response includes only records beyond the marker, up to the value 1783 specified by `MaxRecords`. 1784 1785 """ 1786 params = {} 1787 if db_instance_identifier is not None: 1788 params['DBInstanceIdentifier'] = db_instance_identifier 1789 if db_snapshot_identifier is not None: 1790 params['DBSnapshotIdentifier'] = db_snapshot_identifier 1791 if snapshot_type is not None: 1792 params['SnapshotType'] = snapshot_type 1793 if filters is not None: 1794 self.build_complex_list_params( 1795 params, filters, 1796 'Filters.member', 1797 ('FilterName', 'FilterValue')) 1798 if max_records is not None: 1799 params['MaxRecords'] = max_records 1800 if marker is not None: 1801 params['Marker'] = marker 1802 return self._make_request( 1803 action='DescribeDBSnapshots', 1804 verb='POST', 1805 path='/', params=params) 1806 1807 def describe_db_subnet_groups(self, db_subnet_group_name=None, 1808 filters=None, max_records=None, 1809 marker=None): 1810 """ 1811 Returns a list of DBSubnetGroup descriptions. If a 1812 DBSubnetGroupName is specified, the list will contain only the 1813 descriptions of the specified DBSubnetGroup. 1814 1815 For an overview of CIDR ranges, go to the `Wikipedia 1816 Tutorial`_. 1817 1818 :type db_subnet_group_name: string 1819 :param db_subnet_group_name: The name of the DB subnet group to return 1820 details for. 1821 1822 :type filters: list 1823 :param filters: 1824 1825 :type max_records: integer 1826 :param max_records: The maximum number of records to include in the 1827 response. If more records exist than the specified `MaxRecords` 1828 value, a pagination token called a marker is included in the 1829 response so that the remaining results may be retrieved. 1830 Default: 100 1831 1832 Constraints: minimum 20, maximum 100 1833 1834 :type marker: string 1835 :param marker: An optional pagination token provided by a previous 1836 DescribeDBSubnetGroups request. If this parameter is specified, the 1837 response includes only records beyond the marker, up to the value 1838 specified by `MaxRecords`. 1839 1840 """ 1841 params = {} 1842 if db_subnet_group_name is not None: 1843 params['DBSubnetGroupName'] = db_subnet_group_name 1844 if filters is not None: 1845 self.build_complex_list_params( 1846 params, filters, 1847 'Filters.member', 1848 ('FilterName', 'FilterValue')) 1849 if max_records is not None: 1850 params['MaxRecords'] = max_records 1851 if marker is not None: 1852 params['Marker'] = marker 1853 return self._make_request( 1854 action='DescribeDBSubnetGroups', 1855 verb='POST', 1856 path='/', params=params) 1857 1858 def describe_engine_default_parameters(self, db_parameter_group_family, 1859 max_records=None, marker=None): 1860 """ 1861 Returns the default engine and system parameter information 1862 for the specified database engine. 1863 1864 :type db_parameter_group_family: string 1865 :param db_parameter_group_family: The name of the DB parameter group 1866 family. 1867 1868 :type max_records: integer 1869 :param max_records: The maximum number of records to include in the 1870 response. If more records exist than the specified `MaxRecords` 1871 value, a pagination token called a marker is included in the 1872 response so that the remaining results may be retrieved. 1873 Default: 100 1874 1875 Constraints: minimum 20, maximum 100 1876 1877 :type marker: string 1878 :param marker: An optional pagination token provided by a previous 1879 `DescribeEngineDefaultParameters` request. If this parameter is 1880 specified, the response includes only records beyond the marker, up 1881 to the value specified by `MaxRecords`. 1882 1883 """ 1884 params = { 1885 'DBParameterGroupFamily': db_parameter_group_family, 1886 } 1887 if max_records is not None: 1888 params['MaxRecords'] = max_records 1889 if marker is not None: 1890 params['Marker'] = marker 1891 return self._make_request( 1892 action='DescribeEngineDefaultParameters', 1893 verb='POST', 1894 path='/', params=params) 1895 1896 def describe_event_categories(self, source_type=None): 1897 """ 1898 Displays a list of categories for all event source types, or, 1899 if specified, for a specified source type. You can see a list 1900 of the event categories and source types in the ` Events`_ 1901 topic in the Amazon RDS User Guide. 1902 1903 :type source_type: string 1904 :param source_type: The type of source that will be generating the 1905 events. 1906 Valid values: db-instance | db-parameter-group | db-security-group | 1907 db-snapshot 1908 1909 """ 1910 params = {} 1911 if source_type is not None: 1912 params['SourceType'] = source_type 1913 return self._make_request( 1914 action='DescribeEventCategories', 1915 verb='POST', 1916 path='/', params=params) 1917 1918 def describe_event_subscriptions(self, subscription_name=None, 1919 filters=None, max_records=None, 1920 marker=None): 1921 """ 1922 Lists all the subscription descriptions for a customer 1923 account. The description for a subscription includes 1924 SubscriptionName, SNSTopicARN, CustomerID, SourceType, 1925 SourceID, CreationTime, and Status. 1926 1927 If you specify a SubscriptionName, lists the description for 1928 that subscription. 1929 1930 :type subscription_name: string 1931 :param subscription_name: The name of the RDS event notification 1932 subscription you want to describe. 1933 1934 :type filters: list 1935 :param filters: 1936 1937 :type max_records: integer 1938 :param max_records: The maximum number of records to include in the 1939 response. If more records exist than the specified `MaxRecords` 1940 value, a pagination token called a marker is included in the 1941 response so that the remaining results can be retrieved. 1942 Default: 100 1943 1944 Constraints: minimum 20, maximum 100 1945 1946 :type marker: string 1947 :param marker: An optional pagination token provided by a previous 1948 DescribeOrderableDBInstanceOptions request. If this parameter is 1949 specified, the response includes only records beyond the marker, up 1950 to the value specified by `MaxRecords` . 1951 1952 """ 1953 params = {} 1954 if subscription_name is not None: 1955 params['SubscriptionName'] = subscription_name 1956 if filters is not None: 1957 self.build_complex_list_params( 1958 params, filters, 1959 'Filters.member', 1960 ('FilterName', 'FilterValue')) 1961 if max_records is not None: 1962 params['MaxRecords'] = max_records 1963 if marker is not None: 1964 params['Marker'] = marker 1965 return self._make_request( 1966 action='DescribeEventSubscriptions', 1967 verb='POST', 1968 path='/', params=params) 1969 1970 def describe_events(self, source_identifier=None, source_type=None, 1971 start_time=None, end_time=None, duration=None, 1972 event_categories=None, max_records=None, marker=None): 1973 """ 1974 Returns events related to DB instances, DB security groups, DB 1975 snapshots, and DB parameter groups for the past 14 days. 1976 Events specific to a particular DB instance, DB security 1977 group, database snapshot, or DB parameter group can be 1978 obtained by providing the name as a parameter. By default, the 1979 past hour of events are returned. 1980 1981 :type source_identifier: string 1982 :param source_identifier: 1983 The identifier of the event source for which events will be returned. 1984 If not specified, then all sources are included in the response. 1985 1986 Constraints: 1987 1988 1989 + If SourceIdentifier is supplied, SourceType must also be provided. 1990 + If the source type is `DBInstance`, then a `DBInstanceIdentifier` 1991 must be supplied. 1992 + If the source type is `DBSecurityGroup`, a `DBSecurityGroupName` must 1993 be supplied. 1994 + If the source type is `DBParameterGroup`, a `DBParameterGroupName` 1995 must be supplied. 1996 + If the source type is `DBSnapshot`, a `DBSnapshotIdentifier` must be 1997 supplied. 1998 + Cannot end with a hyphen or contain two consecutive hyphens. 1999 2000 :type source_type: string 2001 :param source_type: The event source to retrieve events for. If no 2002 value is specified, all events are returned. 2003 2004 :type start_time: timestamp 2005 :param start_time: The beginning of the time interval to retrieve 2006 events for, specified in ISO 8601 format. For more information 2007 about ISO 8601, go to the `ISO8601 Wikipedia page.`_ 2008 Example: 2009-07-08T18:00Z 2009 2010 :type end_time: timestamp 2011 :param end_time: The end of the time interval for which to retrieve 2012 events, specified in ISO 8601 format. For more information about 2013 ISO 8601, go to the `ISO8601 Wikipedia page.`_ 2014 Example: 2009-07-08T18:00Z 2015 2016 :type duration: integer 2017 :param duration: The number of minutes to retrieve events for. 2018 Default: 60 2019 2020 :type event_categories: list 2021 :param event_categories: A list of event categories that trigger 2022 notifications for a event notification subscription. 2023 2024 :type max_records: integer 2025 :param max_records: The maximum number of records to include in the 2026 response. If more records exist than the specified `MaxRecords` 2027 value, a pagination token called a marker is included in the 2028 response so that the remaining results may be retrieved. 2029 Default: 100 2030 2031 Constraints: minimum 20, maximum 100 2032 2033 :type marker: string 2034 :param marker: An optional pagination token provided by a previous 2035 DescribeEvents request. If this parameter is specified, the 2036 response includes only records beyond the marker, up to the value 2037 specified by `MaxRecords`. 2038 2039 """ 2040 params = {} 2041 if source_identifier is not None: 2042 params['SourceIdentifier'] = source_identifier 2043 if source_type is not None: 2044 params['SourceType'] = source_type 2045 if start_time is not None: 2046 params['StartTime'] = start_time 2047 if end_time is not None: 2048 params['EndTime'] = end_time 2049 if duration is not None: 2050 params['Duration'] = duration 2051 if event_categories is not None: 2052 self.build_list_params(params, 2053 event_categories, 2054 'EventCategories.member') 2055 if max_records is not None: 2056 params['MaxRecords'] = max_records 2057 if marker is not None: 2058 params['Marker'] = marker 2059 return self._make_request( 2060 action='DescribeEvents', 2061 verb='POST', 2062 path='/', params=params) 2063 2064 def describe_option_group_options(self, engine_name, 2065 major_engine_version=None, 2066 max_records=None, marker=None): 2067 """ 2068 Describes all available options. 2069 2070 :type engine_name: string 2071 :param engine_name: A required parameter. Options available for the 2072 given Engine name will be described. 2073 2074 :type major_engine_version: string 2075 :param major_engine_version: If specified, filters the results to 2076 include only options for the specified major engine version. 2077 2078 :type max_records: integer 2079 :param max_records: The maximum number of records to include in the 2080 response. If more records exist than the specified `MaxRecords` 2081 value, a pagination token called a marker is included in the 2082 response so that the remaining results can be retrieved. 2083 Default: 100 2084 2085 Constraints: minimum 20, maximum 100 2086 2087 :type marker: string 2088 :param marker: An optional pagination token provided by a previous 2089 request. If this parameter is specified, the response includes only 2090 records beyond the marker, up to the value specified by 2091 `MaxRecords`. 2092 2093 """ 2094 params = {'EngineName': engine_name, } 2095 if major_engine_version is not None: 2096 params['MajorEngineVersion'] = major_engine_version 2097 if max_records is not None: 2098 params['MaxRecords'] = max_records 2099 if marker is not None: 2100 params['Marker'] = marker 2101 return self._make_request( 2102 action='DescribeOptionGroupOptions', 2103 verb='POST', 2104 path='/', params=params) 2105 2106 def describe_option_groups(self, option_group_name=None, filters=None, 2107 marker=None, max_records=None, 2108 engine_name=None, major_engine_version=None): 2109 """ 2110 Describes the available option groups. 2111 2112 :type option_group_name: string 2113 :param option_group_name: The name of the option group to describe. 2114 Cannot be supplied together with EngineName or MajorEngineVersion. 2115 2116 :type filters: list 2117 :param filters: 2118 2119 :type marker: string 2120 :param marker: An optional pagination token provided by a previous 2121 DescribeOptionGroups request. If this parameter is specified, the 2122 response includes only records beyond the marker, up to the value 2123 specified by `MaxRecords`. 2124 2125 :type max_records: integer 2126 :param max_records: The maximum number of records to include in the 2127 response. If more records exist than the specified `MaxRecords` 2128 value, a pagination token called a marker is included in the 2129 response so that the remaining results can be retrieved. 2130 Default: 100 2131 2132 Constraints: minimum 20, maximum 100 2133 2134 :type engine_name: string 2135 :param engine_name: Filters the list of option groups to only include 2136 groups associated with a specific database engine. 2137 2138 :type major_engine_version: string 2139 :param major_engine_version: Filters the list of option groups to only 2140 include groups associated with a specific database engine version. 2141 If specified, then EngineName must also be specified. 2142 2143 """ 2144 params = {} 2145 if option_group_name is not None: 2146 params['OptionGroupName'] = option_group_name 2147 if filters is not None: 2148 self.build_complex_list_params( 2149 params, filters, 2150 'Filters.member', 2151 ('FilterName', 'FilterValue')) 2152 if marker is not None: 2153 params['Marker'] = marker 2154 if max_records is not None: 2155 params['MaxRecords'] = max_records 2156 if engine_name is not None: 2157 params['EngineName'] = engine_name 2158 if major_engine_version is not None: 2159 params['MajorEngineVersion'] = major_engine_version 2160 return self._make_request( 2161 action='DescribeOptionGroups', 2162 verb='POST', 2163 path='/', params=params) 2164 2165 def describe_orderable_db_instance_options(self, engine, 2166 engine_version=None, 2167 db_instance_class=None, 2168 license_model=None, vpc=None, 2169 max_records=None, marker=None): 2170 """ 2171 Returns a list of orderable DB instance options for the 2172 specified engine. 2173 2174 :type engine: string 2175 :param engine: The name of the engine to retrieve DB instance options 2176 for. 2177 2178 :type engine_version: string 2179 :param engine_version: The engine version filter value. Specify this 2180 parameter to show only the available offerings matching the 2181 specified engine version. 2182 2183 :type db_instance_class: string 2184 :param db_instance_class: The DB instance class filter value. Specify 2185 this parameter to show only the available offerings matching the 2186 specified DB instance class. 2187 2188 :type license_model: string 2189 :param license_model: The license model filter value. Specify this 2190 parameter to show only the available offerings matching the 2191 specified license model. 2192 2193 :type vpc: boolean 2194 :param vpc: The VPC filter value. Specify this parameter to show only 2195 the available VPC or non-VPC offerings. 2196 2197 :type max_records: integer 2198 :param max_records: The maximum number of records to include in the 2199 response. If more records exist than the specified `MaxRecords` 2200 value, a pagination token called a marker is included in the 2201 response so that the remaining results can be retrieved. 2202 Default: 100 2203 2204 Constraints: minimum 20, maximum 100 2205 2206 :type marker: string 2207 :param marker: An optional pagination token provided by a previous 2208 DescribeOrderableDBInstanceOptions request. If this parameter is 2209 specified, the response includes only records beyond the marker, up 2210 to the value specified by `MaxRecords` . 2211 2212 """ 2213 params = {'Engine': engine, } 2214 if engine_version is not None: 2215 params['EngineVersion'] = engine_version 2216 if db_instance_class is not None: 2217 params['DBInstanceClass'] = db_instance_class 2218 if license_model is not None: 2219 params['LicenseModel'] = license_model 2220 if vpc is not None: 2221 params['Vpc'] = str( 2222 vpc).lower() 2223 if max_records is not None: 2224 params['MaxRecords'] = max_records 2225 if marker is not None: 2226 params['Marker'] = marker 2227 return self._make_request( 2228 action='DescribeOrderableDBInstanceOptions', 2229 verb='POST', 2230 path='/', params=params) 2231 2232 def describe_reserved_db_instances(self, reserved_db_instance_id=None, 2233 reserved_db_instances_offering_id=None, 2234 db_instance_class=None, duration=None, 2235 product_description=None, 2236 offering_type=None, multi_az=None, 2237 filters=None, max_records=None, 2238 marker=None): 2239 """ 2240 Returns information about reserved DB instances for this 2241 account, or about a specified reserved DB instance. 2242 2243 :type reserved_db_instance_id: string 2244 :param reserved_db_instance_id: The reserved DB instance identifier 2245 filter value. Specify this parameter to show only the reservation 2246 that matches the specified reservation ID. 2247 2248 :type reserved_db_instances_offering_id: string 2249 :param reserved_db_instances_offering_id: The offering identifier 2250 filter value. Specify this parameter to show only purchased 2251 reservations matching the specified offering identifier. 2252 2253 :type db_instance_class: string 2254 :param db_instance_class: The DB instance class filter value. Specify 2255 this parameter to show only those reservations matching the 2256 specified DB instances class. 2257 2258 :type duration: string 2259 :param duration: The duration filter value, specified in years or 2260 seconds. Specify this parameter to show only reservations for this 2261 duration. 2262 Valid Values: `1 | 3 | 31536000 | 94608000` 2263 2264 :type product_description: string 2265 :param product_description: The product description filter value. 2266 Specify this parameter to show only those reservations matching the 2267 specified product description. 2268 2269 :type offering_type: string 2270 :param offering_type: The offering type filter value. Specify this 2271 parameter to show only the available offerings matching the 2272 specified offering type. 2273 Valid Values: `"Light Utilization" | "Medium Utilization" | "Heavy 2274 Utilization" ` 2275 2276 :type multi_az: boolean 2277 :param multi_az: The Multi-AZ filter value. Specify this parameter to 2278 show only those reservations matching the specified Multi-AZ 2279 parameter. 2280 2281 :type filters: list 2282 :param filters: 2283 2284 :type max_records: integer 2285 :param max_records: The maximum number of records to include in the 2286 response. If more than the `MaxRecords` value is available, a 2287 pagination token called a marker is included in the response so 2288 that the following results can be retrieved. 2289 Default: 100 2290 2291 Constraints: minimum 20, maximum 100 2292 2293 :type marker: string 2294 :param marker: An optional pagination token provided by a previous 2295 request. If this parameter is specified, the response includes only 2296 records beyond the marker, up to the value specified by 2297 `MaxRecords`. 2298 2299 """ 2300 params = {} 2301 if reserved_db_instance_id is not None: 2302 params['ReservedDBInstanceId'] = reserved_db_instance_id 2303 if reserved_db_instances_offering_id is not None: 2304 params['ReservedDBInstancesOfferingId'] = reserved_db_instances_offering_id 2305 if db_instance_class is not None: 2306 params['DBInstanceClass'] = db_instance_class 2307 if duration is not None: 2308 params['Duration'] = duration 2309 if product_description is not None: 2310 params['ProductDescription'] = product_description 2311 if offering_type is not None: 2312 params['OfferingType'] = offering_type 2313 if multi_az is not None: 2314 params['MultiAZ'] = str( 2315 multi_az).lower() 2316 if filters is not None: 2317 self.build_complex_list_params( 2318 params, filters, 2319 'Filters.member', 2320 ('FilterName', 'FilterValue')) 2321 if max_records is not None: 2322 params['MaxRecords'] = max_records 2323 if marker is not None: 2324 params['Marker'] = marker 2325 return self._make_request( 2326 action='DescribeReservedDBInstances', 2327 verb='POST', 2328 path='/', params=params) 2329 2330 def describe_reserved_db_instances_offerings(self, 2331 reserved_db_instances_offering_id=None, 2332 db_instance_class=None, 2333 duration=None, 2334 product_description=None, 2335 offering_type=None, 2336 multi_az=None, 2337 max_records=None, 2338 marker=None): 2339 """ 2340 Lists available reserved DB instance offerings. 2341 2342 :type reserved_db_instances_offering_id: string 2343 :param reserved_db_instances_offering_id: The offering identifier 2344 filter value. Specify this parameter to show only the available 2345 offering that matches the specified reservation identifier. 2346 Example: `438012d3-4052-4cc7-b2e3-8d3372e0e706` 2347 2348 :type db_instance_class: string 2349 :param db_instance_class: The DB instance class filter value. Specify 2350 this parameter to show only the available offerings matching the 2351 specified DB instance class. 2352 2353 :type duration: string 2354 :param duration: Duration filter value, specified in years or seconds. 2355 Specify this parameter to show only reservations for this duration. 2356 Valid Values: `1 | 3 | 31536000 | 94608000` 2357 2358 :type product_description: string 2359 :param product_description: Product description filter value. Specify 2360 this parameter to show only the available offerings matching the 2361 specified product description. 2362 2363 :type offering_type: string 2364 :param offering_type: The offering type filter value. Specify this 2365 parameter to show only the available offerings matching the 2366 specified offering type. 2367 Valid Values: `"Light Utilization" | "Medium Utilization" | "Heavy 2368 Utilization" ` 2369 2370 :type multi_az: boolean 2371 :param multi_az: The Multi-AZ filter value. Specify this parameter to 2372 show only the available offerings matching the specified Multi-AZ 2373 parameter. 2374 2375 :type max_records: integer 2376 :param max_records: The maximum number of records to include in the 2377 response. If more than the `MaxRecords` value is available, a 2378 pagination token called a marker is included in the response so 2379 that the following results can be retrieved. 2380 Default: 100 2381 2382 Constraints: minimum 20, maximum 100 2383 2384 :type marker: string 2385 :param marker: An optional pagination token provided by a previous 2386 request. If this parameter is specified, the response includes only 2387 records beyond the marker, up to the value specified by 2388 `MaxRecords`. 2389 2390 """ 2391 params = {} 2392 if reserved_db_instances_offering_id is not None: 2393 params['ReservedDBInstancesOfferingId'] = reserved_db_instances_offering_id 2394 if db_instance_class is not None: 2395 params['DBInstanceClass'] = db_instance_class 2396 if duration is not None: 2397 params['Duration'] = duration 2398 if product_description is not None: 2399 params['ProductDescription'] = product_description 2400 if offering_type is not None: 2401 params['OfferingType'] = offering_type 2402 if multi_az is not None: 2403 params['MultiAZ'] = str( 2404 multi_az).lower() 2405 if max_records is not None: 2406 params['MaxRecords'] = max_records 2407 if marker is not None: 2408 params['Marker'] = marker 2409 return self._make_request( 2410 action='DescribeReservedDBInstancesOfferings', 2411 verb='POST', 2412 path='/', params=params) 2413 2414 def download_db_log_file_portion(self, db_instance_identifier, 2415 log_file_name, marker=None, 2416 number_of_lines=None): 2417 """ 2418 Downloads the last line of the specified log file. 2419 2420 :type db_instance_identifier: string 2421 :param db_instance_identifier: 2422 The customer-assigned name of the DB instance that contains the log 2423 files you want to list. 2424 2425 Constraints: 2426 2427 2428 + Must contain from 1 to 63 alphanumeric characters or hyphens 2429 + First character must be a letter 2430 + Cannot end with a hyphen or contain two consecutive hyphens 2431 2432 :type log_file_name: string 2433 :param log_file_name: The name of the log file to be downloaded. 2434 2435 :type marker: string 2436 :param marker: The pagination token provided in the previous request. 2437 If this parameter is specified the response includes only records 2438 beyond the marker, up to MaxRecords. 2439 2440 :type number_of_lines: integer 2441 :param number_of_lines: The number of lines remaining to be downloaded. 2442 2443 """ 2444 params = { 2445 'DBInstanceIdentifier': db_instance_identifier, 2446 'LogFileName': log_file_name, 2447 } 2448 if marker is not None: 2449 params['Marker'] = marker 2450 if number_of_lines is not None: 2451 params['NumberOfLines'] = number_of_lines 2452 return self._make_request( 2453 action='DownloadDBLogFilePortion', 2454 verb='POST', 2455 path='/', params=params) 2456 2457 def list_tags_for_resource(self, resource_name): 2458 """ 2459 Lists all tags on an Amazon RDS resource. 2460 2461 For an overview on tagging an Amazon RDS resource, see 2462 `Tagging Amazon RDS Resources`_. 2463 2464 :type resource_name: string 2465 :param resource_name: The Amazon RDS resource with tags to be listed. 2466 This value is an Amazon Resource Name (ARN). For information about 2467 creating an ARN, see ` Constructing an RDS Amazon Resource Name 2468 (ARN)`_. 2469 2470 """ 2471 params = {'ResourceName': resource_name, } 2472 return self._make_request( 2473 action='ListTagsForResource', 2474 verb='POST', 2475 path='/', params=params) 2476 2477 def modify_db_instance(self, db_instance_identifier, 2478 allocated_storage=None, db_instance_class=None, 2479 db_security_groups=None, 2480 vpc_security_group_ids=None, 2481 apply_immediately=None, master_user_password=None, 2482 db_parameter_group_name=None, 2483 backup_retention_period=None, 2484 preferred_backup_window=None, 2485 preferred_maintenance_window=None, multi_az=None, 2486 engine_version=None, 2487 allow_major_version_upgrade=None, 2488 auto_minor_version_upgrade=None, iops=None, 2489 option_group_name=None, 2490 new_db_instance_identifier=None): 2491 """ 2492 Modify settings for a DB instance. You can change one or more 2493 database configuration parameters by specifying these 2494 parameters and the new values in the request. 2495 2496 :type db_instance_identifier: string 2497 :param db_instance_identifier: 2498 The DB instance identifier. This value is stored as a lowercase string. 2499 2500 Constraints: 2501 2502 2503 + Must be the identifier for an existing DB instance 2504 + Must contain from 1 to 63 alphanumeric characters or hyphens 2505 + First character must be a letter 2506 + Cannot end with a hyphen or contain two consecutive hyphens 2507 2508 :type allocated_storage: integer 2509 :param allocated_storage: The new storage capacity of the RDS instance. 2510 Changing this parameter does not result in an outage and the change 2511 is applied during the next maintenance window unless the 2512 `ApplyImmediately` parameter is set to `True` for this request. 2513 **MySQL** 2514 2515 Default: Uses existing setting 2516 2517 Valid Values: 5-1024 2518 2519 Constraints: Value supplied must be at least 10% greater than the 2520 current value. Values that are not at least 10% greater than the 2521 existing value are rounded up so that they are 10% greater than the 2522 current value. 2523 2524 Type: Integer 2525 2526 **Oracle** 2527 2528 Default: Uses existing setting 2529 2530 Valid Values: 10-1024 2531 2532 Constraints: Value supplied must be at least 10% greater than the 2533 current value. Values that are not at least 10% greater than the 2534 existing value are rounded up so that they are 10% greater than the 2535 current value. 2536 2537 **SQL Server** 2538 2539 Cannot be modified. 2540 2541 If you choose to migrate your DB instance from using standard storage 2542 to using Provisioned IOPS, or from using Provisioned IOPS to using 2543 standard storage, the process can take time. The duration of the 2544 migration depends on several factors such as database load, storage 2545 size, storage type (standard or Provisioned IOPS), amount of IOPS 2546 provisioned (if any), and the number of prior scale storage 2547 operations. Typical migration times are under 24 hours, but the 2548 process can take up to several days in some cases. During the 2549 migration, the DB instance will be available for use, but may 2550 experience performance degradation. While the migration takes 2551 place, nightly backups for the instance will be suspended. No other 2552 Amazon RDS operations can take place for the instance, including 2553 modifying the instance, rebooting the instance, deleting the 2554 instance, creating a read replica for the instance, and creating a 2555 DB snapshot of the instance. 2556 2557 :type db_instance_class: string 2558 :param db_instance_class: The new compute and memory capacity of the DB 2559 instance. To determine the instance classes that are available for 2560 a particular DB engine, use the DescribeOrderableDBInstanceOptions 2561 action. 2562 Passing a value for this parameter causes an outage during the change 2563 and is applied during the next maintenance window, unless the 2564 `ApplyImmediately` parameter is specified as `True` for this 2565 request. 2566 2567 Default: Uses existing setting 2568 2569 Valid Values: `db.t1.micro | db.m1.small | db.m1.medium | db.m1.large | 2570 db.m1.xlarge | db.m2.xlarge | db.m2.2xlarge | db.m2.4xlarge` 2571 2572 :type db_security_groups: list 2573 :param db_security_groups: 2574 A list of DB security groups to authorize on this DB instance. Changing 2575 this parameter does not result in an outage and the change is 2576 asynchronously applied as soon as possible. 2577 2578 Constraints: 2579 2580 2581 + Must be 1 to 255 alphanumeric characters 2582 + First character must be a letter 2583 + Cannot end with a hyphen or contain two consecutive hyphens 2584 2585 :type vpc_security_group_ids: list 2586 :param vpc_security_group_ids: 2587 A list of EC2 VPC security groups to authorize on this DB instance. 2588 This change is asynchronously applied as soon as possible. 2589 2590 Constraints: 2591 2592 2593 + Must be 1 to 255 alphanumeric characters 2594 + First character must be a letter 2595 + Cannot end with a hyphen or contain two consecutive hyphens 2596 2597 :type apply_immediately: boolean 2598 :param apply_immediately: Specifies whether or not the modifications in 2599 this request and any pending modifications are asynchronously 2600 applied as soon as possible, regardless of the 2601 `PreferredMaintenanceWindow` setting for the DB instance. 2602 If this parameter is passed as `False`, changes to the DB instance are 2603 applied on the next call to RebootDBInstance, the next maintenance 2604 reboot, or the next failure reboot, whichever occurs first. See 2605 each parameter to determine when a change is applied. 2606 2607 Default: `False` 2608 2609 :type master_user_password: string 2610 :param master_user_password: 2611 The new password for the DB instance master user. Can be any printable 2612 ASCII character except "/", '"', or "@". 2613 2614 Changing this parameter does not result in an outage and the change is 2615 asynchronously applied as soon as possible. Between the time of the 2616 request and the completion of the request, the `MasterUserPassword` 2617 element exists in the `PendingModifiedValues` element of the 2618 operation response. 2619 2620 Default: Uses existing setting 2621 2622 Constraints: Must be 8 to 41 alphanumeric characters (MySQL), 8 to 30 2623 alphanumeric characters (Oracle), or 8 to 128 alphanumeric 2624 characters (SQL Server). 2625 2626 Amazon RDS API actions never return the password, so this action 2627 provides a way to regain access to a master instance user if the 2628 password is lost. 2629 2630 :type db_parameter_group_name: string 2631 :param db_parameter_group_name: The name of the DB parameter group to 2632 apply to this DB instance. Changing this parameter does not result 2633 in an outage and the change is applied during the next maintenance 2634 window unless the `ApplyImmediately` parameter is set to `True` for 2635 this request. 2636 Default: Uses existing setting 2637 2638 Constraints: The DB parameter group must be in the same DB parameter 2639 group family as this DB instance. 2640 2641 :type backup_retention_period: integer 2642 :param backup_retention_period: 2643 The number of days to retain automated backups. Setting this parameter 2644 to a positive number enables backups. Setting this parameter to 0 2645 disables automated backups. 2646 2647 Changing this parameter can result in an outage if you change from 0 to 2648 a non-zero value or from a non-zero value to 0. These changes are 2649 applied during the next maintenance window unless the 2650 `ApplyImmediately` parameter is set to `True` for this request. If 2651 you change the parameter from one non-zero value to another non- 2652 zero value, the change is asynchronously applied as soon as 2653 possible. 2654 2655 Default: Uses existing setting 2656 2657 Constraints: 2658 2659 2660 + Must be a value from 0 to 8 2661 + Cannot be set to 0 if the DB instance is a master instance with read 2662 replicas or if the DB instance is a read replica 2663 2664 :type preferred_backup_window: string 2665 :param preferred_backup_window: 2666 The daily time range during which automated backups are created if 2667 automated backups are enabled, as determined by the 2668 `BackupRetentionPeriod`. Changing this parameter does not result in 2669 an outage and the change is asynchronously applied as soon as 2670 possible. 2671 2672 Constraints: 2673 2674 2675 + Must be in the format hh24:mi-hh24:mi 2676 + Times should be Universal Time Coordinated (UTC) 2677 + Must not conflict with the preferred maintenance window 2678 + Must be at least 30 minutes 2679 2680 :type preferred_maintenance_window: string 2681 :param preferred_maintenance_window: The weekly time range (in UTC) 2682 during which system maintenance can occur, which may result in an 2683 outage. Changing this parameter does not result in an outage, 2684 except in the following situation, and the change is asynchronously 2685 applied as soon as possible. If there are pending actions that 2686 cause a reboot, and the maintenance window is changed to include 2687 the current time, then changing this parameter will cause a reboot 2688 of the DB instance. If moving this window to the current time, 2689 there must be at least 30 minutes between the current time and end 2690 of the window to ensure pending changes are applied. 2691 Default: Uses existing setting 2692 2693 Format: ddd:hh24:mi-ddd:hh24:mi 2694 2695 Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun 2696 2697 Constraints: Must be at least 30 minutes 2698 2699 :type multi_az: boolean 2700 :param multi_az: Specifies if the DB instance is a Multi-AZ deployment. 2701 Changing this parameter does not result in an outage and the change 2702 is applied during the next maintenance window unless the 2703 `ApplyImmediately` parameter is set to `True` for this request. 2704 Constraints: Cannot be specified if the DB instance is a read replica. 2705 2706 :type engine_version: string 2707 :param engine_version: The version number of the database engine to 2708 upgrade to. Changing this parameter results in an outage and the 2709 change is applied during the next maintenance window unless the 2710 `ApplyImmediately` parameter is set to `True` for this request. 2711 For major version upgrades, if a non-default DB parameter group is 2712 currently in use, a new DB parameter group in the DB parameter 2713 group family for the new engine version must be specified. The new 2714 DB parameter group can be the default for that DB parameter group 2715 family. 2716 2717 Example: `5.1.42` 2718 2719 :type allow_major_version_upgrade: boolean 2720 :param allow_major_version_upgrade: Indicates that major version 2721 upgrades are allowed. Changing this parameter does not result in an 2722 outage and the change is asynchronously applied as soon as 2723 possible. 2724 Constraints: This parameter must be set to true when specifying a value 2725 for the EngineVersion parameter that is a different major version 2726 than the DB instance's current version. 2727 2728 :type auto_minor_version_upgrade: boolean 2729 :param auto_minor_version_upgrade: Indicates that minor version 2730 upgrades will be applied automatically to the DB instance during 2731 the maintenance window. Changing this parameter does not result in 2732 an outage except in the following case and the change is 2733 asynchronously applied as soon as possible. An outage will result 2734 if this parameter is set to `True` during the maintenance window, 2735 and a newer minor version is available, and RDS has enabled auto 2736 patching for that engine version. 2737 2738 :type iops: integer 2739 :param iops: The new Provisioned IOPS (I/O operations per second) value 2740 for the RDS instance. Changing this parameter does not result in an 2741 outage and the change is applied during the next maintenance window 2742 unless the `ApplyImmediately` parameter is set to `True` for this 2743 request. 2744 Default: Uses existing setting 2745 2746 Constraints: Value supplied must be at least 10% greater than the 2747 current value. Values that are not at least 10% greater than the 2748 existing value are rounded up so that they are 10% greater than the 2749 current value. 2750 2751 Type: Integer 2752 2753 If you choose to migrate your DB instance from using standard storage 2754 to using Provisioned IOPS, or from using Provisioned IOPS to using 2755 standard storage, the process can take time. The duration of the 2756 migration depends on several factors such as database load, storage 2757 size, storage type (standard or Provisioned IOPS), amount of IOPS 2758 provisioned (if any), and the number of prior scale storage 2759 operations. Typical migration times are under 24 hours, but the 2760 process can take up to several days in some cases. During the 2761 migration, the DB instance will be available for use, but may 2762 experience performance degradation. While the migration takes 2763 place, nightly backups for the instance will be suspended. No other 2764 Amazon RDS operations can take place for the instance, including 2765 modifying the instance, rebooting the instance, deleting the 2766 instance, creating a read replica for the instance, and creating a 2767 DB snapshot of the instance. 2768 2769 :type option_group_name: string 2770 :param option_group_name: Indicates that the DB instance should be 2771 associated with the specified option group. Changing this parameter 2772 does not result in an outage except in the following case and the 2773 change is applied during the next maintenance window unless the 2774 `ApplyImmediately` parameter is set to `True` for this request. If 2775 the parameter change results in an option group that enables OEM, 2776 this change can cause a brief (sub-second) period during which new 2777 connections are rejected but existing connections are not 2778 interrupted. 2779 Permanent options, such as the TDE option for Oracle Advanced Security 2780 TDE, cannot be removed from an option group, and that option group 2781 cannot be removed from a DB instance once it is associated with a 2782 DB instance 2783 2784 :type new_db_instance_identifier: string 2785 :param new_db_instance_identifier: 2786 The new DB instance identifier for the DB instance when renaming a DB 2787 Instance. This value is stored as a lowercase string. 2788 2789 Constraints: 2790 2791 2792 + Must contain from 1 to 63 alphanumeric characters or hyphens 2793 + First character must be a letter 2794 + Cannot end with a hyphen or contain two consecutive hyphens 2795 2796 """ 2797 params = {'DBInstanceIdentifier': db_instance_identifier, } 2798 if allocated_storage is not None: 2799 params['AllocatedStorage'] = allocated_storage 2800 if db_instance_class is not None: 2801 params['DBInstanceClass'] = db_instance_class 2802 if db_security_groups is not None: 2803 self.build_list_params(params, 2804 db_security_groups, 2805 'DBSecurityGroups.member') 2806 if vpc_security_group_ids is not None: 2807 self.build_list_params(params, 2808 vpc_security_group_ids, 2809 'VpcSecurityGroupIds.member') 2810 if apply_immediately is not None: 2811 params['ApplyImmediately'] = str( 2812 apply_immediately).lower() 2813 if master_user_password is not None: 2814 params['MasterUserPassword'] = master_user_password 2815 if db_parameter_group_name is not None: 2816 params['DBParameterGroupName'] = db_parameter_group_name 2817 if backup_retention_period is not None: 2818 params['BackupRetentionPeriod'] = backup_retention_period 2819 if preferred_backup_window is not None: 2820 params['PreferredBackupWindow'] = preferred_backup_window 2821 if preferred_maintenance_window is not None: 2822 params['PreferredMaintenanceWindow'] = preferred_maintenance_window 2823 if multi_az is not None: 2824 params['MultiAZ'] = str( 2825 multi_az).lower() 2826 if engine_version is not None: 2827 params['EngineVersion'] = engine_version 2828 if allow_major_version_upgrade is not None: 2829 params['AllowMajorVersionUpgrade'] = str( 2830 allow_major_version_upgrade).lower() 2831 if auto_minor_version_upgrade is not None: 2832 params['AutoMinorVersionUpgrade'] = str( 2833 auto_minor_version_upgrade).lower() 2834 if iops is not None: 2835 params['Iops'] = iops 2836 if option_group_name is not None: 2837 params['OptionGroupName'] = option_group_name 2838 if new_db_instance_identifier is not None: 2839 params['NewDBInstanceIdentifier'] = new_db_instance_identifier 2840 return self._make_request( 2841 action='ModifyDBInstance', 2842 verb='POST', 2843 path='/', params=params) 2844 2845 def modify_db_parameter_group(self, db_parameter_group_name, parameters): 2846 """ 2847 Modifies the parameters of a DB parameter group. To modify 2848 more than one parameter, submit a list of the following: 2849 `ParameterName`, `ParameterValue`, and `ApplyMethod`. A 2850 maximum of 20 parameters can be modified in a single request. 2851 2852 The `apply-immediate` method can be used only for dynamic 2853 parameters; the `pending-reboot` method can be used with MySQL 2854 and Oracle DB instances for either dynamic or static 2855 parameters. For Microsoft SQL Server DB instances, the 2856 `pending-reboot` method can be used only for static 2857 parameters. 2858 2859 :type db_parameter_group_name: string 2860 :param db_parameter_group_name: 2861 The name of the DB parameter group. 2862 2863 Constraints: 2864 2865 2866 + Must be the name of an existing DB parameter group 2867 + Must be 1 to 255 alphanumeric characters 2868 + First character must be a letter 2869 + Cannot end with a hyphen or contain two consecutive hyphens 2870 2871 :type parameters: list 2872 :param parameters: 2873 An array of parameter names, values, and the apply method for the 2874 parameter update. At least one parameter name, value, and apply 2875 method must be supplied; subsequent arguments are optional. A 2876 maximum of 20 parameters may be modified in a single request. 2877 2878 Valid Values (for the application method): `immediate | pending-reboot` 2879 2880 You can use the immediate value with dynamic parameters only. You can 2881 use the pending-reboot value for both dynamic and static 2882 parameters, and changes are applied when DB instance reboots. 2883 2884 """ 2885 params = {'DBParameterGroupName': db_parameter_group_name, } 2886 self.build_complex_list_params( 2887 params, parameters, 2888 'Parameters.member', 2889 ('ParameterName', 'ParameterValue', 'Description', 'Source', 'ApplyType', 'DataType', 'AllowedValues', 'IsModifiable', 'MinimumEngineVersion', 'ApplyMethod')) 2890 return self._make_request( 2891 action='ModifyDBParameterGroup', 2892 verb='POST', 2893 path='/', params=params) 2894 2895 def modify_db_subnet_group(self, db_subnet_group_name, subnet_ids, 2896 db_subnet_group_description=None): 2897 """ 2898 Modifies an existing DB subnet group. DB subnet groups must 2899 contain at least one subnet in at least two AZs in the region. 2900 2901 :type db_subnet_group_name: string 2902 :param db_subnet_group_name: The name for the DB subnet group. This 2903 value is stored as a lowercase string. 2904 Constraints: Must contain no more than 255 alphanumeric characters or 2905 hyphens. Must not be "Default". 2906 2907 Example: `mySubnetgroup` 2908 2909 :type db_subnet_group_description: string 2910 :param db_subnet_group_description: The description for the DB subnet 2911 group. 2912 2913 :type subnet_ids: list 2914 :param subnet_ids: The EC2 subnet IDs for the DB subnet group. 2915 2916 """ 2917 params = {'DBSubnetGroupName': db_subnet_group_name, } 2918 self.build_list_params(params, 2919 subnet_ids, 2920 'SubnetIds.member') 2921 if db_subnet_group_description is not None: 2922 params['DBSubnetGroupDescription'] = db_subnet_group_description 2923 return self._make_request( 2924 action='ModifyDBSubnetGroup', 2925 verb='POST', 2926 path='/', params=params) 2927 2928 def modify_event_subscription(self, subscription_name, 2929 sns_topic_arn=None, source_type=None, 2930 event_categories=None, enabled=None): 2931 """ 2932 Modifies an existing RDS event notification subscription. Note 2933 that you cannot modify the source identifiers using this call; 2934 to change source identifiers for a subscription, use the 2935 AddSourceIdentifierToSubscription and 2936 RemoveSourceIdentifierFromSubscription calls. 2937 2938 You can see a list of the event categories for a given 2939 SourceType in the `Events`_ topic in the Amazon RDS User Guide 2940 or by using the **DescribeEventCategories** action. 2941 2942 :type subscription_name: string 2943 :param subscription_name: The name of the RDS event notification 2944 subscription. 2945 2946 :type sns_topic_arn: string 2947 :param sns_topic_arn: The Amazon Resource Name (ARN) of the SNS topic 2948 created for event notification. The ARN is created by Amazon SNS 2949 when you create a topic and subscribe to it. 2950 2951 :type source_type: string 2952 :param source_type: The type of source that will be generating the 2953 events. For example, if you want to be notified of events generated 2954 by a DB instance, you would set this parameter to db-instance. if 2955 this value is not specified, all events are returned. 2956 Valid values: db-instance | db-parameter-group | db-security-group | 2957 db-snapshot 2958 2959 :type event_categories: list 2960 :param event_categories: A list of event categories for a SourceType 2961 that you want to subscribe to. You can see a list of the categories 2962 for a given SourceType in the `Events`_ topic in the Amazon RDS 2963 User Guide or by using the **DescribeEventCategories** action. 2964 2965 :type enabled: boolean 2966 :param enabled: A Boolean value; set to **true** to activate the 2967 subscription. 2968 2969 """ 2970 params = {'SubscriptionName': subscription_name, } 2971 if sns_topic_arn is not None: 2972 params['SnsTopicArn'] = sns_topic_arn 2973 if source_type is not None: 2974 params['SourceType'] = source_type 2975 if event_categories is not None: 2976 self.build_list_params(params, 2977 event_categories, 2978 'EventCategories.member') 2979 if enabled is not None: 2980 params['Enabled'] = str( 2981 enabled).lower() 2982 return self._make_request( 2983 action='ModifyEventSubscription', 2984 verb='POST', 2985 path='/', params=params) 2986 2987 def modify_option_group(self, option_group_name, options_to_include=None, 2988 options_to_remove=None, apply_immediately=None): 2989 """ 2990 Modifies an existing option group. 2991 2992 :type option_group_name: string 2993 :param option_group_name: The name of the option group to be modified. 2994 Permanent options, such as the TDE option for Oracle Advanced Security 2995 TDE, cannot be removed from an option group, and that option group 2996 cannot be removed from a DB instance once it is associated with a 2997 DB instance 2998 2999 :type options_to_include: list 3000 :param options_to_include: Options in this list are added to the option 3001 group or, if already present, the specified configuration is used 3002 to update the existing configuration. 3003 3004 :type options_to_remove: list 3005 :param options_to_remove: Options in this list are removed from the 3006 option group. 3007 3008 :type apply_immediately: boolean 3009 :param apply_immediately: Indicates whether the changes should be 3010 applied immediately, or during the next maintenance window for each 3011 instance associated with the option group. 3012 3013 """ 3014 params = {'OptionGroupName': option_group_name, } 3015 if options_to_include is not None: 3016 self.build_complex_list_params( 3017 params, options_to_include, 3018 'OptionsToInclude.member', 3019 ('OptionName', 'Port', 'DBSecurityGroupMemberships', 'VpcSecurityGroupMemberships', 'OptionSettings')) 3020 if options_to_remove is not None: 3021 self.build_list_params(params, 3022 options_to_remove, 3023 'OptionsToRemove.member') 3024 if apply_immediately is not None: 3025 params['ApplyImmediately'] = str( 3026 apply_immediately).lower() 3027 return self._make_request( 3028 action='ModifyOptionGroup', 3029 verb='POST', 3030 path='/', params=params) 3031 3032 def promote_read_replica(self, db_instance_identifier, 3033 backup_retention_period=None, 3034 preferred_backup_window=None): 3035 """ 3036 Promotes a read replica DB instance to a standalone DB 3037 instance. 3038 3039 :type db_instance_identifier: string 3040 :param db_instance_identifier: The DB instance identifier. This value 3041 is stored as a lowercase string. 3042 Constraints: 3043 3044 3045 + Must be the identifier for an existing read replica DB instance 3046 + Must contain from 1 to 63 alphanumeric characters or hyphens 3047 + First character must be a letter 3048 + Cannot end with a hyphen or contain two consecutive hyphens 3049 3050 3051 Example: mydbinstance 3052 3053 :type backup_retention_period: integer 3054 :param backup_retention_period: 3055 The number of days to retain automated backups. Setting this parameter 3056 to a positive number enables backups. Setting this parameter to 0 3057 disables automated backups. 3058 3059 Default: 1 3060 3061 Constraints: 3062 3063 3064 + Must be a value from 0 to 8 3065 3066 :type preferred_backup_window: string 3067 :param preferred_backup_window: The daily time range during which 3068 automated backups are created if automated backups are enabled, 3069 using the `BackupRetentionPeriod` parameter. 3070 Default: A 30-minute window selected at random from an 8-hour block of 3071 time per region. See the Amazon RDS User Guide for the time blocks 3072 for each region from which the default backup windows are assigned. 3073 3074 Constraints: Must be in the format `hh24:mi-hh24:mi`. Times should be 3075 Universal Time Coordinated (UTC). Must not conflict with the 3076 preferred maintenance window. Must be at least 30 minutes. 3077 3078 """ 3079 params = {'DBInstanceIdentifier': db_instance_identifier, } 3080 if backup_retention_period is not None: 3081 params['BackupRetentionPeriod'] = backup_retention_period 3082 if preferred_backup_window is not None: 3083 params['PreferredBackupWindow'] = preferred_backup_window 3084 return self._make_request( 3085 action='PromoteReadReplica', 3086 verb='POST', 3087 path='/', params=params) 3088 3089 def purchase_reserved_db_instances_offering(self, 3090 reserved_db_instances_offering_id, 3091 reserved_db_instance_id=None, 3092 db_instance_count=None, 3093 tags=None): 3094 """ 3095 Purchases a reserved DB instance offering. 3096 3097 :type reserved_db_instances_offering_id: string 3098 :param reserved_db_instances_offering_id: The ID of the Reserved DB 3099 instance offering to purchase. 3100 Example: 438012d3-4052-4cc7-b2e3-8d3372e0e706 3101 3102 :type reserved_db_instance_id: string 3103 :param reserved_db_instance_id: Customer-specified identifier to track 3104 this reservation. 3105 Example: myreservationID 3106 3107 :type db_instance_count: integer 3108 :param db_instance_count: The number of instances to reserve. 3109 Default: `1` 3110 3111 :type tags: list 3112 :param tags: A list of tags. 3113 3114 """ 3115 params = { 3116 'ReservedDBInstancesOfferingId': reserved_db_instances_offering_id, 3117 } 3118 if reserved_db_instance_id is not None: 3119 params['ReservedDBInstanceId'] = reserved_db_instance_id 3120 if db_instance_count is not None: 3121 params['DBInstanceCount'] = db_instance_count 3122 if tags is not None: 3123 self.build_complex_list_params( 3124 params, tags, 3125 'Tags.member', 3126 ('Key', 'Value')) 3127 return self._make_request( 3128 action='PurchaseReservedDBInstancesOffering', 3129 verb='POST', 3130 path='/', params=params) 3131 3132 def reboot_db_instance(self, db_instance_identifier, force_failover=None): 3133 """ 3134 Rebooting a DB instance restarts the database engine service. 3135 A reboot also applies to the DB instance any modifications to 3136 the associated DB parameter group that were pending. Rebooting 3137 a DB instance results in a momentary outage of the instance, 3138 during which the DB instance status is set to rebooting. If 3139 the RDS instance is configured for MultiAZ, it is possible 3140 that the reboot will be conducted through a failover. An 3141 Amazon RDS event is created when the reboot is completed. 3142 3143 If your DB instance is deployed in multiple Availability 3144 Zones, you can force a failover from one AZ to the other 3145 during the reboot. You might force a failover to test the 3146 availability of your DB instance deployment or to restore 3147 operations to the original AZ after a failover occurs. 3148 3149 The time required to reboot is a function of the specific 3150 database engine's crash recovery process. To improve the 3151 reboot time, we recommend that you reduce database activities 3152 as much as possible during the reboot process to reduce 3153 rollback activity for in-transit transactions. 3154 3155 :type db_instance_identifier: string 3156 :param db_instance_identifier: 3157 The DB instance identifier. This parameter is stored as a lowercase 3158 string. 3159 3160 Constraints: 3161 3162 3163 + Must contain from 1 to 63 alphanumeric characters or hyphens 3164 + First character must be a letter 3165 + Cannot end with a hyphen or contain two consecutive hyphens 3166 3167 :type force_failover: boolean 3168 :param force_failover: When `True`, the reboot will be conducted 3169 through a MultiAZ failover. 3170 Constraint: You cannot specify `True` if the instance is not configured 3171 for MultiAZ. 3172 3173 """ 3174 params = {'DBInstanceIdentifier': db_instance_identifier, } 3175 if force_failover is not None: 3176 params['ForceFailover'] = str( 3177 force_failover).lower() 3178 return self._make_request( 3179 action='RebootDBInstance', 3180 verb='POST', 3181 path='/', params=params) 3182 3183 def remove_source_identifier_from_subscription(self, subscription_name, 3184 source_identifier): 3185 """ 3186 Removes a source identifier from an existing RDS event 3187 notification subscription. 3188 3189 :type subscription_name: string 3190 :param subscription_name: The name of the RDS event notification 3191 subscription you want to remove a source identifier from. 3192 3193 :type source_identifier: string 3194 :param source_identifier: The source identifier to be removed from the 3195 subscription, such as the **DB instance identifier** for a DB 3196 instance or the name of a security group. 3197 3198 """ 3199 params = { 3200 'SubscriptionName': subscription_name, 3201 'SourceIdentifier': source_identifier, 3202 } 3203 return self._make_request( 3204 action='RemoveSourceIdentifierFromSubscription', 3205 verb='POST', 3206 path='/', params=params) 3207 3208 def remove_tags_from_resource(self, resource_name, tag_keys): 3209 """ 3210 Removes metadata tags from an Amazon RDS resource. 3211 3212 For an overview on tagging an Amazon RDS resource, see 3213 `Tagging Amazon RDS Resources`_. 3214 3215 :type resource_name: string 3216 :param resource_name: The Amazon RDS resource the tags will be removed 3217 from. This value is an Amazon Resource Name (ARN). For information 3218 about creating an ARN, see ` Constructing an RDS Amazon Resource 3219 Name (ARN)`_. 3220 3221 :type tag_keys: list 3222 :param tag_keys: The tag key (name) of the tag to be removed. 3223 3224 """ 3225 params = {'ResourceName': resource_name, } 3226 self.build_list_params(params, 3227 tag_keys, 3228 'TagKeys.member') 3229 return self._make_request( 3230 action='RemoveTagsFromResource', 3231 verb='POST', 3232 path='/', params=params) 3233 3234 def reset_db_parameter_group(self, db_parameter_group_name, 3235 reset_all_parameters=None, parameters=None): 3236 """ 3237 Modifies the parameters of a DB parameter group to the 3238 engine/system default value. To reset specific parameters 3239 submit a list of the following: `ParameterName` and 3240 `ApplyMethod`. To reset the entire DB parameter group, specify 3241 the `DBParameterGroup` name and `ResetAllParameters` 3242 parameters. When resetting the entire group, dynamic 3243 parameters are updated immediately and static parameters are 3244 set to `pending-reboot` to take effect on the next DB instance 3245 restart or `RebootDBInstance` request. 3246 3247 :type db_parameter_group_name: string 3248 :param db_parameter_group_name: 3249 The name of the DB parameter group. 3250 3251 Constraints: 3252 3253 3254 + Must be 1 to 255 alphanumeric characters 3255 + First character must be a letter 3256 + Cannot end with a hyphen or contain two consecutive hyphens 3257 3258 :type reset_all_parameters: boolean 3259 :param reset_all_parameters: Specifies whether ( `True`) or not ( 3260 `False`) to reset all parameters in the DB parameter group to 3261 default values. 3262 Default: `True` 3263 3264 :type parameters: list 3265 :param parameters: An array of parameter names, values, and the apply 3266 method for the parameter update. At least one parameter name, 3267 value, and apply method must be supplied; subsequent arguments are 3268 optional. A maximum of 20 parameters may be modified in a single 3269 request. 3270 **MySQL** 3271 3272 Valid Values (for Apply method): `immediate` | `pending-reboot` 3273 3274 You can use the immediate value with dynamic parameters only. You can 3275 use the `pending-reboot` value for both dynamic and static 3276 parameters, and changes are applied when DB instance reboots. 3277 3278 **Oracle** 3279 3280 Valid Values (for Apply method): `pending-reboot` 3281 3282 """ 3283 params = {'DBParameterGroupName': db_parameter_group_name, } 3284 if reset_all_parameters is not None: 3285 params['ResetAllParameters'] = str( 3286 reset_all_parameters).lower() 3287 if parameters is not None: 3288 self.build_complex_list_params( 3289 params, parameters, 3290 'Parameters.member', 3291 ('ParameterName', 'ParameterValue', 'Description', 'Source', 'ApplyType', 'DataType', 'AllowedValues', 'IsModifiable', 'MinimumEngineVersion', 'ApplyMethod')) 3292 return self._make_request( 3293 action='ResetDBParameterGroup', 3294 verb='POST', 3295 path='/', params=params) 3296 3297 def restore_db_instance_from_db_snapshot(self, db_instance_identifier, 3298 db_snapshot_identifier, 3299 db_instance_class=None, 3300 port=None, 3301 availability_zone=None, 3302 db_subnet_group_name=None, 3303 multi_az=None, 3304 publicly_accessible=None, 3305 auto_minor_version_upgrade=None, 3306 license_model=None, 3307 db_name=None, engine=None, 3308 iops=None, 3309 option_group_name=None, 3310 tags=None): 3311 """ 3312 Creates a new DB instance from a DB snapshot. The target 3313 database is created from the source database restore point 3314 with the same configuration as the original source database, 3315 except that the new RDS instance is created with the default 3316 security group. 3317 3318 :type db_instance_identifier: string 3319 :param db_instance_identifier: 3320 The identifier for the DB snapshot to restore from. 3321 3322 Constraints: 3323 3324 3325 + Must contain from 1 to 63 alphanumeric characters or hyphens 3326 + First character must be a letter 3327 + Cannot end with a hyphen or contain two consecutive hyphens 3328 3329 :type db_snapshot_identifier: string 3330 :param db_snapshot_identifier: Name of the DB instance to create from 3331 the DB snapshot. This parameter isn't case sensitive. 3332 Constraints: 3333 3334 3335 + Must contain from 1 to 255 alphanumeric characters or hyphens 3336 + First character must be a letter 3337 + Cannot end with a hyphen or contain two consecutive hyphens 3338 3339 3340 Example: `my-snapshot-id` 3341 3342 :type db_instance_class: string 3343 :param db_instance_class: The compute and memory capacity of the Amazon 3344 RDS DB instance. 3345 Valid Values: `db.t1.micro | db.m1.small | db.m1.medium | db.m1.large | 3346 db.m1.xlarge | db.m2.2xlarge | db.m2.4xlarge` 3347 3348 :type port: integer 3349 :param port: The port number on which the database accepts connections. 3350 Default: The same port as the original DB instance 3351 3352 Constraints: Value must be `1150-65535` 3353 3354 :type availability_zone: string 3355 :param availability_zone: The EC2 Availability Zone that the database 3356 instance will be created in. 3357 Default: A random, system-chosen Availability Zone. 3358 3359 Constraint: You cannot specify the AvailabilityZone parameter if the 3360 MultiAZ parameter is set to `True`. 3361 3362 Example: `us-east-1a` 3363 3364 :type db_subnet_group_name: string 3365 :param db_subnet_group_name: The DB subnet group name to use for the 3366 new instance. 3367 3368 :type multi_az: boolean 3369 :param multi_az: Specifies if the DB instance is a Multi-AZ deployment. 3370 Constraint: You cannot specify the AvailabilityZone parameter if the 3371 MultiAZ parameter is set to `True`. 3372 3373 :type publicly_accessible: boolean 3374 :param publicly_accessible: Specifies the accessibility options for the 3375 DB instance. A value of true specifies an Internet-facing instance 3376 with a publicly resolvable DNS name, which resolves to a public IP 3377 address. A value of false specifies an internal instance with a DNS 3378 name that resolves to a private IP address. 3379 Default: The default behavior varies depending on whether a VPC has 3380 been requested or not. The following list shows the default 3381 behavior in each case. 3382 3383 3384 + **Default VPC:**true 3385 + **VPC:**false 3386 3387 3388 If no DB subnet group has been specified as part of the request and the 3389 PubliclyAccessible value has not been set, the DB instance will be 3390 publicly accessible. If a specific DB subnet group has been 3391 specified as part of the request and the PubliclyAccessible value 3392 has not been set, the DB instance will be private. 3393 3394 :type auto_minor_version_upgrade: boolean 3395 :param auto_minor_version_upgrade: Indicates that minor version 3396 upgrades will be applied automatically to the DB instance during 3397 the maintenance window. 3398 3399 :type license_model: string 3400 :param license_model: License model information for the restored DB 3401 instance. 3402 Default: Same as source. 3403 3404 Valid values: `license-included` | `bring-your-own-license` | `general- 3405 public-license` 3406 3407 :type db_name: string 3408 :param db_name: 3409 The database name for the restored DB instance. 3410 3411 3412 This parameter doesn't apply to the MySQL engine. 3413 3414 :type engine: string 3415 :param engine: The database engine to use for the new instance. 3416 Default: The same as source 3417 3418 Constraint: Must be compatible with the engine of the source 3419 3420 Example: `oracle-ee` 3421 3422 :type iops: integer 3423 :param iops: Specifies the amount of provisioned IOPS for the DB 3424 instance, expressed in I/O operations per second. If this parameter 3425 is not specified, the IOPS value will be taken from the backup. If 3426 this parameter is set to 0, the new instance will be converted to a 3427 non-PIOPS instance, which will take additional time, though your DB 3428 instance will be available for connections before the conversion 3429 starts. 3430 Constraints: Must be an integer greater than 1000. 3431 3432 :type option_group_name: string 3433 :param option_group_name: The name of the option group to be used for 3434 the restored DB instance. 3435 Permanent options, such as the TDE option for Oracle Advanced Security 3436 TDE, cannot be removed from an option group, and that option group 3437 cannot be removed from a DB instance once it is associated with a 3438 DB instance 3439 3440 :type tags: list 3441 :param tags: A list of tags. 3442 3443 """ 3444 params = { 3445 'DBInstanceIdentifier': db_instance_identifier, 3446 'DBSnapshotIdentifier': db_snapshot_identifier, 3447 } 3448 if db_instance_class is not None: 3449 params['DBInstanceClass'] = db_instance_class 3450 if port is not None: 3451 params['Port'] = port 3452 if availability_zone is not None: 3453 params['AvailabilityZone'] = availability_zone 3454 if db_subnet_group_name is not None: 3455 params['DBSubnetGroupName'] = db_subnet_group_name 3456 if multi_az is not None: 3457 params['MultiAZ'] = str( 3458 multi_az).lower() 3459 if publicly_accessible is not None: 3460 params['PubliclyAccessible'] = str( 3461 publicly_accessible).lower() 3462 if auto_minor_version_upgrade is not None: 3463 params['AutoMinorVersionUpgrade'] = str( 3464 auto_minor_version_upgrade).lower() 3465 if license_model is not None: 3466 params['LicenseModel'] = license_model 3467 if db_name is not None: 3468 params['DBName'] = db_name 3469 if engine is not None: 3470 params['Engine'] = engine 3471 if iops is not None: 3472 params['Iops'] = iops 3473 if option_group_name is not None: 3474 params['OptionGroupName'] = option_group_name 3475 if tags is not None: 3476 self.build_complex_list_params( 3477 params, tags, 3478 'Tags.member', 3479 ('Key', 'Value')) 3480 return self._make_request( 3481 action='RestoreDBInstanceFromDBSnapshot', 3482 verb='POST', 3483 path='/', params=params) 3484 3485 def restore_db_instance_to_point_in_time(self, 3486 source_db_instance_identifier, 3487 target_db_instance_identifier, 3488 restore_time=None, 3489 use_latest_restorable_time=None, 3490 db_instance_class=None, 3491 port=None, 3492 availability_zone=None, 3493 db_subnet_group_name=None, 3494 multi_az=None, 3495 publicly_accessible=None, 3496 auto_minor_version_upgrade=None, 3497 license_model=None, 3498 db_name=None, engine=None, 3499 iops=None, 3500 option_group_name=None, 3501 tags=None): 3502 """ 3503 Restores a DB instance to an arbitrary point-in-time. Users 3504 can restore to any point in time before the 3505 latestRestorableTime for up to backupRetentionPeriod days. The 3506 target database is created from the source database with the 3507 same configuration as the original database except that the DB 3508 instance is created with the default DB security group. 3509 3510 :type source_db_instance_identifier: string 3511 :param source_db_instance_identifier: 3512 The identifier of the source DB instance from which to restore. 3513 3514 Constraints: 3515 3516 3517 + Must be the identifier of an existing database instance 3518 + Must contain from 1 to 63 alphanumeric characters or hyphens 3519 + First character must be a letter 3520 + Cannot end with a hyphen or contain two consecutive hyphens 3521 3522 :type target_db_instance_identifier: string 3523 :param target_db_instance_identifier: 3524 The name of the new database instance to be created. 3525 3526 Constraints: 3527 3528 3529 + Must contain from 1 to 63 alphanumeric characters or hyphens 3530 + First character must be a letter 3531 + Cannot end with a hyphen or contain two consecutive hyphens 3532 3533 :type restore_time: timestamp 3534 :param restore_time: The date and time to restore from. 3535 Valid Values: Value must be a UTC time 3536 3537 Constraints: 3538 3539 3540 + Must be before the latest restorable time for the DB instance 3541 + Cannot be specified if UseLatestRestorableTime parameter is true 3542 3543 3544 Example: `2009-09-07T23:45:00Z` 3545 3546 :type use_latest_restorable_time: boolean 3547 :param use_latest_restorable_time: Specifies whether ( `True`) or not ( 3548 `False`) the DB instance is restored from the latest backup time. 3549 Default: `False` 3550 3551 Constraints: Cannot be specified if RestoreTime parameter is provided. 3552 3553 :type db_instance_class: string 3554 :param db_instance_class: The compute and memory capacity of the Amazon 3555 RDS DB instance. 3556 Valid Values: `db.t1.micro | db.m1.small | db.m1.medium | db.m1.large | 3557 db.m1.xlarge | db.m2.2xlarge | db.m2.4xlarge` 3558 3559 Default: The same DBInstanceClass as the original DB instance. 3560 3561 :type port: integer 3562 :param port: The port number on which the database accepts connections. 3563 Constraints: Value must be `1150-65535` 3564 3565 Default: The same port as the original DB instance. 3566 3567 :type availability_zone: string 3568 :param availability_zone: The EC2 Availability Zone that the database 3569 instance will be created in. 3570 Default: A random, system-chosen Availability Zone. 3571 3572 Constraint: You cannot specify the AvailabilityZone parameter if the 3573 MultiAZ parameter is set to true. 3574 3575 Example: `us-east-1a` 3576 3577 :type db_subnet_group_name: string 3578 :param db_subnet_group_name: The DB subnet group name to use for the 3579 new instance. 3580 3581 :type multi_az: boolean 3582 :param multi_az: Specifies if the DB instance is a Multi-AZ deployment. 3583 Constraint: You cannot specify the AvailabilityZone parameter if the 3584 MultiAZ parameter is set to `True`. 3585 3586 :type publicly_accessible: boolean 3587 :param publicly_accessible: Specifies the accessibility options for the 3588 DB instance. A value of true specifies an Internet-facing instance 3589 with a publicly resolvable DNS name, which resolves to a public IP 3590 address. A value of false specifies an internal instance with a DNS 3591 name that resolves to a private IP address. 3592 Default: The default behavior varies depending on whether a VPC has 3593 been requested or not. The following list shows the default 3594 behavior in each case. 3595 3596 3597 + **Default VPC:**true 3598 + **VPC:**false 3599 3600 3601 If no DB subnet group has been specified as part of the request and the 3602 PubliclyAccessible value has not been set, the DB instance will be 3603 publicly accessible. If a specific DB subnet group has been 3604 specified as part of the request and the PubliclyAccessible value 3605 has not been set, the DB instance will be private. 3606 3607 :type auto_minor_version_upgrade: boolean 3608 :param auto_minor_version_upgrade: Indicates that minor version 3609 upgrades will be applied automatically to the DB instance during 3610 the maintenance window. 3611 3612 :type license_model: string 3613 :param license_model: License model information for the restored DB 3614 instance. 3615 Default: Same as source. 3616 3617 Valid values: `license-included` | `bring-your-own-license` | `general- 3618 public-license` 3619 3620 :type db_name: string 3621 :param db_name: 3622 The database name for the restored DB instance. 3623 3624 3625 This parameter is not used for the MySQL engine. 3626 3627 :type engine: string 3628 :param engine: The database engine to use for the new instance. 3629 Default: The same as source 3630 3631 Constraint: Must be compatible with the engine of the source 3632 3633 Example: `oracle-ee` 3634 3635 :type iops: integer 3636 :param iops: The amount of Provisioned IOPS (input/output operations 3637 per second) to be initially allocated for the DB instance. 3638 Constraints: Must be an integer greater than 1000. 3639 3640 :type option_group_name: string 3641 :param option_group_name: The name of the option group to be used for 3642 the restored DB instance. 3643 Permanent options, such as the TDE option for Oracle Advanced Security 3644 TDE, cannot be removed from an option group, and that option group 3645 cannot be removed from a DB instance once it is associated with a 3646 DB instance 3647 3648 :type tags: list 3649 :param tags: A list of tags. 3650 3651 """ 3652 params = { 3653 'SourceDBInstanceIdentifier': source_db_instance_identifier, 3654 'TargetDBInstanceIdentifier': target_db_instance_identifier, 3655 } 3656 if restore_time is not None: 3657 params['RestoreTime'] = restore_time 3658 if use_latest_restorable_time is not None: 3659 params['UseLatestRestorableTime'] = str( 3660 use_latest_restorable_time).lower() 3661 if db_instance_class is not None: 3662 params['DBInstanceClass'] = db_instance_class 3663 if port is not None: 3664 params['Port'] = port 3665 if availability_zone is not None: 3666 params['AvailabilityZone'] = availability_zone 3667 if db_subnet_group_name is not None: 3668 params['DBSubnetGroupName'] = db_subnet_group_name 3669 if multi_az is not None: 3670 params['MultiAZ'] = str( 3671 multi_az).lower() 3672 if publicly_accessible is not None: 3673 params['PubliclyAccessible'] = str( 3674 publicly_accessible).lower() 3675 if auto_minor_version_upgrade is not None: 3676 params['AutoMinorVersionUpgrade'] = str( 3677 auto_minor_version_upgrade).lower() 3678 if license_model is not None: 3679 params['LicenseModel'] = license_model 3680 if db_name is not None: 3681 params['DBName'] = db_name 3682 if engine is not None: 3683 params['Engine'] = engine 3684 if iops is not None: 3685 params['Iops'] = iops 3686 if option_group_name is not None: 3687 params['OptionGroupName'] = option_group_name 3688 if tags is not None: 3689 self.build_complex_list_params( 3690 params, tags, 3691 'Tags.member', 3692 ('Key', 'Value')) 3693 return self._make_request( 3694 action='RestoreDBInstanceToPointInTime', 3695 verb='POST', 3696 path='/', params=params) 3697 3698 def revoke_db_security_group_ingress(self, db_security_group_name, 3699 cidrip=None, 3700 ec2_security_group_name=None, 3701 ec2_security_group_id=None, 3702 ec2_security_group_owner_id=None): 3703 """ 3704 Revokes ingress from a DBSecurityGroup for previously 3705 authorized IP ranges or EC2 or VPC Security Groups. Required 3706 parameters for this API are one of CIDRIP, EC2SecurityGroupId 3707 for VPC, or (EC2SecurityGroupOwnerId and either 3708 EC2SecurityGroupName or EC2SecurityGroupId). 3709 3710 :type db_security_group_name: string 3711 :param db_security_group_name: The name of the DB security group to 3712 revoke ingress from. 3713 3714 :type cidrip: string 3715 :param cidrip: The IP range to revoke access from. Must be a valid CIDR 3716 range. If `CIDRIP` is specified, `EC2SecurityGroupName`, 3717 `EC2SecurityGroupId` and `EC2SecurityGroupOwnerId` cannot be 3718 provided. 3719 3720 :type ec2_security_group_name: string 3721 :param ec2_security_group_name: The name of the EC2 security group to 3722 revoke access from. For VPC DB security groups, 3723 `EC2SecurityGroupId` must be provided. Otherwise, 3724 EC2SecurityGroupOwnerId and either `EC2SecurityGroupName` or 3725 `EC2SecurityGroupId` must be provided. 3726 3727 :type ec2_security_group_id: string 3728 :param ec2_security_group_id: The id of the EC2 security group to 3729 revoke access from. For VPC DB security groups, 3730 `EC2SecurityGroupId` must be provided. Otherwise, 3731 EC2SecurityGroupOwnerId and either `EC2SecurityGroupName` or 3732 `EC2SecurityGroupId` must be provided. 3733 3734 :type ec2_security_group_owner_id: string 3735 :param ec2_security_group_owner_id: The AWS Account Number of the owner 3736 of the EC2 security group specified in the `EC2SecurityGroupName` 3737 parameter. The AWS Access Key ID is not an acceptable value. For 3738 VPC DB security groups, `EC2SecurityGroupId` must be provided. 3739 Otherwise, EC2SecurityGroupOwnerId and either 3740 `EC2SecurityGroupName` or `EC2SecurityGroupId` must be provided. 3741 3742 """ 3743 params = {'DBSecurityGroupName': db_security_group_name, } 3744 if cidrip is not None: 3745 params['CIDRIP'] = cidrip 3746 if ec2_security_group_name is not None: 3747 params['EC2SecurityGroupName'] = ec2_security_group_name 3748 if ec2_security_group_id is not None: 3749 params['EC2SecurityGroupId'] = ec2_security_group_id 3750 if ec2_security_group_owner_id is not None: 3751 params['EC2SecurityGroupOwnerId'] = ec2_security_group_owner_id 3752 return self._make_request( 3753 action='RevokeDBSecurityGroupIngress', 3754 verb='POST', 3755 path='/', params=params) 3756 3757 def _make_request(self, action, verb, path, params): 3758 params['ContentType'] = 'JSON' 3759 response = self.make_request(action=action, verb='POST', 3760 path='/', params=params) 3761 body = response.read() 3762 boto.log.debug(body) 3763 if response.status == 200: 3764 return json.loads(body) 3765 else: 3766 json_body = json.loads(body) 3767 fault_name = json_body.get('Error', {}).get('Code', None) 3768 exception_class = self._faults.get(fault_name, self.ResponseError) 3769 raise exception_class(response.status, response.reason, 3770 body=json_body) 3771