CapacityBlockReservation class
Provides an EC2 Capacity Block Reservation. This allows you to purchase capacity block for your Amazon EC2 instances in a specific Availability Zone for machine learning (ML) Workloads.
> NOTE: Once created, a reservation is valid for the duration of the provided capacityBlockOfferingId and cannot be deleted. Performing a destroy will only remove the resource from state. For more information see EC2 Capacity Block Reservation 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.ec2.getCapacityBlockOffering({
capacityDurationHours: 24,
endDateRange: "2024-05-30T15:04:05Z",
instanceCount: 1,
instanceType: "p5.4xlarge",
startDateRange: "2024-04-28T15:04:05Z",
});
const example = new aws.ec2.CapacityBlockReservation("example", {
capacityBlockOfferingId: test.then(test => test.capacityBlockOfferingId),
instancePlatform: "Linux/UNIX",
});
import pulumi
import pulumi_aws as aws
test = aws.ec2.get_capacity_block_offering(capacity_duration_hours=24,
end_date_range="2024-05-30T15:04:05Z",
instance_count=1,
instance_type="p5.4xlarge",
start_date_range="2024-04-28T15:04:05Z")
example = aws.ec2.CapacityBlockReservation("example",
capacity_block_offering_id=test.capacity_block_offering_id,
instance_platform="Linux/UNIX")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = Aws.Ec2.GetCapacityBlockOffering.Invoke(new()
{
CapacityDurationHours = 24,
EndDateRange = "2024-05-30T15:04:05Z",
InstanceCount = 1,
InstanceType = "p5.4xlarge",
StartDateRange = "2024-04-28T15:04:05Z",
});
var example = new Aws.Ec2.CapacityBlockReservation("example", new()
{
CapacityBlockOfferingId = test.Apply(getCapacityBlockOfferingResult => getCapacityBlockOfferingResult.CapacityBlockOfferingId),
InstancePlatform = "Linux/UNIX",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := ec2.GetCapacityBlockOffering(ctx, &ec2.GetCapacityBlockOfferingArgs{
CapacityDurationHours: 24,
EndDateRange: pulumi.StringRef("2024-05-30T15:04:05Z"),
InstanceCount: 1,
InstanceType: "p5.4xlarge",
StartDateRange: pulumi.StringRef("2024-04-28T15:04:05Z"),
}, nil)
if err != nil {
return err
}
_, err = ec2.NewCapacityBlockReservation(ctx, "example", &ec2.CapacityBlockReservationArgs{
CapacityBlockOfferingId: pulumi.String(test.CapacityBlockOfferingId),
InstancePlatform: pulumi.String("Linux/UNIX"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_ec2_getcapacityblockoffering" "test" {
capacity_duration_hours = 24
end_date_range = "2024-05-30T15:04:05Z"
instance_count = 1
instance_type = "p5.4xlarge"
start_date_range = "2024-04-28T15:04:05Z"
}
resource "aws_ec2_capacityblockreservation" "example" {
capacity_block_offering_id = data.aws_ec2_getcapacityblockoffering.test.capacity_block_offering_id
instance_platform = "Linux/UNIX"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetCapacityBlockOfferingArgs;
import com.pulumi.aws.ec2.CapacityBlockReservation;
import com.pulumi.aws.ec2.CapacityBlockReservationArgs;
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 = Ec2Functions.getCapacityBlockOffering(GetCapacityBlockOfferingArgs.builder()
.capacityDurationHours(24)
.endDateRange("2024-05-30T15:04:05Z")
.instanceCount(1)
.instanceType("p5.4xlarge")
.startDateRange("2024-04-28T15:04:05Z")
.build());
var example = new CapacityBlockReservation("example", CapacityBlockReservationArgs.builder()
.capacityBlockOfferingId(test.capacityBlockOfferingId())
.instancePlatform("Linux/UNIX")
.build());
}
}
resources:
example:
type: aws:ec2:CapacityBlockReservation
properties:
capacityBlockOfferingId: ${test.capacityBlockOfferingId}
instancePlatform: Linux/UNIX
variables:
test:
fn::invoke:
function: aws:ec2:getCapacityBlockOffering
arguments:
capacityDurationHours: 24
endDateRange: 2024-05-30T15:04:05Z
instanceCount: 1
instanceType: p5.4xlarge
startDateRange: 2024-04-28T15:04:05Z
Constructors
- CapacityBlockReservation(String name, {CapacityBlockReservationArgs? args, CustomResourceOptions? options})
-
Creates a new CapacityBlockReservation.
nameThe Pulumi resource name.argsArguments used to configure this CapacityBlockReservation. The set of arguments for CapacityBlockReservation.optionsResource options controlling this resource's behavior. - CapacityBlockReservation.reference(String urn)
- Creates a typed reference to an existing CapacityBlockReservation resource.
Properties
-
arn
↔ Output<
String> -
The ARN of the reservation.
latefinal
-
availabilityZone
↔ Output<
String> -
The Availability Zone in which to create the Capacity Block Reservation.
latefinal
-
capacityBlockOfferingId
↔ Output<
String> -
The Capacity Block Reservation ID.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
createdDate
↔ Output<
String> -
The date and time at which the Capacity Block Reservation was created.
latefinal
-
ebsOptimized
↔ Output<
bool> -
Indicates whether the Capacity Reservation supports EBS-optimized instances.
latefinal
-
endDate
↔ Output<
String> -
The date and time at which the Capacity Block Reservation expires. When a Capacity Block Reservation expires, the reserved capacity is released and you can no longer launch instances into it. Valid values: RFC3339 time string (
YYYY-MM-DDTHH:MM:SSZ)latefinal -
endDateType
↔ Output<
String> -
Indicates the way in which the Capacity Reservation ends.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
instanceCount
↔ Output<
int> -
The number of instances for which to reserve capacity.
This value will not be set until the Capacity Block Reservation is active.
The requested instance count is set in the tag
aws:ec2capacityreservation:incrementalRequestedQuantity.latefinal -
instancePlatform
↔ Output<
String> -
The type of operating system for which to reserve capacity. Valid options are
Linux/UNIX,Red Hat Enterprise Linux,SUSE Linux,Windows,Windows with SQL Server,Windows with SQL Server Enterprise,Windows with SQL Server StandardorWindows with SQL Server Web.latefinal -
instanceType
↔ Output<
String> -
The instance type for which to reserve capacity.
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
-
outpostArn
↔ Output<
String> -
The ARN of the Outpost on which to create the Capacity Block Reservation.
latefinal
-
placementGroupArn
↔ Output<
String> -
The ARN of the placement group in which to create the Capacity Block Reservation.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
reservationType
↔ Output<
String> -
The type of Capacity Reservation.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
startDate
↔ Output<
String> -
The date and time at which the Capacity Block Reservation starts. Valid values: RFC3339 time string (
YYYY-MM-DDTHH:MM:SSZ)latefinal -
A map of tags to assign to the resource. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration blocklatefinal -
tenancy
↔ Output<
String> -
Indicates the tenancy of the Capacity Block Reservation. Specify either
defaultordedicated.latefinal -
timeouts
↔ Output<
CapacityBlockReservationTimeouts?> -
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
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, {CapacityBlockReservationState? state, CustomResourceOptions? options}) → CapacityBlockReservation -
Gets an existing CapacityBlockReservation resource's state with the given
nameandid.