ReservedInstance

class ReservedInstance : KotlinCustomResource

Provides an Reserved Instance resource.

NOTE: Available since v1.65.0.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const _default = alicloud.ecs.getInstanceTypes({
instanceTypeFamily: "ecs.g6",
});
const defaultReservedInstance = new alicloud.ecs.ReservedInstance("default", {
instanceType: _default.then(_default => _default.instanceTypes?.[0]?.id),
instanceAmount: 1,
periodUnit: "Month",
offeringType: "All Upfront",
reservedInstanceName: "terraform-example",
description: "ReservedInstance",
zoneId: _default.then(_default => _default.instanceTypes?.[0]?.availabilityZones?.[0]),
scope: "Zone",
});
import pulumi
import pulumi_alicloud as alicloud
default = alicloud.ecs.get_instance_types(instance_type_family="ecs.g6")
default_reserved_instance = alicloud.ecs.ReservedInstance("default",
instance_type=default.instance_types[0].id,
instance_amount=1,
period_unit="Month",
offering_type="All Upfront",
reserved_instance_name="terraform-example",
description="ReservedInstance",
zone_id=default.instance_types[0].availability_zones[0],
scope="Zone")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var @default = AliCloud.Ecs.GetInstanceTypes.Invoke(new()
{
InstanceTypeFamily = "ecs.g6",
});
var defaultReservedInstance = new AliCloud.Ecs.ReservedInstance("default", new()
{
InstanceType = @default.Apply(@default => @default.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.Id)),
InstanceAmount = 1,
PeriodUnit = "Month",
OfferingType = "All Upfront",
ReservedInstanceName = "terraform-example",
Description = "ReservedInstance",
ZoneId = @default.Apply(@default => @default.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.AvailabilityZones[0])),
Scope = "Zone",
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := ecs.GetInstanceTypes(ctx, &ecs.GetInstanceTypesArgs{
InstanceTypeFamily: pulumi.StringRef("ecs.g6"),
}, nil)
if err != nil {
return err
}
_, err = ecs.NewReservedInstance(ctx, "default", &ecs.ReservedInstanceArgs{
InstanceType: pulumi.String(_default.InstanceTypes[0].Id),
InstanceAmount: pulumi.Int(1),
PeriodUnit: pulumi.String("Month"),
OfferingType: pulumi.String("All Upfront"),
ReservedInstanceName: pulumi.String("terraform-example"),
Description: pulumi.String("ReservedInstance"),
ZoneId: pulumi.String(_default.InstanceTypes[0].AvailabilityZones[0]),
Scope: pulumi.String("Zone"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetInstanceTypesArgs;
import com.pulumi.alicloud.ecs.ReservedInstance;
import com.pulumi.alicloud.ecs.ReservedInstanceArgs;
import java.util.List;
import java.util.ArrayList;
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 default = EcsFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
.instanceTypeFamily("ecs.g6")
.build());
var defaultReservedInstance = new ReservedInstance("defaultReservedInstance", ReservedInstanceArgs.builder()
.instanceType(default_.instanceTypes()[0].id())
.instanceAmount(1)
.periodUnit("Month")
.offeringType("All Upfront")
.reservedInstanceName("terraform-example")
.description("ReservedInstance")
.zoneId(default_.instanceTypes()[0].availabilityZones()[0])
.scope("Zone")
.build());
}
}
resources:
defaultReservedInstance:
type: alicloud:ecs:ReservedInstance
name: default
properties:
instanceType: ${default.instanceTypes[0].id}
instanceAmount: '1'
periodUnit: Month
offeringType: All Upfront
reservedInstanceName: terraform-example
description: ReservedInstance
zoneId: ${default.instanceTypes[0].availabilityZones[0]}
scope: Zone
variables:
default:
fn::invoke:
function: alicloud:ecs:getInstanceTypes
arguments:
instanceTypeFamily: ecs.g6

Import

reservedInstance can be imported using id, e.g.

$ pulumi import alicloud:ecs/reservedInstance:ReservedInstance default ecsri-uf6df4xm0h3licit****

Properties

Link copied to clipboard

Indicates the sharing status of the reserved instance when the AllocationType parameter is set to Shared. Valid values: allocated: The reserved instance is allocated to another account. beAllocated: The reserved instance is allocated by another account.

Link copied to clipboard
val autoRenewPeriod: Output<Int>

The auto-renewal term of the reserved instance. This parameter takes effect only when AutoRenew is set to true. Valid values: 1, 12, 36, and 60. Default value when period_unit is set to Month: 1 Default value when period_unit is set to Year: 12

Link copied to clipboard
val createTime: Output<String>

The time when the reserved instance was created.

Link copied to clipboard
val description: Output<String>?

Description of the RI. 2 to 256 English or Chinese characters. It cannot start with http:// or https://.

Link copied to clipboard
val expiredTime: Output<String>

The time when the reserved instance expires.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val instanceAmount: Output<Int>

Number of instances allocated to an RI (An RI is a coupon that includes one or more allocated instances.).

Link copied to clipboard
val instanceType: Output<String>

Instance type of the RI. For more information, see Instance type families.

Link copied to clipboard
val name: Output<String>

Field name has been deprecated from provider version 1.194.0. New field reserved_instance_name instead.

Link copied to clipboard
val offeringType: Output<String>

Payment type of the RI. Default value: All Upfront. Valid values:

Link copied to clipboard

Details about the lock status of the reserved instance.

Link copied to clipboard
val period: Output<Int>?

The validity period of the reserved instance. Default value: 1. NOTE: From version 1.183.0, period can be set to 5, when period_unit is Year.

Link copied to clipboard
val periodUnit: Output<String>?

The unit of the validity period of the reserved instance. Valid value: Month, Year. Default value: Year. NOTE: From version 1.183.0, period_unit can be set to Month.

Link copied to clipboard
val platform: Output<String>

The operating system type of the image used by the instance. Optional values: Windows, Linux. Default is Linux.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val renewalStatus: Output<String>

Automatic renewal status. Valid values: AutoRenewal,Normal.

Link copied to clipboard

Name of the RI. The name must be a string of 2 to 128 characters in length and can contain letters, numbers, colons (:), underscores (_), and hyphens. It must start with a letter. It cannot start with http:// or https://.

Link copied to clipboard
val resourceGroupId: Output<String>

Resource group ID.

Link copied to clipboard
val scope: Output<String>

Scope of the RI. Optional values: Region: region-level, Zone: zone-level. Default is Region.

Link copied to clipboard
val startTime: Output<String>

The time when the reserved instance took effect.

Link copied to clipboard
val status: Output<String>

The status of the reserved instance.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A mapping of tags to assign to the resource.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val zoneId: Output<String>?

ID of the zone to which the RI belongs. When Scope is set to Zone, this parameter is required. For information about the zone list, see DescribeZones.