Skip to content

Resource: awsRdsReservedInstance

Manages an RDS DB Reserved Instance.

\~> NOTE: Once created, a reservation is valid for the duration of the provided offeringId and cannot be deleted. Performing a destroy will only remove the resource from state. For more information see RDS Reserved Instances Documentation and PurchaseReservedDBInstancesOffering.

\~> NOTE: Due to the expense of testing this resource, we provide it as best effort. If you find it useful, and have the ability to help test or notice issues, consider reaching out to us on GitHub.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsRdsReservedInstanceOfferingTest =
  new aws.dataAwsRdsReservedInstanceOffering.DataAwsRdsReservedInstanceOffering(
    this,
    "test",
    {
      dbInstanceClass: "db.t2.micro",
      duration: 31536000,
      multiAz: false,
      offeringType: "All Upfront",
      productDescription: "mysql",
    }
  );
new aws.rdsReservedInstance.RdsReservedInstance(this, "example", {
  instanceCount: 3,
  offeringId: dataAwsRdsReservedInstanceOfferingTest.offeringId,
  reservationId: "optionalCustomReservationID",
});

Argument Reference

The following arguments are required:

  • offeringId - (Required) ID of the Reserved DB instance offering to purchase. To determine an offeringId, see the awsRdsReservedInstanceOffering data source.

The following arguments are optional:

  • instanceCount - (Optional) Number of instances to reserve. Default value is 1.
  • reservationId - (Optional) Customer-specified identifier to track this reservation.
  • tags - (Optional) Map of tags to assign to the DB reservation. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - ARN for the reserved DB instance.
  • id - Unique identifier for the reservation. same as reservationId.
  • currencyCode - Currency code for the reserved DB instance.
  • duration - Duration of the reservation in seconds.
  • fixedPrice – Fixed price charged for this reserved DB instance.
  • dbInstanceClass - DB instance class for the reserved DB instance.
  • leaseId - Unique identifier for the lease associated with the reserved DB instance. Amazon Web Services Support might request the lease ID for an issue related to a reserved DB instance.
  • multiAz - Whether the reservation applies to Multi-AZ deployments.
  • offeringType - Offering type of this reserved DB instance.
  • productDescription - Description of the reserved DB instance.
  • recurringCharges - Recurring price charged to run this reserved DB instance.
  • startTime - Time the reservation started.
  • state - State of the reserved DB instance.
  • usagePrice - Hourly price charged for this reserved DB instance.
  • tagsAll - Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Timeouts

Configuration options:

  • create - (Default 30M)
  • update - (Default 10M)
  • delete - (Default 1M)

Import

RDS DB Instance Reservations can be imported using the instanceId, e.g.,

$ terraform import aws_rds_reserved_instance.reservation_instance CustomReservationID