getZones
This data source provides availability zones that can be accessed by an Alibaba Cloud account within the region configured in the provider.
NOTE: If one zone is sold out, it will not be exported.
Example Usage
using Pulumi;
using AliCloud = Pulumi.AliCloud;
class MyStack : Stack
{
public MyStack()
{
var zonesDs = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
{
AvailableDiskCategory = "cloud_ssd",
AvailableInstanceType = "ecs.n4.large",
}));
// Create an ECS instance with the first matched zone
var instance = new AliCloud.Ecs.Instance("instance", new AliCloud.Ecs.InstanceArgs
{
AvailabilityZone = zonesDs.Apply(zonesDs => zonesDs.Zones[0].Id),
});
}
}
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud/ecs"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
opt0 := "cloud_ssd"
opt1 := "ecs.n4.large"
zonesDs, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
AvailableDiskCategory: &opt0,
AvailableInstanceType: &opt1,
}, nil)
if err != nil {
return err
}
_, err = ecs.NewInstance(ctx, "instance", &ecs.InstanceArgs{
AvailabilityZone: pulumi.String(zonesDs.Zones[0].Id),
})
if err != nil {
return err
}
return nil
})
}
import pulumi
import pulumi_alicloud as alicloud
zones_ds = alicloud.get_zones(available_disk_category="cloud_ssd",
available_instance_type="ecs.n4.large")
# Create an ECS instance with the first matched zone
instance = alicloud.ecs.Instance("instance", availability_zone=zones_ds.zones[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
// Declare the data source
const zonesDs = pulumi.output(alicloud.getZones({
availableDiskCategory: "cloud_ssd",
availableInstanceType: "ecs.n4.large",
}, { async: true }));
// Create an ECS instance with the first matched zone
const instance = new alicloud.ecs.Instance("instance", {
availabilityZone: zonesDs.zones[0].id,
});
Using getZones
function getZones(args: GetZonesArgs, opts?: InvokeOptions): Promise<GetZonesResult>
def get_zones(available_disk_category: Optional[str] = None, available_instance_type: Optional[str] = None, available_resource_creation: Optional[str] = None, available_slb_address_ip_version: Optional[str] = None, available_slb_address_type: Optional[str] = None, enable_details: Optional[bool] = None, instance_charge_type: Optional[str] = None, multi: Optional[bool] = None, network_type: Optional[str] = None, output_file: Optional[str] = None, spot_strategy: Optional[str] = None, opts: Optional[InvokeOptions] = None) -> GetZonesResult
func GetZones(ctx *Context, args *GetZonesArgs, opts ...InvokeOption) (*GetZonesResult, error)
Note: This function is named
GetZones
in the Go SDK.
public static class GetZones {
public static Task<GetZonesResult> InvokeAsync(GetZonesArgs args, InvokeOptions? opts = null)
}
The following arguments are supported:
- Available
Disk stringCategory Filter the results by a specific disk category. Can be either
cloud
,cloud_efficiency
,cloud_ssd
,ephemeral_ssd
.- Available
Instance stringType Filter the results by a specific instance type.
- Available
Resource stringCreation Filter the results by a specific resource type. Valid values:
Instance
,Disk
,VSwitch
,Rds
,KVStore
,FunctionCompute
,Elasticsearch
,Slb
.- Available
Slb stringAddress Ip Version Filter the results by a slb instance address version. Can be either
ipv4
, oripv6
. > NOTE: The disk categorycloud
has been outdated and can only be used by non-I/O Optimized ECS instances. Many availability zones don’t support it. It is recommended to usecloud_efficiency
orcloud_ssd
.- Available
Slb stringAddress Type Filter the results by a slb instance address type. Can be either
Vpc
,classic_internet
orclassic_intranet
- Enable
Details bool Default to false and only output
id
in thezones
block. Set it to true can output more details.- Instance
Charge stringType Filter the results by a specific ECS instance charge type. Valid values:
PrePaid
andPostPaid
. Default toPostPaid
.- Multi bool
Indicate whether the zones can be used in a multi AZ configuration. Default to
false
. Multi AZ is usually used to launch RDS instances.- Network
Type string Filter the results by a specific network type. Valid values:
Classic
andVpc
.- Output
File string - Spot
Strategy string - (Optional) Filter the results by a specific ECS spot type. Valid values:
NoSpot
,SpotWithPriceLimit
andSpotAsPriceGo
. Default toNoSpot
.
- (Optional) Filter the results by a specific ECS spot type. Valid values:
- Available
Disk stringCategory Filter the results by a specific disk category. Can be either
cloud
,cloud_efficiency
,cloud_ssd
,ephemeral_ssd
.- Available
Instance stringType Filter the results by a specific instance type.
- Available
Resource stringCreation Filter the results by a specific resource type. Valid values:
Instance
,Disk
,VSwitch
,Rds
,KVStore
,FunctionCompute
,Elasticsearch
,Slb
.- Available
Slb stringAddress Ip Version Filter the results by a slb instance address version. Can be either
ipv4
, oripv6
. > NOTE: The disk categorycloud
has been outdated and can only be used by non-I/O Optimized ECS instances. Many availability zones don’t support it. It is recommended to usecloud_efficiency
orcloud_ssd
.- Available
Slb stringAddress Type Filter the results by a slb instance address type. Can be either
Vpc
,classic_internet
orclassic_intranet
- Enable
Details bool Default to false and only output
id
in thezones
block. Set it to true can output more details.- Instance
Charge stringType Filter the results by a specific ECS instance charge type. Valid values:
PrePaid
andPostPaid
. Default toPostPaid
.- Multi bool
Indicate whether the zones can be used in a multi AZ configuration. Default to
false
. Multi AZ is usually used to launch RDS instances.- Network
Type string Filter the results by a specific network type. Valid values:
Classic
andVpc
.- Output
File string - Spot
Strategy string - (Optional) Filter the results by a specific ECS spot type. Valid values:
NoSpot
,SpotWithPriceLimit
andSpotAsPriceGo
. Default toNoSpot
.
- (Optional) Filter the results by a specific ECS spot type. Valid values:
- available
Disk stringCategory Filter the results by a specific disk category. Can be either
cloud
,cloud_efficiency
,cloud_ssd
,ephemeral_ssd
.- available
Instance stringType Filter the results by a specific instance type.
- available
Resource stringCreation Filter the results by a specific resource type. Valid values:
Instance
,Disk
,VSwitch
,Rds
,KVStore
,FunctionCompute
,Elasticsearch
,Slb
.- available
Slb stringAddress Ip Version Filter the results by a slb instance address version. Can be either
ipv4
, oripv6
. > NOTE: The disk categorycloud
has been outdated and can only be used by non-I/O Optimized ECS instances. Many availability zones don’t support it. It is recommended to usecloud_efficiency
orcloud_ssd
.- available
Slb stringAddress Type Filter the results by a slb instance address type. Can be either
Vpc
,classic_internet
orclassic_intranet
- enable
Details boolean Default to false and only output
id
in thezones
block. Set it to true can output more details.- instance
Charge stringType Filter the results by a specific ECS instance charge type. Valid values:
PrePaid
andPostPaid
. Default toPostPaid
.- multi boolean
Indicate whether the zones can be used in a multi AZ configuration. Default to
false
. Multi AZ is usually used to launch RDS instances.- network
Type string Filter the results by a specific network type. Valid values:
Classic
andVpc
.- output
File string - spot
Strategy string - (Optional) Filter the results by a specific ECS spot type. Valid values:
NoSpot
,SpotWithPriceLimit
andSpotAsPriceGo
. Default toNoSpot
.
- (Optional) Filter the results by a specific ECS spot type. Valid values:
- available_
disk_ strcategory Filter the results by a specific disk category. Can be either
cloud
,cloud_efficiency
,cloud_ssd
,ephemeral_ssd
.- available_
instance_ strtype Filter the results by a specific instance type.
- available_
resource_ strcreation Filter the results by a specific resource type. Valid values:
Instance
,Disk
,VSwitch
,Rds
,KVStore
,FunctionCompute
,Elasticsearch
,Slb
.- available_
slb_ straddress_ ip_ version Filter the results by a slb instance address version. Can be either
ipv4
, oripv6
. > NOTE: The disk categorycloud
has been outdated and can only be used by non-I/O Optimized ECS instances. Many availability zones don’t support it. It is recommended to usecloud_efficiency
orcloud_ssd
.- available_
slb_ straddress_ type Filter the results by a slb instance address type. Can be either
Vpc
,classic_internet
orclassic_intranet
- enable_
details bool Default to false and only output
id
in thezones
block. Set it to true can output more details.- instance_
charge_ strtype Filter the results by a specific ECS instance charge type. Valid values:
PrePaid
andPostPaid
. Default toPostPaid
.- multi bool
Indicate whether the zones can be used in a multi AZ configuration. Default to
false
. Multi AZ is usually used to launch RDS instances.- network_
type str Filter the results by a specific network type. Valid values:
Classic
andVpc
.- output_
file str - spot_
strategy str - (Optional) Filter the results by a specific ECS spot type. Valid values:
NoSpot
,SpotWithPriceLimit
andSpotAsPriceGo
. Default toNoSpot
.
- (Optional) Filter the results by a specific ECS spot type. Valid values:
getZones Result
The following output properties are available:
- Id string
The provider-assigned unique ID for this managed resource.
- Ids List<string>
A list of zone IDs.
- Zones
List<Pulumi.
Ali Cloud. Outputs. Get Zones Zone> A list of availability zones. Each element contains the following attributes:
- Available
Disk stringCategory - Available
Instance stringType - Available
Resource stringCreation Type of resources that can be created.
- Available
Slb stringAddress Ip Version - Available
Slb stringAddress Type - Enable
Details bool - Instance
Charge stringType - Multi bool
- Network
Type string - Output
File string - Spot
Strategy string
- Id string
The provider-assigned unique ID for this managed resource.
- Ids []string
A list of zone IDs.
- Zones
[]Get
Zones Zone A list of availability zones. Each element contains the following attributes:
- Available
Disk stringCategory - Available
Instance stringType - Available
Resource stringCreation Type of resources that can be created.
- Available
Slb stringAddress Ip Version - Available
Slb stringAddress Type - Enable
Details bool - Instance
Charge stringType - Multi bool
- Network
Type string - Output
File string - Spot
Strategy string
- id string
The provider-assigned unique ID for this managed resource.
- ids string[]
A list of zone IDs.
- zones
Get
Zones Zone[] A list of availability zones. Each element contains the following attributes:
- available
Disk stringCategory - available
Instance stringType - available
Resource stringCreation Type of resources that can be created.
- available
Slb stringAddress Ip Version - available
Slb stringAddress Type - enable
Details boolean - instance
Charge stringType - multi boolean
- network
Type string - output
File string - spot
Strategy string
- id str
The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
A list of zone IDs.
- zones
Sequence[Get
Zones Zone] A list of availability zones. Each element contains the following attributes:
- available_
disk_ strcategory - available_
instance_ strtype - available_
resource_ strcreation Type of resources that can be created.
- available_
slb_ straddress_ ip_ version - available_
slb_ straddress_ type - enable_
details bool - instance_
charge_ strtype - multi bool
- network_
type str - output_
file str - spot_
strategy str
Supporting Types
GetZonesZone
- Available
Disk List<string>Categories Set of supported disk categories.
- Available
Instance List<string>Types Allowed instance types.
- Available
Resource List<string>Creations Filter the results by a specific resource type. Valid values:
Instance
,Disk
,VSwitch
,Rds
,KVStore
,FunctionCompute
,Elasticsearch
,Slb
.- Id string
ID of the zone.
- Local
Name string Name of the zone in the local language.
- Multi
Zone List<string>Ids A list of zone ids in which the multi zone.
- Slb
Slave List<string>Zone Ids A list of slb slave zone ids in which the slb master zone.
- Available
Disk []stringCategories Set of supported disk categories.
- Available
Instance []stringTypes Allowed instance types.
- Available
Resource []stringCreations Filter the results by a specific resource type. Valid values:
Instance
,Disk
,VSwitch
,Rds
,KVStore
,FunctionCompute
,Elasticsearch
,Slb
.- Id string
ID of the zone.
- Local
Name string Name of the zone in the local language.
- Multi
Zone []stringIds A list of zone ids in which the multi zone.
- Slb
Slave []stringZone Ids A list of slb slave zone ids in which the slb master zone.
- available
Disk string[]Categories Set of supported disk categories.
- available
Instance string[]Types Allowed instance types.
- available
Resource string[]Creations Filter the results by a specific resource type. Valid values:
Instance
,Disk
,VSwitch
,Rds
,KVStore
,FunctionCompute
,Elasticsearch
,Slb
.- id string
ID of the zone.
- local
Name string Name of the zone in the local language.
- multi
Zone string[]Ids A list of zone ids in which the multi zone.
- slb
Slave string[]Zone Ids A list of slb slave zone ids in which the slb master zone.
- available_
disk_ Sequence[str]categories Set of supported disk categories.
- available_
instance_ Sequence[str]types Allowed instance types.
- available_
resource_ Sequence[str]creations Filter the results by a specific resource type. Valid values:
Instance
,Disk
,VSwitch
,Rds
,KVStore
,FunctionCompute
,Elasticsearch
,Slb
.- id str
ID of the zone.
- local_
name str Name of the zone in the local language.
- multi_
zone_ Sequence[str]ids A list of zone ids in which the multi zone.
- slb_
slave_ Sequence[str]zone_ ids A list of slb slave zone ids in which the slb master zone.
Package Details
- Repository
- https://github.com/pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.