Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

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:

AvailableDiskCategory string

Filter the results by a specific disk category. Can be either cloud, cloud_efficiency, cloud_ssd, ephemeral_ssd.

AvailableInstanceType string

Filter the results by a specific instance type.

AvailableResourceCreation string

Filter the results by a specific resource type. Valid values: Instance, Disk, VSwitch, Rds, KVStore, FunctionCompute, Elasticsearch, Slb.

AvailableSlbAddressIpVersion string

Filter the results by a slb instance address version. Can be either ipv4, or ipv6. > NOTE: The disk category cloud 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 use cloud_efficiency or cloud_ssd.

AvailableSlbAddressType string

Filter the results by a slb instance address type. Can be either Vpc, classic_internet or classic_intranet

EnableDetails bool

Default to false and only output id in the zones block. Set it to true can output more details.

InstanceChargeType string

Filter the results by a specific ECS instance charge type. Valid values: PrePaid and PostPaid. Default to PostPaid.

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.

NetworkType string

Filter the results by a specific network type. Valid values: Classic and Vpc.

OutputFile string
SpotStrategy string
  • (Optional) Filter the results by a specific ECS spot type. Valid values: NoSpot, SpotWithPriceLimit and SpotAsPriceGo. Default to NoSpot.
AvailableDiskCategory string

Filter the results by a specific disk category. Can be either cloud, cloud_efficiency, cloud_ssd, ephemeral_ssd.

AvailableInstanceType string

Filter the results by a specific instance type.

AvailableResourceCreation string

Filter the results by a specific resource type. Valid values: Instance, Disk, VSwitch, Rds, KVStore, FunctionCompute, Elasticsearch, Slb.

AvailableSlbAddressIpVersion string

Filter the results by a slb instance address version. Can be either ipv4, or ipv6. > NOTE: The disk category cloud 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 use cloud_efficiency or cloud_ssd.

AvailableSlbAddressType string

Filter the results by a slb instance address type. Can be either Vpc, classic_internet or classic_intranet

EnableDetails bool

Default to false and only output id in the zones block. Set it to true can output more details.

InstanceChargeType string

Filter the results by a specific ECS instance charge type. Valid values: PrePaid and PostPaid. Default to PostPaid.

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.

NetworkType string

Filter the results by a specific network type. Valid values: Classic and Vpc.

OutputFile string
SpotStrategy string
  • (Optional) Filter the results by a specific ECS spot type. Valid values: NoSpot, SpotWithPriceLimit and SpotAsPriceGo. Default to NoSpot.
availableDiskCategory string

Filter the results by a specific disk category. Can be either cloud, cloud_efficiency, cloud_ssd, ephemeral_ssd.

availableInstanceType string

Filter the results by a specific instance type.

availableResourceCreation string

Filter the results by a specific resource type. Valid values: Instance, Disk, VSwitch, Rds, KVStore, FunctionCompute, Elasticsearch, Slb.

availableSlbAddressIpVersion string

Filter the results by a slb instance address version. Can be either ipv4, or ipv6. > NOTE: The disk category cloud 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 use cloud_efficiency or cloud_ssd.

availableSlbAddressType string

Filter the results by a slb instance address type. Can be either Vpc, classic_internet or classic_intranet

enableDetails boolean

Default to false and only output id in the zones block. Set it to true can output more details.

instanceChargeType string

Filter the results by a specific ECS instance charge type. Valid values: PrePaid and PostPaid. Default to PostPaid.

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.

networkType string

Filter the results by a specific network type. Valid values: Classic and Vpc.

outputFile string
spotStrategy string
  • (Optional) Filter the results by a specific ECS spot type. Valid values: NoSpot, SpotWithPriceLimit and SpotAsPriceGo. Default to NoSpot.
available_disk_category str

Filter the results by a specific disk category. Can be either cloud, cloud_efficiency, cloud_ssd, ephemeral_ssd.

available_instance_type str

Filter the results by a specific instance type.

available_resource_creation str

Filter the results by a specific resource type. Valid values: Instance, Disk, VSwitch, Rds, KVStore, FunctionCompute, Elasticsearch, Slb.

available_slb_address_ip_version str

Filter the results by a slb instance address version. Can be either ipv4, or ipv6. > NOTE: The disk category cloud 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 use cloud_efficiency or cloud_ssd.

