ReservedInstance class

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

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const test = aws.rds.getReservedInstanceOffering({
    dbInstanceClass: "db.t2.micro",
    duration: 31536000,
    multiAz: false,
    offeringType: "All Upfront",
    productDescription: "mysql",
});
const example = new aws.rds.ReservedInstance("example", {
    offeringId: test.then(test => test.offeringId),
    reservationId: "optionalCustomReservationID",
    instanceCount: 3,
});
import pulumi
import pulumi_aws as aws

test = aws.rds.get_reserved_instance_offering(db_instance_class="db.t2.micro",
    duration=31536000,
    multi_az=False,
    offering_type="All Upfront",
    product_description="mysql")
example = aws.rds.ReservedInstance("example",
    offering_id=test.offering_id,
    reservation_id="optionalCustomReservationID",
    instance_count=3)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var test = Aws.Rds.GetReservedInstanceOffering.Invoke(new()
    {
        DbInstanceClass = "db.t2.micro",
        Duration = 31536000,
        MultiAz = false,
        OfferingType = "All Upfront",
        ProductDescription = "mysql",
    });

    var example = new Aws.Rds.ReservedInstance("example", new()
    {
        OfferingId = test.Apply(getReservedInstanceOfferingResult => getReservedInstanceOfferingResult.OfferingId),
        ReservationId = "optionalCustomReservationID",
        InstanceCount = 3,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/rds"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		test, err := rds.GetReservedInstanceOffering(ctx, &rds.GetReservedInstanceOfferingArgs{
			DbInstanceClass:    "db.t2.micro",
			Duration:           31536000,
			MultiAz:            false,
			OfferingType:       "All Upfront",
			ProductDescription: "mysql",
		}, nil)
		if err != nil {
			return err
		}
		_, err = rds.NewReservedInstance(ctx, "example", &rds.ReservedInstanceArgs{
			OfferingId:    pulumi.String(test.OfferingId),
			ReservationId: pulumi.String("optionalCustomReservationID"),
			InstanceCount: pulumi.Int(3),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_rds_getreservedinstanceoffering" "test" {
  db_instance_class   = "db.t2.micro"
  duration            = 31536000
  multi_az            = false
  offering_type       = "All Upfront"
  product_description = "mysql"
}

resource "aws_rds_reservedinstance" "example" {
  offering_id    = data.aws_rds_getreservedinstanceoffering.test.offering_id
  reservation_id = "optionalCustomReservationID"
  instance_count = 3
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.RdsFunctions;
import com.pulumi.aws.rds.inputs.GetReservedInstanceOfferingArgs;
import com.pulumi.aws.rds.ReservedInstance;
import com.pulumi.aws.rds.ReservedInstanceArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var test = RdsFunctions.getReservedInstanceOffering(GetReservedInstanceOfferingArgs.builder()
            .dbInstanceClass("db.t2.micro")
            .duration(31536000)
            .multiAz(false)
            .offeringType("All Upfront")
            .productDescription("mysql")
            .build());

        var example = new ReservedInstance("example", ReservedInstanceArgs.builder()
            .offeringId(test.offeringId())
            .reservationId("optionalCustomReservationID")
            .instanceCount(3)
            .build());

    }
}
resources:
  example:
    type: aws:rds:ReservedInstance
    properties:
      offeringId: ${test.offeringId}
      reservationId: optionalCustomReservationID
      instanceCount: 3
variables:
  test:
    fn::invoke:
      function: aws:rds:getReservedInstanceOffering
      arguments:
        dbInstanceClass: db.t2.micro
        duration: 3.1536e+07
        multiAz: false
        offeringType: All Upfront
        productDescription: mysql

Import

Using pulumi import, import RDS DB Instance Reservations using the instanceId. For example:

$ pulumi import aws:rds/reservedInstance:ReservedInstance reservation_instance CustomReservationID

Constructors

ReservedInstance(String name, {ReservedInstanceArgs? args, CustomResourceOptions? options})
Creates a new ReservedInstance. name The Pulumi resource name. args Arguments used to configure this ReservedInstance. The set of arguments for ReservedInstance. options Resource options controlling this resource's behavior.
ReservedInstance.reference(String urn)
Creates a typed reference to an existing ReservedInstance resource.

Properties

arn ↔ Output<String>
ARN for the reserved DB instance.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
currencyCode ↔ Output<String>
Currency code for the reserved DB instance.
latefinal
dbInstanceClass ↔ Output<String>
DB instance class for the reserved DB instance.
latefinal
duration ↔ Output<int>
Duration of the reservation in seconds.
latefinal
fixedPrice ↔ Output<double>
Fixed price charged for this reserved DB instance.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
instanceCount ↔ Output<int?>
Number of instances to reserve. Default value is 1.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
leaseId ↔ Output<String>
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.
latefinal
multiAz ↔ Output<bool>
Whether the reservation applies to Multi-AZ deployments.
latefinal
offeringId ↔ Output<String>
ID of the Reserved DB instance offering to purchase. To determine an offeringId, see the aws.rds.getReservedInstanceOffering data source.
latefinal
offeringType ↔ Output<String>
Offering type of this reserved DB instance.
latefinal
productDescription ↔ Output<String>
Description of the reserved DB instance.
latefinal
recurringCharges ↔ Output<List<ReservedInstanceRecurringCharge>>
Recurring price charged to run this reserved DB instance.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
reservationId ↔ Output<String?>
Customer-specified identifier to track this reservation.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
startTime ↔ Output<String>
Time the reservation started.
latefinal
state ↔ Output<String>
State of the reserved DB instance.
latefinal
tags ↔ Output<Map<String, String>?>
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.
latefinal
tagsAll ↔ Output<Map<String, String>>
Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
usagePrice ↔ Output<double>
Hourly price charged for this reserved DB instance.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {ReservedInstanceState? state, CustomResourceOptions? options}) → ReservedInstance
Gets an existing ReservedInstance resource's state with the given name and id.