CapacityBlockReservation

class CapacityBlockReservation : KotlinCustomResource

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 capacity_block_offering_id 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: "p4d.24xlarge",
startDateRange: "2024-04-28T15:04:05Z",
});
const example = new aws.ec2.CapacityBlockReservation("example", {
capacityBlockOfferingId: test.then(test => test.capacityBlockOfferingId),
instancePlatform: "Linux/UNIX",
tags: {
Environment: "dev",
},
});
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="p4d.24xlarge",
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",
tags={
"Environment": "dev",
})
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 = "p4d.24xlarge",
StartDateRange = "2024-04-28T15:04:05Z",
});
var example = new Aws.Ec2.CapacityBlockReservation("example", new()
{
CapacityBlockOfferingId = test.Apply(getCapacityBlockOfferingResult => getCapacityBlockOfferingResult.CapacityBlockOfferingId),
InstancePlatform = "Linux/UNIX",
Tags =
{
{ "Environment", "dev" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/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: "p4d.24xlarge",
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"),
Tags: pulumi.StringMap{
"Environment": pulumi.String("dev"),
},
})
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.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.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 test = Ec2Functions.getCapacityBlockOffering(GetCapacityBlockOfferingArgs.builder()
.capacityDurationHours(24)
.endDateRange("2024-05-30T15:04:05Z")
.instanceCount(1)
.instanceType("p4d.24xlarge")
.startDateRange("2024-04-28T15:04:05Z")
.build());
var example = new CapacityBlockReservation("example", CapacityBlockReservationArgs.builder()
.capacityBlockOfferingId(test.capacityBlockOfferingId())
.instancePlatform("Linux/UNIX")
.tags(Map.of("Environment", "dev"))
.build());
}
}
resources:
example:
type: aws:ec2:CapacityBlockReservation
properties:
capacityBlockOfferingId: ${test.capacityBlockOfferingId}
instancePlatform: Linux/UNIX
tags:
Environment: dev
variables:
test:
fn::invoke:
function: aws:ec2:getCapacityBlockOffering
arguments:
capacityDurationHours: 24
endDateRange: 2024-05-30T15:04:05Z
instanceCount: 1
instanceType: p4d.24xlarge
startDateRange: 2024-04-28T15:04:05Z

Properties

Link copied to clipboard
val arn: Output<String>

The ARN of the reservation.

Link copied to clipboard

The Availability Zone in which to create the Capacity Block Reservation.

Link copied to clipboard

The Capacity Block Reservation ID.

Link copied to clipboard
val createdDate: Output<String>

The date and time at which the Capacity Block Reservation was created.

Link copied to clipboard
val ebsOptimized: Output<Boolean>

Indicates whether the Capacity Reservation supports EBS-optimized instances.

Link copied to clipboard
val 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)

Link copied to clipboard
val endDateType: Output<String>

Indicates the way in which the Capacity Reservation ends.

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

The number of instances for which to reserve capacity.

Link copied to clipboard

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 Standard or Windows with SQL Server Web.

Link copied to clipboard
val instanceType: Output<String>

The instance type for which to reserve capacity.

Link copied to clipboard
val outpostArn: Output<String>

The ARN of the Outpost on which to create the Capacity Block Reservation.

Link copied to clipboard

The ARN of the placement group in which to create the Capacity Block Reservation.

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

The type of Capacity Reservation.

Link copied to clipboard
val startDate: Output<String>

The date and time at which the Capacity Block Reservation starts. Valid values: RFC3339 time string (YYYY-MM-DDTHH:MM:SSZ)

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

A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

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

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block

Link copied to clipboard
val tenancy: Output<String>

Indicates the tenancy of the Capacity Block Reservation. Specify either default or dedicated.

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