1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. cen
  5. getInstances
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.cen.getInstances

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides CEN instances available to the user.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const cenInstancesDs = alicloud.cen.getInstances({
    ids: ["cen-id1"],
    nameRegex: "^foo",
});
export const firstCenInstanceId = cenInstancesDs.then(cenInstancesDs => cenInstancesDs.instances?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

cen_instances_ds = alicloud.cen.get_instances(ids=["cen-id1"],
    name_regex="^foo")
pulumi.export("firstCenInstanceId", cen_instances_ds.instances[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cen"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cenInstancesDs, err := cen.GetInstances(ctx, &cen.GetInstancesArgs{
			Ids: []string{
				"cen-id1",
			},
			NameRegex: pulumi.StringRef("^foo"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstCenInstanceId", cenInstancesDs.Instances[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var cenInstancesDs = AliCloud.Cen.GetInstances.Invoke(new()
    {
        Ids = new[]
        {
            "cen-id1",
        },
        NameRegex = "^foo",
    });

    return new Dictionary<string, object?>
    {
        ["firstCenInstanceId"] = cenInstancesDs.Apply(getInstancesResult => getInstancesResult.Instances[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cen.CenFunctions;
import com.pulumi.alicloud.cen.inputs.GetInstancesArgs;
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 cenInstancesDs = CenFunctions.getInstances(GetInstancesArgs.builder()
            .ids("cen-id1")
            .nameRegex("^foo")
            .build());

        ctx.export("firstCenInstanceId", cenInstancesDs.applyValue(getInstancesResult -> getInstancesResult.instances()[0].id()));
    }
}
Copy
variables:
  cenInstancesDs:
    fn::invoke:
      function: alicloud:cen:getInstances
      arguments:
        ids:
          - cen-id1
        nameRegex: ^foo
outputs:
  firstCenInstanceId: ${cenInstancesDs.instances[0].id}
Copy

Using getInstances

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 getInstances(args: GetInstancesArgs, opts?: InvokeOptions): Promise<GetInstancesResult>
function getInstancesOutput(args: GetInstancesOutputArgs, opts?: InvokeOptions): Output<GetInstancesResult>
Copy
def get_instances(ids: Optional[Sequence[str]] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  status: Optional[str] = None,
                  tags: Optional[Mapping[str, str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetInstancesResult
def get_instances_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  name_regex: Optional[pulumi.Input[str]] = None,
                  output_file: 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[GetInstancesResult]
Copy
func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)
func GetInstancesOutput(ctx *Context, args *GetInstancesOutputArgs, opts ...InvokeOption) GetInstancesResultOutput
Copy

> Note: This function is named GetInstances in the Go SDK.

public static class GetInstances 
{
    public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args, InvokeOptions? opts = null)
    public static Output<GetInstancesResult> Invoke(GetInstancesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
public static Output<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:cen/getInstances:getInstances
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Ids Changes to this property will trigger replacement. List<string>
A list of CEN instances IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter CEN instances by name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
The status of CEN instance. Valid value: Active, Creating and Deleting.
Tags Dictionary<string, string>
A mapping of tags to assign to the resource.
Ids Changes to this property will trigger replacement. []string
A list of CEN instances IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter CEN instances by name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
The status of CEN instance. Valid value: Active, Creating and Deleting.
Tags map[string]string
A mapping of tags to assign to the resource.
ids Changes to this property will trigger replacement. List<String>
A list of CEN instances IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter CEN instances by name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
The status of CEN instance. Valid value: Active, Creating and Deleting.
tags Map<String,String>
A mapping of tags to assign to the resource.
ids Changes to this property will trigger replacement. string[]
A list of CEN instances IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter CEN instances by name.
outputFile string
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. string
The status of CEN instance. Valid value: Active, Creating and Deleting.
tags {[key: string]: string}
A mapping of tags to assign to the resource.
ids Changes to this property will trigger replacement. Sequence[str]
A list of CEN instances IDs.
name_regex Changes to this property will trigger replacement. str
A regex string to filter CEN instances by name.
output_file str
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. str
The status of CEN instance. Valid value: Active, Creating and Deleting.
tags Mapping[str, str]
A mapping of tags to assign to the resource.
ids Changes to this property will trigger replacement. List<String>
A list of CEN instances IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter CEN instances by name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
The status of CEN instance. Valid value: Active, Creating and Deleting.
tags Map<String>
A mapping of tags to assign to the resource.

getInstances Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
A list of CEN instances IDs.
Instances List<Pulumi.AliCloud.Cen.Outputs.GetInstancesInstance>
A list of CEN instances. Each element contains the following attributes:
Names List<string>
A list of CEN instances names.
NameRegex string
OutputFile string
Status string
Status of the CEN instance, including "Creating", "Active" and "Deleting".
Tags Dictionary<string, string>
A map of tags assigned to the Cen Instance.
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
A list of CEN instances IDs.
Instances []GetInstancesInstance
A list of CEN instances. Each element contains the following attributes:
Names []string
A list of CEN instances names.
NameRegex string
OutputFile string
Status string
Status of the CEN instance, including "Creating", "Active" and "Deleting".
Tags map[string]string
A map of tags assigned to the Cen Instance.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
A list of CEN instances IDs.
instances List<GetInstancesInstance>
A list of CEN instances. Each element contains the following attributes:
names List<String>
A list of CEN instances names.
nameRegex String
outputFile String
status String
Status of the CEN instance, including "Creating", "Active" and "Deleting".
tags Map<String,String>
A map of tags assigned to the Cen Instance.
id string
The provider-assigned unique ID for this managed resource.
ids string[]
A list of CEN instances IDs.
instances GetInstancesInstance[]
A list of CEN instances. Each element contains the following attributes:
names string[]
A list of CEN instances names.
nameRegex string
outputFile string
status string
Status of the CEN instance, including "Creating", "Active" and "Deleting".
tags {[key: string]: string}
A map of tags assigned to the Cen Instance.
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
A list of CEN instances IDs.
instances Sequence[GetInstancesInstance]
A list of CEN instances. Each element contains the following attributes:
names Sequence[str]
A list of CEN instances names.
name_regex str
output_file str
status str
Status of the CEN instance, including "Creating", "Active" and "Deleting".
tags Mapping[str, str]
A map of tags assigned to the Cen Instance.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
A list of CEN instances IDs.
instances List<Property Map>
A list of CEN instances. Each element contains the following attributes:
names List<String>
A list of CEN instances names.
nameRegex String
outputFile String
status String
Status of the CEN instance, including "Creating", "Active" and "Deleting".
tags Map<String>
A map of tags assigned to the Cen Instance.

Supporting Types

GetInstancesInstance

CenBandwidthPackageIds This property is required. List<string>
List of CEN Bandwidth Package IDs in the specified CEN instance.
CenId This property is required. string
ID of the CEN instance.
CenInstanceName This property is required. string
Name of the CEN instance.
CreateTime This property is required. string
The creation time of the CEN Instance.
Description This property is required. string
Description of the CEN instance.
Id This property is required. string
ID of the CEN instance.
Name This property is required. string
Name of the CEN instance.
ProtectionLevel This property is required. string
Indicates the allowed level of CIDR block overlapping.
Status This property is required. string
The status of CEN instance. Valid value: Active, Creating and Deleting.
Tags This property is required. Dictionary<string, string>
A mapping of tags to assign to the resource.
CenBandwidthPackageIds This property is required. []string
List of CEN Bandwidth Package IDs in the specified CEN instance.
CenId This property is required. string
ID of the CEN instance.
CenInstanceName This property is required. string
Name of the CEN instance.
CreateTime This property is required. string
The creation time of the CEN Instance.
Description This property is required. string
Description of the CEN instance.
Id This property is required. string
ID of the CEN instance.
Name This property is required. string
Name of the CEN instance.
ProtectionLevel This property is required. string
Indicates the allowed level of CIDR block overlapping.
Status This property is required. string
The status of CEN instance. Valid value: Active, Creating and Deleting.
Tags This property is required. map[string]string
A mapping of tags to assign to the resource.
cenBandwidthPackageIds This property is required. List<String>
List of CEN Bandwidth Package IDs in the specified CEN instance.
cenId This property is required. String
ID of the CEN instance.
cenInstanceName This property is required. String
Name of the CEN instance.
createTime This property is required. String
The creation time of the CEN Instance.
description This property is required. String
Description of the CEN instance.
id This property is required. String
ID of the CEN instance.
name This property is required. String
Name of the CEN instance.
protectionLevel This property is required. String
Indicates the allowed level of CIDR block overlapping.
status This property is required. String
The status of CEN instance. Valid value: Active, Creating and Deleting.
tags This property is required. Map<String,String>
A mapping of tags to assign to the resource.
cenBandwidthPackageIds This property is required. string[]
List of CEN Bandwidth Package IDs in the specified CEN instance.
cenId This property is required. string
ID of the CEN instance.
cenInstanceName This property is required. string
Name of the CEN instance.
createTime This property is required. string
The creation time of the CEN Instance.
description This property is required. string
Description of the CEN instance.
id This property is required. string
ID of the CEN instance.
name This property is required. string
Name of the CEN instance.
protectionLevel This property is required. string
Indicates the allowed level of CIDR block overlapping.
status This property is required. string
The status of CEN instance. Valid value: Active, Creating and Deleting.
tags This property is required. {[key: string]: string}
A mapping of tags to assign to the resource.
cen_bandwidth_package_ids This property is required. Sequence[str]
List of CEN Bandwidth Package IDs in the specified CEN instance.
cen_id This property is required. str
ID of the CEN instance.
cen_instance_name This property is required. str
Name of the CEN instance.
create_time This property is required. str
The creation time of the CEN Instance.
description This property is required. str
Description of the CEN instance.
id This property is required. str
ID of the CEN instance.
name This property is required. str
Name of the CEN instance.
protection_level This property is required. str
Indicates the allowed level of CIDR block overlapping.
status This property is required. str
The status of CEN instance. Valid value: Active, Creating and Deleting.
tags This property is required. Mapping[str, str]
A mapping of tags to assign to the resource.
cenBandwidthPackageIds This property is required. List<String>
List of CEN Bandwidth Package IDs in the specified CEN instance.
cenId This property is required. String
ID of the CEN instance.
cenInstanceName This property is required. String
Name of the CEN instance.
createTime This property is required. String
The creation time of the CEN Instance.
description This property is required. String
Description of the CEN instance.
id This property is required. String
ID of the CEN instance.
name This property is required. String
Name of the CEN instance.
protectionLevel This property is required. String
Indicates the allowed level of CIDR block overlapping.
status This property is required. String
The status of CEN instance. Valid value: Active, Creating and Deleting.
tags This property is required. Map<String>
A mapping of tags to assign to the resource.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi