Alibaba Cloud v3.88.1 published on Saturday, Nov 8, 2025 by Pulumi
Alibaba Cloud v3.88.1 published on Saturday, Nov 8, 2025 by Pulumi
This data source provides Ecs Capacity Reservation available to the user.
NOTE: Available in 1.195.0+
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const _default = alicloud.ecs.getCapacityReservations({
ids: [defaultAlicloudEcsCapacityReservation.id],
nameRegex: defaultAlicloudEcsCapacityReservation.name,
instanceType: "ecs.c6.large",
platform: "linux",
});
export const alicloudEcsCapacityReservationExampleId = _default.then(_default => _default.reservations?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
default = alicloud.ecs.get_capacity_reservations(ids=[default_alicloud_ecs_capacity_reservation["id"]],
name_regex=default_alicloud_ecs_capacity_reservation["name"],
instance_type="ecs.c6.large",
platform="linux")
pulumi.export("alicloudEcsCapacityReservationExampleId", default.reservations[0].id)
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.GetCapacityReservations(ctx, &ecs.GetCapacityReservationsArgs{
Ids: interface{}{
defaultAlicloudEcsCapacityReservation.Id,
},
NameRegex: pulumi.StringRef(defaultAlicloudEcsCapacityReservation.Name),
InstanceType: pulumi.StringRef("ecs.c6.large"),
Platform: pulumi.StringRef("linux"),
}, nil);
if err != nil {
return err
}
ctx.Export("alicloudEcsCapacityReservationExampleId", _default.Reservations[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var @default = AliCloud.Ecs.GetCapacityReservations.Invoke(new()
{
Ids = new[]
{
defaultAlicloudEcsCapacityReservation.Id,
},
NameRegex = defaultAlicloudEcsCapacityReservation.Name,
InstanceType = "ecs.c6.large",
Platform = "linux",
});
return new Dictionary<string, object?>
{
["alicloudEcsCapacityReservationExampleId"] = @default.Apply(@default => @default.Apply(getCapacityReservationsResult => getCapacityReservationsResult.Reservations[0]?.Id)),
};
});
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.GetCapacityReservationsArgs;
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.getCapacityReservations(GetCapacityReservationsArgs.builder()
.ids(defaultAlicloudEcsCapacityReservation.id())
.nameRegex(defaultAlicloudEcsCapacityReservation.name())
.instanceType("ecs.c6.large")
.platform("linux")
.build());
ctx.export("alicloudEcsCapacityReservationExampleId", default_.reservations()[0].id());
}
}
variables:
default:
fn::invoke:
function: alicloud:ecs:getCapacityReservations
arguments:
ids:
- ${defaultAlicloudEcsCapacityReservation.id}
nameRegex: ${defaultAlicloudEcsCapacityReservation.name}
instanceType: ecs.c6.large
platform: linux
outputs:
alicloudEcsCapacityReservationExampleId: ${default.reservations[0].id}
Using getCapacityReservations
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getCapacityReservations(args: GetCapacityReservationsArgs, opts?: InvokeOptions): Promise<GetCapacityReservationsResult>
function getCapacityReservationsOutput(args: GetCapacityReservationsOutputArgs, opts?: InvokeOptions): Output<GetCapacityReservationsResult>def get_capacity_reservations(capacity_reservation_ids: Optional[Sequence[str]] = None,
ids: Optional[Sequence[str]] = None,
instance_type: Optional[str] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
payment_type: Optional[str] = None,
platform: Optional[str] = None,
resource_group_id: Optional[str] = None,
status: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetCapacityReservationsResult
def get_capacity_reservations_output(capacity_reservation_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
instance_type: Optional[pulumi.Input[str]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
payment_type: Optional[pulumi.Input[str]] = None,
platform: Optional[pulumi.Input[str]] = None,
resource_group_id: Optional[pulumi.Input[str]] = None,
status: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetCapacityReservationsResult]func GetCapacityReservations(ctx *Context, args *GetCapacityReservationsArgs, opts ...InvokeOption) (*GetCapacityReservationsResult, error)
func GetCapacityReservationsOutput(ctx *Context, args *GetCapacityReservationsOutputArgs, opts ...InvokeOption) GetCapacityReservationsResultOutput> Note: This function is named GetCapacityReservations in the Go SDK.
public static class GetCapacityReservations
{
public static Task<GetCapacityReservationsResult> InvokeAsync(GetCapacityReservationsArgs args, InvokeOptions? opts = null)
public static Output<GetCapacityReservationsResult> Invoke(GetCapacityReservationsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetCapacityReservationsResult> getCapacityReservations(GetCapacityReservationsArgs args, InvokeOptions options)
public static Output<GetCapacityReservationsResult> getCapacityReservations(GetCapacityReservationsArgs args, InvokeOptions options)
fn::invoke:
function: alicloud:ecs/getCapacityReservations:getCapacityReservations
arguments:
# arguments dictionaryThe following arguments are supported:
- Capacity
Reservation List<string>Ids - Ids List<string>
- A list of Capacity Reservation IDs.
- Instance
Type string - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- Name
Regex string - A regex string to filter results by Group Metric Rule name.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Payment
Type string - The payment type of the resource. value range
PostPaid,PrePaid. - Platform string
- platform of the capacity reservation , value range
windows,linux,all. - Resource
Group stringId - The resource group id.
- Status string
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - Dictionary<string, string>
- The tag of the resource.
- Capacity
Reservation []stringIds - Ids []string
- A list of Capacity Reservation IDs.
- Instance
Type string - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- Name
Regex string - A regex string to filter results by Group Metric Rule name.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Payment
Type string - The payment type of the resource. value range
PostPaid,PrePaid. - Platform string
- platform of the capacity reservation , value range
windows,linux,all. - Resource
Group stringId - The resource group id.
- Status string
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - map[string]string
- The tag of the resource.
- capacity
Reservation List<String>Ids - ids List<String>
- A list of Capacity Reservation IDs.
- instance
Type String - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- name
Regex String - A regex string to filter results by Group Metric Rule name.
- output
File String - File name where to save data source results (after running
pulumi preview). - payment
Type String - The payment type of the resource. value range
PostPaid,PrePaid. - platform String
- platform of the capacity reservation , value range
windows,linux,all. - resource
Group StringId - The resource group id.
- status String
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - Map<String,String>
- The tag of the resource.
- capacity
Reservation string[]Ids - ids string[]
- A list of Capacity Reservation IDs.
- instance
Type string - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- name
Regex string - A regex string to filter results by Group Metric Rule name.
- output
File string - File name where to save data source results (after running
pulumi preview). - payment
Type string - The payment type of the resource. value range
PostPaid,PrePaid. - platform string
- platform of the capacity reservation , value range
windows,linux,all. - resource
Group stringId - The resource group id.
- status string
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - {[key: string]: string}
- The tag of the resource.
- capacity_
reservation_ Sequence[str]ids - ids Sequence[str]
- A list of Capacity Reservation IDs.
- instance_
type str - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- name_
regex str - A regex string to filter results by Group Metric Rule name.
- output_
file str - File name where to save data source results (after running
pulumi preview). - payment_
type str - The payment type of the resource. value range
PostPaid,PrePaid. - platform str
- platform of the capacity reservation , value range
windows,linux,all. - resource_
group_ strid - The resource group id.
- status str
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - Mapping[str, str]
- The tag of the resource.
- capacity
Reservation List<String>Ids - ids List<String>
- A list of Capacity Reservation IDs.
- instance
Type String - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- name
Regex String - A regex string to filter results by Group Metric Rule name.
- output
File String - File name where to save data source results (after running
pulumi preview). - payment
Type String - The payment type of the resource. value range
PostPaid,PrePaid. - platform String
- platform of the capacity reservation , value range
windows,linux,all. - resource
Group StringId - The resource group id.
- status String
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - Map<String>
- The tag of the resource.
getCapacityReservations Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- A list of Capacity Reservation IDs.
- Names List<string>
- A list of name of Capacity Reservations.
- Reservations
List<Pulumi.
Ali Cloud. Ecs. Outputs. Get Capacity Reservations Reservation> - A list of Capacity Reservation Entries. Each element contains the following attributes:
- Capacity
Reservation List<string>Ids - Instance
Type string - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- Name
Regex string - Output
File string - Payment
Type string - The payment type of the resource
- Platform string
- platform of the capacity reservation.
- Resource
Group stringId - The resource group id
- Status string
- The status of the capacity reservation.
- Dictionary<string, string>
- A mapping of tags to assign to the Capacity Reservation.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of Capacity Reservation IDs.
- Names []string
- A list of name of Capacity Reservations.
- Reservations
[]Get
Capacity Reservations Reservation - A list of Capacity Reservation Entries. Each element contains the following attributes:
- Capacity
Reservation []stringIds - Instance
Type string - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- Name
Regex string - Output
File string - Payment
Type string - The payment type of the resource
- Platform string
- platform of the capacity reservation.
- Resource
Group stringId - The resource group id
- Status string
- The status of the capacity reservation.
- map[string]string
- A mapping of tags to assign to the Capacity Reservation.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Capacity Reservation IDs.
- names List<String>
- A list of name of Capacity Reservations.
- reservations
List<Get
Capacity Reservations Reservation> - A list of Capacity Reservation Entries. Each element contains the following attributes:
- capacity
Reservation List<String>Ids - instance
Type String - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- name
Regex String - output
File String - payment
Type String - The payment type of the resource
- platform String
- platform of the capacity reservation.
- resource
Group StringId - The resource group id
- status String
- The status of the capacity reservation.
- Map<String,String>
- A mapping of tags to assign to the Capacity Reservation.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of Capacity Reservation IDs.
- names string[]
- A list of name of Capacity Reservations.
- reservations
Get
Capacity Reservations Reservation[] - A list of Capacity Reservation Entries. Each element contains the following attributes:
- capacity
Reservation string[]Ids - instance
Type string - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- name
Regex string - output
File string - payment
Type string - The payment type of the resource
- platform string
- platform of the capacity reservation.
- resource
Group stringId - The resource group id
- status string
- The status of the capacity reservation.
- {[key: string]: string}
- A mapping of tags to assign to the Capacity Reservation.
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of Capacity Reservation IDs.
- names Sequence[str]
- A list of name of Capacity Reservations.
- reservations
Sequence[Get
Capacity Reservations Reservation] - A list of Capacity Reservation Entries. Each element contains the following attributes:
- capacity_
reservation_ Sequence[str]ids - instance_
type str - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- name_
regex str - output_
file str - payment_
type str - The payment type of the resource
- platform str
- platform of the capacity reservation.
- resource_
group_ strid - The resource group id
- status str
- The status of the capacity reservation.
- Mapping[str, str]
- A mapping of tags to assign to the Capacity Reservation.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Capacity Reservation IDs.
- names List<String>
- A list of name of Capacity Reservations.
- reservations List<Property Map>
- A list of Capacity Reservation Entries. Each element contains the following attributes:
- capacity
Reservation List<String>Ids - instance
Type String - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- name
Regex String - output
File String - payment
Type String - The payment type of the resource
- platform String
- platform of the capacity reservation.
- resource
Group StringId - The resource group id
- status String
- The status of the capacity reservation.
- Map<String>
- A mapping of tags to assign to the Capacity Reservation.
Supporting Types
GetCapacityReservationsReservation
- Capacity
Reservation stringId - Capacity Reservation id
- Capacity
Reservation stringName - Capacity reservation service name.
- Description string
- description of the capacity reservation instance
- End
Time string - end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
- End
Time stringType - Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
- Id string
- The ID of the Capacity Reservation.
- Instance
Amount string - The total number of instances that need to be reserved within the capacity reservation
- Instance
Type string - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- Match
Criteria string - The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
- Payment
Type string - The payment type of the resource. value range
PostPaid,PrePaid. - Platform string
- platform of the capacity reservation , value range
windows,linux,all. - Resource
Group stringId - The resource group id.
- Start
Time string - time of the capacity reservation which become active
- Start
Time stringType - The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
- Status string
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - Time
Slot string - This parameter is under test and is not yet open for use.
- Zone
Ids List<string> - The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
- Dictionary<string, string>
- The tag of the resource.
- Capacity
Reservation stringId - Capacity Reservation id
- Capacity
Reservation stringName - Capacity reservation service name.
- Description string
- description of the capacity reservation instance
- End
Time string - end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
- End
Time stringType - Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
- Id string
- The ID of the Capacity Reservation.
- Instance
Amount string - The total number of instances that need to be reserved within the capacity reservation
- Instance
Type string - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- Match
Criteria string - The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
- Payment
Type string - The payment type of the resource. value range
PostPaid,PrePaid. - Platform string
- platform of the capacity reservation , value range
windows,linux,all. - Resource
Group stringId - The resource group id.
- Start
Time string - time of the capacity reservation which become active
- Start
Time stringType - The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
- Status string
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - Time
Slot string - This parameter is under test and is not yet open for use.
- Zone
Ids []string - The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
- map[string]string
- The tag of the resource.
- capacity
Reservation StringId - Capacity Reservation id
- capacity
Reservation StringName - Capacity reservation service name.
- description String
- description of the capacity reservation instance
- end
Time String - end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
- end
Time StringType - Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
- id String
- The ID of the Capacity Reservation.
- instance
Amount String - The total number of instances that need to be reserved within the capacity reservation
- instance
Type String - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- match
Criteria String - The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
- payment
Type String - The payment type of the resource. value range
PostPaid,PrePaid. - platform String
- platform of the capacity reservation , value range
windows,linux,all. - resource
Group StringId - The resource group id.
- start
Time String - time of the capacity reservation which become active
- start
Time StringType - The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
- status String
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - time
Slot String - This parameter is under test and is not yet open for use.
- zone
Ids List<String> - The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
- Map<String,String>
- The tag of the resource.
- capacity
Reservation stringId - Capacity Reservation id
- capacity
Reservation stringName - Capacity reservation service name.
- description string
- description of the capacity reservation instance
- end
Time string - end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
- end
Time stringType - Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
- id string
- The ID of the Capacity Reservation.
- instance
Amount string - The total number of instances that need to be reserved within the capacity reservation
- instance
Type string - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- match
Criteria string - The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
- payment
Type string - The payment type of the resource. value range
PostPaid,PrePaid. - platform string
- platform of the capacity reservation , value range
windows,linux,all. - resource
Group stringId - The resource group id.
- start
Time string - time of the capacity reservation which become active
- start
Time stringType - The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
- status string
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - time
Slot string - This parameter is under test and is not yet open for use.
- zone
Ids string[] - The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
- {[key: string]: string}
- The tag of the resource.
- capacity_
reservation_ strid - Capacity Reservation id
- capacity_
reservation_ strname - Capacity reservation service name.
- description str
- description of the capacity reservation instance
- end_
time str - end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
- end_
time_ strtype - Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
- id str
- The ID of the Capacity Reservation.
- instance_
amount str - The total number of instances that need to be reserved within the capacity reservation
- instance_
type str - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- match_
criteria str - The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
- payment_
type str - The payment type of the resource. value range
PostPaid,PrePaid. - platform str
- platform of the capacity reservation , value range
windows,linux,all. - resource_
group_ strid - The resource group id.
- start_
time str - time of the capacity reservation which become active
- start_
time_ strtype - The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
- status str
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - time_
slot str - This parameter is under test and is not yet open for use.
- zone_
ids Sequence[str] - The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
- Mapping[str, str]
- The tag of the resource.
- capacity
Reservation StringId - Capacity Reservation id
- capacity
Reservation StringName - Capacity reservation service name.
- description String
- description of the capacity reservation instance
- end
Time String - end time of the capacity reservation. the capacity reservation will be released at the end time automatically if set. otherwise it will last until manually released
- end
Time StringType - Release mode of capacity reservation service. Value range:Limited: release at specified time. The EndTime parameter must be specified at the same time.Unlimited: manual release. No time limit.
- id String
- The ID of the Capacity Reservation.
- instance
Amount String - The total number of instances that need to be reserved within the capacity reservation
- instance
Type String - Instance type. Currently, you can only set the capacity reservation service for one instance type.
- match
Criteria String - The type of private resource pool generated after the capacity reservation service takes effect. Value range:Open: Open mode.Target: dedicated mode.Default value: Open
- payment
Type String - The payment type of the resource. value range
PostPaid,PrePaid. - platform String
- platform of the capacity reservation , value range
windows,linux,all. - resource
Group StringId - The resource group id.
- start
Time String - time of the capacity reservation which become active
- start
Time StringType - The capacity is scheduled to take effect. Possible values:-Now: Effective immediately.-Later: the specified time takes effect.
- status String
- The status of the capacity reservation. value range
All,Pending,Preparing,Prepared,Active,Released. - time
Slot String - This parameter is under test and is not yet open for use.
- zone
Ids List<String> - The ID of the zone in the region to which the capacity reservation service belongs. Currently, it is only supported to create a capacity reservation service in one zone.
- Map<String>
- The tag of the resource.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.
Alibaba Cloud v3.88.1 published on Saturday, Nov 8, 2025 by Pulumi
