Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 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, Any]] = 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, Any]]] = 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)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:ecs/getKeyPairs:getKeyPairs
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Finger
Print string - A finger print used to retrieve specified key pair.
 - Ids List<string>
 - A list of key pair IDs.
 - Name
Regex string - A regex string to apply to the resulting key pairs.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Resource
Group stringId  - The Id of resource group which the key pair belongs.
 - Dictionary<string, object>
 - A mapping of tags to assign to the resource.
 
- Finger
Print string - A finger print used to retrieve specified key pair.
 - Ids []string
 - A list of key pair IDs.
 - Name
Regex string - A regex string to apply to the resulting key pairs.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Resource
Group stringId  - The Id of resource group which the key pair belongs.
 - map[string]interface{}
 - A mapping of tags to assign to the resource.
 
- finger
Print String - A finger print used to retrieve specified key pair.
 - ids List<String>
 - A list of key pair IDs.
 - name
Regex String - A regex string to apply to the resulting key pairs.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - resource
Group StringId  - The Id of resource group which the key pair belongs.
 - Map<String,Object>
 - A mapping of tags to assign to the resource.
 
- finger
Print string - A finger print used to retrieve specified key pair.
 - ids string[]
 - A list of key pair IDs.
 - name
Regex string - A regex string to apply to the resulting key pairs.
 - output
File string - File name where to save data source results (after running 
pulumi preview). - resource
Group stringId  - The Id of resource group which the key pair belongs.
 - {[key: string]: any}
 - 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, Any]
 - A mapping of tags to assign to the resource.
 
- finger
Print String - A finger print used to retrieve specified key pair.
 - ids List<String>
 - A list of key pair IDs.
 - name
Regex String - A regex string to apply to the resulting key pairs.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - resource
Group StringId  - The Id of resource group which the key pair belongs.
 - Map<Any>
 - 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>
 - Key
Pairs 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>  - Finger
Print string - Finger print of the key pair.
 - Name
Regex string - Output
File string - Resource
Group stringId  - The Id of resource group.
 - Dictionary<string, object>
 - (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
 - Key
Pairs []GetKey Pairs Key Pair  - A list of key pairs. Each element contains the following attributes:
 - Names []string
 - A list of key pair names.
 - Pairs
[]Get
Key Pairs Pair  - Finger
Print string - Finger print of the key pair.
 - Name
Regex string - Output
File string - Resource
Group stringId  - The Id of resource group.
 - map[string]interface{}
 - (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>
 - key
Pairs 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<Get
Key Pairs Pair>  - finger
Print String - Finger print of the key pair.
 - name
Regex String - output
File String - resource
Group StringId  - The Id of resource group.
 - Map<String,Object>
 - (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[]
 - key
Pairs GetKey Pairs Key Pair[]  - A list of key pairs. Each element contains the following attributes:
 - names string[]
 - A list of key pair names.
 - pairs
Get
Key Pairs Pair[]  - finger
Print string - Finger print of the key pair.
 - name
Regex string - output
File string - resource
Group stringId  - The Id of resource group.
 - {[key: string]: any}
 - (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[Get
Key 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, Any]
 - (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>
 - key
Pairs 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>
 - finger
Print String - Finger print of the key pair.
 - name
Regex String - output
File String - resource
Group StringId  - The Id of resource group.
 - Map<Any>
 - (Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.
 
Supporting Types
GetKeyPairsKeyPair    
- Finger
Print 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.
 - Key
Name string - Name of the key pair.
 - Key
Pair stringName  - Resource
Group stringId  - The Id of resource group which the key pair belongs.
 - Dictionary<string, object>
 - A mapping of tags to assign to the resource.
 
- Finger
Print string - A finger print used to retrieve specified key pair.
 - Id string
 - ID of the key pair.
 - Instances
[]Get
Key Pairs Key Pair Instance  - A list of ECS instances that has been bound this key pair.
 - Key
Name string - Name of the key pair.
 - Key
Pair stringName  - Resource
Group stringId  - The Id of resource group which the key pair belongs.
 - map[string]interface{}
 - A mapping of tags to assign to the resource.
 
- finger
Print String - A finger print used to retrieve specified key pair.
 - id String
 - ID of the key pair.
 - instances
List<Get
Key Pairs Key Pair Instance>  - A list of ECS instances that has been bound this key pair.
 - key
Name String - Name of the key pair.
 - key
Pair StringName  - resource
Group StringId  - The Id of resource group which the key pair belongs.
 - Map<String,Object>
 - A mapping of tags to assign to the resource.
 
- finger
Print string - A finger print used to retrieve specified key pair.
 - id string
 - ID of the key pair.
 - instances
Get
Key Pairs Key Pair Instance[]  - A list of ECS instances that has been bound this key pair.
 - key
Name string - Name of the key pair.
 - key
Pair stringName  - resource
Group stringId  - The Id of resource group which the key pair belongs.
 - {[key: string]: any}
 - 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[Get
Key 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, Any]
 - A mapping of tags to assign to the resource.
 
- finger
Print 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.
 - key
Name String - Name of the key pair.
 - key
Pair StringName  - resource
Group StringId  - The Id of resource group which the key pair belongs.
 - Map<Any>
 - A mapping of tags to assign to the resource.
 
GetKeyPairsKeyPairInstance     
- Availability
Zone string - The ID of the availability zone where the ECS instance is located.
 - Description string
 - Image
Id string - Instance
Id string - The ID of the ECS instance.
 - Instance
Name string - The name of the ECS instance.
 - Instance
Type string - Key
Name string - Name of the key pair.
 - Private
Ip string - The private IP address of the ECS instance.
 - Public
Ip string - The public IP address or EIP of the ECS instance.
 - Region
Id string - Status string
 - Vswitch
Id string - The ID of the VSwitch attached to the ECS instance.
 
- Availability
Zone string - The ID of the availability zone where the ECS instance is located.
 - Description string
 - Image
Id string - Instance
Id string - The ID of the ECS instance.
 - Instance
Name string - The name of the ECS instance.
 - Instance
Type string - Key
Name string - Name of the key pair.
 - Private
Ip string - The private IP address of the ECS instance.
 - Public
Ip string - The public IP address or EIP of the ECS instance.
 - Region
Id string - Status string
 - Vswitch
Id string - The ID of the VSwitch attached to the ECS instance.
 
- availability
Zone String - The ID of the availability zone where the ECS instance is located.
 - description String
 - image
Id String - instance
Id String - The ID of the ECS instance.
 - instance
Name String - The name of the ECS instance.
 - instance
Type String - key
Name String - Name of the key pair.
 - private
Ip String - The private IP address of the ECS instance.
 - public
Ip String - The public IP address or EIP of the ECS instance.
 - region
Id String - status String
 - vswitch
Id String - The ID of the VSwitch attached to the ECS instance.
 
- availability
Zone string - The ID of the availability zone where the ECS instance is located.
 - description string
 - image
Id string - instance
Id string - The ID of the ECS instance.
 - instance
Name string - The name of the ECS instance.
 - instance
Type string - key
Name string - Name of the key pair.
 - private
Ip string - The private IP address of the ECS instance.
 - public
Ip string - The public IP address or EIP of the ECS instance.
 - region
Id string - status string
 - vswitch
Id 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.
 
- availability
Zone String - The ID of the availability zone where the ECS instance is located.
 - description String
 - image
Id String - instance
Id String - The ID of the ECS instance.
 - instance
Name String - The name of the ECS instance.
 - instance
Type String - key
Name String - Name of the key pair.
 - private
Ip String - The private IP address of the ECS instance.
 - public
Ip String - The public IP address or EIP of the ECS instance.
 - region
Id String - status String
 - vswitch
Id String - The ID of the VSwitch attached to the ECS instance.
 
GetKeyPairsPair   
- Finger
Print 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.
 - Key
Name string - Name of the key pair.
 - Key
Pair stringName  - Resource
Group stringId  - The Id of resource group which the key pair belongs.
 - Dictionary<string, object>
 - A mapping of tags to assign to the resource.
 
- Finger
Print string - A finger print used to retrieve specified key pair.
 - Id string
 - ID of the key pair.
 - Instances
[]Get
Key Pairs Pair Instance  - A list of ECS instances that has been bound this key pair.
 - Key
Name string - Name of the key pair.
 - Key
Pair stringName  - Resource
Group stringId  - The Id of resource group which the key pair belongs.
 - map[string]interface{}
 - A mapping of tags to assign to the resource.
 
- finger
Print String - A finger print used to retrieve specified key pair.
 - id String
 - ID of the key pair.
 - instances
List<Get
Key Pairs Pair Instance>  - A list of ECS instances that has been bound this key pair.
 - key
Name String - Name of the key pair.
 - key
Pair StringName  - resource
Group StringId  - The Id of resource group which the key pair belongs.
 - Map<String,Object>
 - A mapping of tags to assign to the resource.
 
- finger
Print string - A finger print used to retrieve specified key pair.
 - id string
 - ID of the key pair.
 - instances
Get
Key Pairs Pair Instance[]  - A list of ECS instances that has been bound this key pair.
 - key
Name string - Name of the key pair.
 - key
Pair stringName  - resource
Group stringId  - The Id of resource group which the key pair belongs.
 - {[key: string]: any}
 - 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[Get
Key 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, Any]
 - A mapping of tags to assign to the resource.
 
- finger
Print 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.
 - key
Name String - Name of the key pair.
 - key
Pair StringName  - resource
Group StringId  - The Id of resource group which the key pair belongs.
 - Map<Any>
 - A mapping of tags to assign to the resource.
 
GetKeyPairsPairInstance    
- Availability
Zone string - The ID of the availability zone where the ECS instance is located.
 - Description string
 - Image
Id string - Instance
Id string - The ID of the ECS instance.
 - Instance
Name string - The name of the ECS instance.
 - Instance
Type string - Key
Name string - Name of the key pair.
 - Private
Ip string - The private IP address of the ECS instance.
 - Public
Ip string - The public IP address or EIP of the ECS instance.
 - Region
Id string - Status string
 - Vswitch
Id string - The ID of the VSwitch attached to the ECS instance.
 
- Availability
Zone string - The ID of the availability zone where the ECS instance is located.
 - Description string
 - Image
Id string - Instance
Id string - The ID of the ECS instance.
 - Instance
Name string - The name of the ECS instance.
 - Instance
Type string - Key
Name string - Name of the key pair.
 - Private
Ip string - The private IP address of the ECS instance.
 - Public
Ip string - The public IP address or EIP of the ECS instance.
 - Region
Id string - Status string
 - Vswitch
Id string - The ID of the VSwitch attached to the ECS instance.
 
- availability
Zone String - The ID of the availability zone where the ECS instance is located.
 - description String
 - image
Id String - instance
Id String - The ID of the ECS instance.
 - instance
Name String - The name of the ECS instance.
 - instance
Type String - key
Name String - Name of the key pair.
 - private
Ip String - The private IP address of the ECS instance.
 - public
Ip String - The public IP address or EIP of the ECS instance.
 - region
Id String - status String
 - vswitch
Id String - The ID of the VSwitch attached to the ECS instance.
 
- availability
Zone string - The ID of the availability zone where the ECS instance is located.
 - description string
 - image
Id string - instance
Id string - The ID of the ECS instance.
 - instance
Name string - The name of the ECS instance.
 - instance
Type string - key
Name string - Name of the key pair.
 - private
Ip string - The private IP address of the ECS instance.
 - public
Ip string - The public IP address or EIP of the ECS instance.
 - region
Id string - status string
 - vswitch
Id 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.
 
- availability
Zone String - The ID of the availability zone where the ECS instance is located.
 - description String
 - image
Id String - instance
Id String - The ID of the ECS instance.
 - instance
Name String - The name of the ECS instance.
 - instance
Type String - key
Name String - Name of the key pair.
 - private
Ip String - The private IP address of the ECS instance.
 - public
Ip String - The public IP address or EIP of the ECS instance.
 - region
Id String - status String
 - vswitch
Id 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.