available_slb_address_type str

Filter the results by a slb instance address type. Can be either Vpc, classic_internet or classic_intranet

enable_details bool

Default to false and only output id in the zones block. Set it to true can output more details.

instance_charge_type str

Filter the results by a specific ECS instance charge type. Valid values: PrePaid and PostPaid. Default to PostPaid.

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 and Vpc.

output_file str
spot_strategy str
  • (Optional) Filter the results by a specific ECS spot type. Valid values: NoSpot, SpotWithPriceLimit and SpotAsPriceGo. Default to NoSpot.

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.AliCloud.Outputs.GetZonesZone>

A list of availability zones. Each element contains the following attributes:

AvailableDiskCategory string
AvailableInstanceType string
AvailableResourceCreation string

Type of resources that can be created.

AvailableSlbAddressIpVersion string
AvailableSlbAddressType string
EnableDetails bool
InstanceChargeType string
Multi bool
NetworkType string
OutputFile string
SpotStrategy string
Id string

The provider-assigned unique ID for this managed resource.

Ids []string

A list of zone IDs.

Zones []GetZonesZone

A list of availability zones. Each element contains the following attributes:

AvailableDiskCategory string
AvailableInstanceType string
AvailableResourceCreation string

Type of resources that can be created.

AvailableSlbAddressIpVersion string
AvailableSlbAddressType string
EnableDetails bool
InstanceChargeType string
Multi bool
NetworkType string
OutputFile string
SpotStrategy string
id string

The provider-assigned unique ID for this managed resource.

ids string[]

A list of zone IDs.

zones GetZonesZone[]

A list of availability zones. Each element contains the following attributes:

availableDiskCategory string
availableInstanceType string
availableResourceCreation string

Type of resources that can be created.

availableSlbAddressIpVersion string
availableSlbAddressType string
enableDetails boolean
instanceChargeType string
multi boolean
networkType string
outputFile string
spotStrategy string
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]

A list of zone IDs.

zones Sequence[GetZonesZone]

A list of availability zones. Each element contains the following attributes:

available_disk_category str
available_instance_type str
available_resource_creation str

Type of resources that can be created.

available_slb_address_ip_version str
available_slb_address_type str
enable_details bool
instance_charge_type str
multi bool
network_type str
output_file str
spot_strategy str

Supporting Types

GetZonesZone

AvailableDiskCategories List<string>

Set of supported disk categories.

AvailableInstanceTypes List<string>

Allowed instance types.

AvailableResourceCreations List<string>

Filter the results by a specific resource type. Valid values: Instance, Disk, VSwitch, Rds, KVStore, FunctionCompute, Elasticsearch, Slb.

Id string

ID of the zone.

LocalName string

Name of the zone in the local language.

MultiZoneIds List<string>

A list of zone ids in which the multi zone.

SlbSlaveZoneIds List<string>

A list of slb slave zone ids in which the slb master zone.

AvailableDiskCategories []string

Set of supported disk categories.

AvailableInstanceTypes []string

Allowed instance types.

AvailableResourceCreations []string

Filter the results by a specific resource type. Valid values: Instance, Disk, VSwitch, Rds, KVStore, FunctionCompute, Elasticsearch, Slb.

Id string

ID of the zone.

LocalName string

Name of the zone in the local language.

MultiZoneIds []string

A list of zone ids in which the multi zone.

SlbSlaveZoneIds []string

A list of slb slave zone ids in which the slb master zone.

availableDiskCategories string[]

Set of supported disk categories.

availableInstanceTypes string[]

Allowed instance types.

availableResourceCreations string[]

Filter the results by a specific resource type. Valid values: Instance, Disk, VSwitch, Rds, KVStore, FunctionCompute, Elasticsearch, Slb.

id string

ID of the zone.

localName string

Name of the zone in the local language.

multiZoneIds string[]

A list of zone ids in which the multi zone.

slbSlaveZoneIds string[]

A list of slb slave zone ids in which the slb master zone.

available_disk_categories Sequence[str]

Set of supported disk categories.

available_instance_types Sequence[str]

Allowed instance types.

available_resource_creations Sequence[str]

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_ids Sequence[str]

A list of zone ids in which the multi zone.

slb_slave_zone_ids Sequence[str]

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.