Alibaba Cloud v3.75.0 published on Friday, Mar 7, 2025 by Pulumi
alicloud.ecs.getKeyPairs
Explore with Pulumi AI
DEPRECATED: This datasource has been renamed to alicloud.ecs.getEcsKeyPairs from version 1.121.0.
This data source provides a list of key pairs in an Alibaba Cloud account according to the specified filters.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
// Declare the data source
const defaultKeyPair = new alicloud.ecs.KeyPair("default", {keyName: "keyPairDatasource"});
const _default = alicloud.ecs.getKeyPairsOutput({
    nameRegex: defaultKeyPair.keyName,
});
import pulumi
import pulumi_alicloud as alicloud
# Declare the data source
default_key_pair = alicloud.ecs.KeyPair("default", key_name="keyPairDatasource")
default = alicloud.ecs.get_key_pairs_output(name_regex=default_key_pair.key_name)
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 {
		// Declare the data source
		defaultKeyPair, err := ecs.NewKeyPair(ctx, "default", &ecs.KeyPairArgs{
			KeyName: pulumi.String("keyPairDatasource"),
		})
		if err != nil {
			return err
		}
		_ = ecs.GetKeyPairsOutput(ctx, ecs.GetKeyPairsOutputArgs{
			NameRegex: defaultKeyPair.KeyName,
		}, nil)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    // Declare the data source
    var defaultKeyPair = new AliCloud.Ecs.KeyPair("default", new()
    {
        KeyName = "keyPairDatasource",
    });
    var @default = AliCloud.Ecs.GetKeyPairs.Invoke(new()
    {
        NameRegex = defaultKeyPair.KeyName,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.KeyPair;
import com.pulumi.alicloud.ecs.KeyPairArgs;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetKeyPairsArgs;
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) {
        // Declare the data source
        var defaultKeyPair = new KeyPair("defaultKeyPair", KeyPairArgs.builder()
            .keyName("keyPairDatasource")
            .build());
        final var default = EcsFunctions.getKeyPairs(GetKeyPairsArgs.builder()
            .nameRegex(defaultKeyPair.keyName())
            .build());
    }
}
resources:
  # Declare the data source
  defaultKeyPair:
    type: alicloud:ecs:KeyPair
    name: default
    properties:
      keyName: keyPairDatasource
variables:
  default:
    fn::invoke:
      function: alicloud:ecs:getKeyPairs
      arguments:
        nameRegex: ${defaultKeyPair.keyName}
Using getKeyPairs
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 getKeyPairs(args: GetKeyPairsArgs, opts?: InvokeOptions): Promise<GetKeyPairsResult>
function getKeyPairsOutput(args: GetKeyPairsOutputArgs, opts?: InvokeOptions): Output<GetKeyPairsResult>def get_key_pairs(finger_print: Optional[str] = None,
                  ids: Optional[Sequence[str]] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  resource_group_id: Optional[str] = None,
                  tags: Optional[Mapping[str, str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetKeyPairsResult
def get_key_pairs_output(finger_print: Optional[pulumi.Input[str]] = None,
                  ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  name_regex: Optional[pulumi.Input[str]] = None,
                  output_file: Optional[pulumi.Input[str]] = None,
                  resource_group_id: Optional[pulumi.Input[str]] = None,
                  tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetKeyPairsResult]func GetKeyPairs(ctx *Context, args *GetKeyPairsArgs, opts ...InvokeOption) (*GetKeyPairsResult, error)
func GetKeyPairsOutput(ctx *Context, args *GetKeyPairsOutputArgs, opts ...InvokeOption) GetKeyPairsResultOutput> Note: This function is named GetKeyPairs in the Go SDK.
public static class GetKeyPairs 
{
    public static Task<GetKeyPairsResult> InvokeAsync(GetKeyPairsArgs args, InvokeOptions? opts = null)
    public static Output<GetKeyPairsResult> Invoke(GetKeyPairsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetKeyPairsResult> getKeyPairs(GetKeyPairsArgs args, InvokeOptions options)
public static Output<GetKeyPairsResult> getKeyPairs(GetKeyPairsArgs args, InvokeOptions options)
fn::invoke:
  function: alicloud:ecs/getKeyPairs:getKeyPairs
  arguments:
    # arguments dictionaryThe following arguments are supported:
- FingerPrint string
- A finger print used to retrieve specified key pair.
- Ids List<string>
- A list of key pair IDs.
- NameRegex string
- A regex string to apply to the resulting key pairs.
- OutputFile string
- File name where to save data source results (after running pulumi preview).
- ResourceGroup stringId 
- The Id of resource group which the key pair belongs.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- FingerPrint string
- A finger print used to retrieve specified key pair.
- Ids []string
- A list of key pair IDs.
- NameRegex string
- A regex string to apply to the resulting key pairs.
- OutputFile string
- File name where to save data source results (after running pulumi preview).
- ResourceGroup stringId 
- The Id of resource group which the key pair belongs.
- map[string]string
- A mapping of tags to assign to the resource.
- fingerPrint String
- A finger print used to retrieve specified key pair.
- ids List<String>
- A list of key pair IDs.
- nameRegex String
- A regex string to apply to the resulting key pairs.
- outputFile String
- File name where to save data source results (after running pulumi preview).
- resourceGroup StringId 
- The Id of resource group which the key pair belongs.
- Map<String,String>
- A mapping of tags to assign to the resource.
- fingerPrint string
- A finger print used to retrieve specified key pair.
- ids string[]
- A list of key pair IDs.
- nameRegex string
- A regex string to apply to the resulting key pairs.
- outputFile string
- File name where to save data source results (after running pulumi preview).
- resourceGroup stringId 
- The Id of resource group which the key pair belongs.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- finger_print str
- A finger print used to retrieve specified key pair.
- ids Sequence[str]
- A list of key pair IDs.
- name_regex str
- A regex string to apply to the resulting key pairs.
- output_file str
- File name where to save data source results (after running pulumi preview).
- resource_group_ strid 
- The Id of resource group which the key pair belongs.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- fingerPrint String
- A finger print used to retrieve specified key pair.
- ids List<String>
- A list of key pair IDs.
- nameRegex String
- A regex string to apply to the resulting key pairs.
- outputFile String
- File name where to save data source results (after running pulumi preview).
- resourceGroup StringId 
- The Id of resource group which the key pair belongs.
- Map<String>
- A mapping of tags to assign to the resource.
getKeyPairs Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- KeyPairs List<Pulumi.Ali Cloud. Ecs. Outputs. Get Key Pairs Key Pair> 
- A list of key pairs. Each element contains the following attributes:
- Names List<string>
- A list of key pair names.
- Pairs
List<Pulumi.Ali Cloud. Ecs. Outputs. Get Key Pairs Pair> 
- FingerPrint string
- Finger print of the key pair.
- NameRegex string
- OutputFile string
- ResourceGroup stringId 
- The Id of resource group.
- Dictionary<string, string>
- (Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- KeyPairs []GetKey Pairs Key Pair 
- A list of key pairs. Each element contains the following attributes:
- Names []string
- A list of key pair names.
- Pairs
[]GetKey Pairs Pair 
- FingerPrint string
- Finger print of the key pair.
- NameRegex string
- OutputFile string
- ResourceGroup stringId 
- The Id of resource group.
- map[string]string
- (Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- keyPairs List<GetKey Pairs Key Pair> 
- A list of key pairs. Each element contains the following attributes:
- names List<String>
- A list of key pair names.
- pairs
List<GetKey Pairs Pair> 
- fingerPrint String
- Finger print of the key pair.
- nameRegex String
- outputFile String
- resourceGroup StringId 
- The Id of resource group.
- Map<String,String>
- (Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- keyPairs GetKey Pairs Key Pair[] 
- A list of key pairs. Each element contains the following attributes:
- names string[]
- A list of key pair names.
- pairs
GetKey Pairs Pair[] 
- fingerPrint string
- Finger print of the key pair.
- nameRegex string
- outputFile string
- resourceGroup stringId 
- The Id of resource group.
- {[key: string]: string}
- (Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- key_pairs Sequence[GetKey Pairs Key Pair] 
- A list of key pairs. Each element contains the following attributes:
- names Sequence[str]
- A list of key pair names.
- pairs
Sequence[GetKey Pairs Pair] 
- finger_print str
- Finger print of the key pair.
- name_regex str
- output_file str
- resource_group_ strid 
- The Id of resource group.
- Mapping[str, str]
- (Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- keyPairs List<Property Map>
- A list of key pairs. Each element contains the following attributes:
- names List<String>
- A list of key pair names.
- pairs List<Property Map>
- fingerPrint String
- Finger print of the key pair.
- nameRegex String
- outputFile String
- resourceGroup StringId 
- The Id of resource group.
- Map<String>
- (Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.
Supporting Types
GetKeyPairsKeyPair    
- FingerPrint string
- A finger print used to retrieve specified key pair.
- Id string
- ID of the key pair.
- Instances
List<Pulumi.Ali Cloud. Ecs. Inputs. Get Key Pairs Key Pair Instance> 
- A list of ECS instances that has been bound this key pair.
- KeyName string
- Name of the key pair.
- KeyPair stringName 
- ResourceGroup stringId 
- The Id of resource group which the key pair belongs.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- FingerPrint string
- A finger print used to retrieve specified key pair.
- Id string
- ID of the key pair.
- Instances
[]GetKey Pairs Key Pair Instance 
- A list of ECS instances that has been bound this key pair.
- KeyName string
- Name of the key pair.
- KeyPair stringName 
- ResourceGroup stringId 
- The Id of resource group which the key pair belongs.
- map[string]string
- A mapping of tags to assign to the resource.
- fingerPrint String
- A finger print used to retrieve specified key pair.
- id String
- ID of the key pair.
- instances
List<GetKey Pairs Key Pair Instance> 
- A list of ECS instances that has been bound this key pair.
- keyName String
- Name of the key pair.
- keyPair StringName 
- resourceGroup StringId 
- The Id of resource group which the key pair belongs.
- Map<String,String>
- A mapping of tags to assign to the resource.
- fingerPrint string
- A finger print used to retrieve specified key pair.
- id string
- ID of the key pair.
- instances
GetKey Pairs Key Pair Instance[] 
- A list of ECS instances that has been bound this key pair.
- keyName string
- Name of the key pair.
- keyPair stringName 
- resourceGroup stringId 
- The Id of resource group which the key pair belongs.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- finger_print str
- A finger print used to retrieve specified key pair.
- id str
- ID of the key pair.
- instances
Sequence[GetKey Pairs Key Pair Instance] 
- A list of ECS instances that has been bound this key pair.
- key_name str
- Name of the key pair.
- key_pair_ strname 
- resource_group_ strid 
- The Id of resource group which the key pair belongs.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- fingerPrint String
- A finger print used to retrieve specified key pair.
- id String
- ID of the key pair.
- instances List<Property Map>
- A list of ECS instances that has been bound this key pair.
- keyName String
- Name of the key pair.
- keyPair StringName 
- resourceGroup StringId 
- The Id of resource group which the key pair belongs.
- Map<String>
- A mapping of tags to assign to the resource.
GetKeyPairsKeyPairInstance     
- AvailabilityZone string
- The ID of the availability zone where the ECS instance is located.
- Description string
- ImageId string
- InstanceId string
- The ID of the ECS instance.
- InstanceName string
- The name of the ECS instance.
- InstanceType string
- KeyName string
- Name of the key pair.
- PrivateIp string
- The private IP address of the ECS instance.
- PublicIp string
- The public IP address or EIP of the ECS instance.
- RegionId string
- Status string
- VswitchId string
- The ID of the vSwitch attached to the ECS instance.
- AvailabilityZone string
- The ID of the availability zone where the ECS instance is located.
- Description string
- ImageId string
- InstanceId string
- The ID of the ECS instance.
- InstanceName string
- The name of the ECS instance.
- InstanceType string
- KeyName string
- Name of the key pair.
- PrivateIp string
- The private IP address of the ECS instance.
- PublicIp string
- The public IP address or EIP of the ECS instance.
- RegionId string
- Status string
- VswitchId string
- The ID of the vSwitch attached to the ECS instance.
- availabilityZone String
- The ID of the availability zone where the ECS instance is located.
- description String
- imageId String
- instanceId String
- The ID of the ECS instance.
- instanceName String
- The name of the ECS instance.
- instanceType String
- keyName String
- Name of the key pair.
- privateIp String
- The private IP address of the ECS instance.
- publicIp String
- The public IP address or EIP of the ECS instance.
- regionId String
- status String
- vswitchId String
- The ID of the vSwitch attached to the ECS instance.
- availabilityZone string
- The ID of the availability zone where the ECS instance is located.
- description string
- imageId string
- instanceId string
- The ID of the ECS instance.
- instanceName string
- The name of the ECS instance.
- instanceType string
- keyName string
- Name of the key pair.
- privateIp string
- The private IP address of the ECS instance.
- publicIp string
- The public IP address or EIP of the ECS instance.
- regionId string
- status string
- vswitchId string
- The ID of the vSwitch attached to the ECS instance.
- availability_zone str
- The ID of the availability zone where the ECS instance is located.
- description str
- image_id str
- instance_id str
- The ID of the ECS instance.
- instance_name str
- The name of the ECS instance.
- instance_type str
- key_name str
- Name of the key pair.
- private_ip str
- The private IP address of the ECS instance.
- public_ip str
- The public IP address or EIP of the ECS instance.
- region_id str
- status str
- vswitch_id str
- The ID of the vSwitch attached to the ECS instance.
- availabilityZone String
- The ID of the availability zone where the ECS instance is located.
- description String
- imageId String
- instanceId String
- The ID of the ECS instance.
- instanceName String
- The name of the ECS instance.
- instanceType String
- keyName String
- Name of the key pair.
- privateIp String
- The private IP address of the ECS instance.
- publicIp String
- The public IP address or EIP of the ECS instance.
- regionId String
- status String
- vswitchId String
- The ID of the vSwitch attached to the ECS instance.
GetKeyPairsPair   
- FingerPrint string
- A finger print used to retrieve specified key pair.
- Id string
- ID of the key pair.
- Instances
List<Pulumi.Ali Cloud. Ecs. Inputs. Get Key Pairs Pair Instance> 
- A list of ECS instances that has been bound this key pair.
- KeyName string
- Name of the key pair.
- KeyPair stringName 
- ResourceGroup stringId 
- The Id of resource group which the key pair belongs.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- FingerPrint string
- A finger print used to retrieve specified key pair.
- Id string
- ID of the key pair.
- Instances
[]GetKey Pairs Pair Instance 
- A list of ECS instances that has been bound this key pair.
- KeyName string
- Name of the key pair.
- KeyPair stringName 
- ResourceGroup stringId 
- The Id of resource group which the key pair belongs.
- map[string]string
- A mapping of tags to assign to the resource.
- fingerPrint String
- A finger print used to retrieve specified key pair.
- id String
- ID of the key pair.
- instances
List<GetKey Pairs Pair Instance> 
- A list of ECS instances that has been bound this key pair.
- keyName String
- Name of the key pair.
- keyPair StringName 
- resourceGroup StringId 
- The Id of resource group which the key pair belongs.
- Map<String,String>
- A mapping of tags to assign to the resource.
- fingerPrint string
- A finger print used to retrieve specified key pair.
- id string
- ID of the key pair.
- instances
GetKey Pairs Pair Instance[] 
- A list of ECS instances that has been bound this key pair.
- keyName string
- Name of the key pair.
- keyPair stringName 
- resourceGroup stringId 
- The Id of resource group which the key pair belongs.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- finger_print str
- A finger print used to retrieve specified key pair.
- id str
- ID of the key pair.
- instances
Sequence[GetKey Pairs Pair Instance] 
- A list of ECS instances that has been bound this key pair.
- key_name str
- Name of the key pair.
- key_pair_ strname 
- resource_group_ strid 
- The Id of resource group which the key pair belongs.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- fingerPrint String
- A finger print used to retrieve specified key pair.
- id String
- ID of the key pair.
- instances List<Property Map>
- A list of ECS instances that has been bound this key pair.
- keyName String
- Name of the key pair.
- keyPair StringName 
- resourceGroup StringId 
- The Id of resource group which the key pair belongs.
- Map<String>
- A mapping of tags to assign to the resource.
GetKeyPairsPairInstance    
- AvailabilityZone string
- The ID of the availability zone where the ECS instance is located.
- Description string
- ImageId string
- InstanceId string
- The ID of the ECS instance.
- InstanceName string
- The name of the ECS instance.
- InstanceType string
- KeyName string
- Name of the key pair.
- PrivateIp string
- The private IP address of the ECS instance.
- PublicIp string
- The public IP address or EIP of the ECS instance.
- RegionId string
- Status string
- VswitchId string
- The ID of the vSwitch attached to the ECS instance.
- AvailabilityZone string
- The ID of the availability zone where the ECS instance is located.
- Description string
- ImageId string
- InstanceId string
- The ID of the ECS instance.
- InstanceName string
- The name of the ECS instance.
- InstanceType string
- KeyName string
- Name of the key pair.
- PrivateIp string
- The private IP address of the ECS instance.
- PublicIp string
- The public IP address or EIP of the ECS instance.
- RegionId string
- Status string
- VswitchId string
- The ID of the vSwitch attached to the ECS instance.
- availabilityZone String
- The ID of the availability zone where the ECS instance is located.
- description String
- imageId String
- instanceId String
- The ID of the ECS instance.
- instanceName String
- The name of the ECS instance.
- instanceType String
- keyName String
- Name of the key pair.
- privateIp String
- The private IP address of the ECS instance.
- publicIp String
- The public IP address or EIP of the ECS instance.
- regionId String
- status String
- vswitchId String
- The ID of the vSwitch attached to the ECS instance.
- availabilityZone string
- The ID of the availability zone where the ECS instance is located.
- description string
- imageId string
- instanceId string
- The ID of the ECS instance.
- instanceName string
- The name of the ECS instance.
- instanceType string
- keyName string
- Name of the key pair.
- privateIp string
- The private IP address of the ECS instance.
- publicIp string
- The public IP address or EIP of the ECS instance.
- regionId string
- status string
- vswitchId string
- The ID of the vSwitch attached to the ECS instance.
- availability_zone str
- The ID of the availability zone where the ECS instance is located.
- description str
- image_id str
- instance_id str
- The ID of the ECS instance.
- instance_name str
- The name of the ECS instance.
- instance_type str
- key_name str
- Name of the key pair.
- private_ip str
- The private IP address of the ECS instance.
- public_ip str
- The public IP address or EIP of the ECS instance.
- region_id str
- status str
- vswitch_id str
- The ID of the vSwitch attached to the ECS instance.
- availabilityZone String
- The ID of the availability zone where the ECS instance is located.
- description String
- imageId String
- instanceId String
- The ID of the ECS instance.
- instanceName String
- The name of the ECS instance.
- instanceType String
- keyName String
- Name of the key pair.
- privateIp String
- The private IP address of the ECS instance.
- publicIp String
- The public IP address or EIP of the ECS instance.
- regionId String
- status String
- vswitchId String
- The ID of the vSwitch attached to the ECS instance.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the alicloudTerraform Provider.