getEcsKeyPairs

This data source provides the Ecs Key Pairs of the current Alibaba Cloud user.

NOTE: Available in v1.121.0+.

Example Usage

Basic Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(AliCloud.Ecs.GetEcsKeyPairs.InvokeAsync(new AliCloud.Ecs.GetEcsKeyPairsArgs
        {
            Ids = 
            {
                "key_pair_name",
            },
            NameRegex = "key_pair_name",
        }));
        this.FirstEcsKeyPairId = example.Apply(example => example.Pairs?[0]?.Id);
    }

    [Output("firstEcsKeyPairId")]
    public Output<string> FirstEcsKeyPairId { get; set; }
}
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 {
		example, err := ecs.GetEcsKeyPairs(ctx, &ecs.GetEcsKeyPairsArgs{
			Ids: []string{
				"key_pair_name",
			},
			NameRegex: pulumi.StringRef("key_pair_name"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstEcsKeyPairId", example.Pairs[0].Id)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetEcsKeyPairsArgs;
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 example = EcsFunctions.getEcsKeyPairs(GetEcsKeyPairsArgs.builder()
            .ids("key_pair_name")
            .nameRegex("key_pair_name")
            .build());

        ctx.export("firstEcsKeyPairId", example.applyValue(getEcsKeyPairsResult -> getEcsKeyPairsResult.pairs()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

example = alicloud.ecs.get_ecs_key_pairs(ids=["key_pair_name"],
    name_regex="key_pair_name")
pulumi.export("firstEcsKeyPairId", example.pairs[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const example = alicloud.ecs.getEcsKeyPairs({
    ids: ["key_pair_name"],
    nameRegex: "key_pair_name",
});
export const firstEcsKeyPairId = example.then(example => example.pairs?[0]?.id);
variables:
  example:
    Fn::Invoke:
      Function: alicloud:ecs:getEcsKeyPairs
      Arguments:
        ids:
          - key_pair_name
        nameRegex: key_pair_name
outputs:
  firstEcsKeyPairId: ${example.pairs[0].id}

Using getEcsKeyPairs

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 getEcsKeyPairs(args: GetEcsKeyPairsArgs, opts?: InvokeOptions): Promise<GetEcsKeyPairsResult>
function getEcsKeyPairsOutput(args: GetEcsKeyPairsOutputArgs, opts?: InvokeOptions): Output<GetEcsKeyPairsResult>
def get_ecs_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) -> GetEcsKeyPairsResult
def get_ecs_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[GetEcsKeyPairsResult]
func GetEcsKeyPairs(ctx *Context, args *GetEcsKeyPairsArgs, opts ...InvokeOption) (*GetEcsKeyPairsResult, error)
func GetEcsKeyPairsOutput(ctx *Context, args *GetEcsKeyPairsOutputArgs, opts ...InvokeOption) GetEcsKeyPairsResultOutput

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

public static class GetEcsKeyPairs 
{
    public static Task<GetEcsKeyPairsResult> InvokeAsync(GetEcsKeyPairsArgs args, InvokeOptions? opts = null)
    public static Output<GetEcsKeyPairsResult> Invoke(GetEcsKeyPairsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetEcsKeyPairsResult> getEcsKeyPairs(GetEcsKeyPairsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:ecs/getEcsKeyPairs:getEcsKeyPairs
  arguments:
    # arguments dictionary

The following arguments are supported:

FingerPrint string

The finger print of the key pair.

Ids List<string>

A list of Key Pair IDs.

NameRegex string

A regex string to filter results by Key Pair name.

OutputFile string
ResourceGroupId string

The Resource Group Id.

Tags Dictionary<string, object>

The tags.

FingerPrint string

The finger print of the key pair.

Ids []string

A list of Key Pair IDs.

NameRegex string

A regex string to filter results by Key Pair name.

OutputFile string
ResourceGroupId string

The Resource Group Id.

Tags map[string]interface{}

The tags.

fingerPrint String

The finger print of the key pair.

ids List<String>

A list of Key Pair IDs.

nameRegex String

A regex string to filter results by Key Pair name.

outputFile String
resourceGroupId String

The Resource Group Id.

tags Map<String,Object>

The tags.

fingerPrint string

The finger print of the key pair.

ids string[]

A list of Key Pair IDs.

nameRegex string

A regex string to filter results by Key Pair name.

outputFile string
resourceGroupId string

The Resource Group Id.

tags {[key: string]: any}

The tags.

finger_print str

The finger print of the key pair.

ids Sequence[str]

A list of Key Pair IDs.

name_regex str

A regex string to filter results by Key Pair name.

output_file str
resource_group_id str

The Resource Group Id.

tags Mapping[str, Any]

The tags.

fingerPrint String

The finger print of the key pair.

ids List<String>

A list of Key Pair IDs.

nameRegex String

A regex string to filter results by Key Pair name.

outputFile String
resourceGroupId String

The Resource Group Id.

tags Map<Any>

The tags.

getEcsKeyPairs Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
KeyPairs List<Pulumi.AliCloud.Ecs.Outputs.GetEcsKeyPairsKeyPair>

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

Names List<string>
Pairs List<Pulumi.AliCloud.Ecs.Outputs.GetEcsKeyPairsPair>
FingerPrint string
NameRegex string
OutputFile string
ResourceGroupId string
Tags Dictionary<string, object>
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
KeyPairs []GetEcsKeyPairsKeyPair

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

Names []string
Pairs []GetEcsKeyPairsPair
FingerPrint string
NameRegex string
OutputFile string
ResourceGroupId string
Tags map[string]interface{}
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
keyPairs List<GetEcsKeyPairsKeyPair>

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

names List<String>
pairs List<GetEcsKeyPairsPair>
fingerPrint String
nameRegex String
outputFile String
resourceGroupId String
tags Map<String,Object>
id string

The provider-assigned unique ID for this managed resource.

ids string[]
keyPairs GetEcsKeyPairsKeyPair[]

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

names string[]
pairs GetEcsKeyPairsPair[]
fingerPrint string
nameRegex string
outputFile string
resourceGroupId string
tags {[key: string]: any}
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
key_pairs Sequence[GetEcsKeyPairsKeyPair]

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

names Sequence[str]
pairs Sequence[GetEcsKeyPairsPair]
finger_print str
name_regex str
output_file str
resource_group_id str
tags Mapping[str, Any]
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
keyPairs List<Property Map>

Deprecated:

Field 'key_pairs' has been deprecated from provider version 1.121.0. New field 'pairs' instead.

names List<String>
pairs List<Property Map>
fingerPrint String
nameRegex String
outputFile String
resourceGroupId String
tags Map<Any>

Supporting Types

GetEcsKeyPairsKeyPair

FingerPrint string

The finger print of the key pair.

Id string

The ID of the Key Pair.

Instances List<Pulumi.AliCloud.Ecs.Inputs.GetEcsKeyPairsKeyPairInstance>

A list of ECS instances that has been bound this key pair.

KeyName string

The Key Pair Name.

KeyPairName string
ResourceGroupId string

The Resource Group Id.

Tags Dictionary<string, object>

The tags.

FingerPrint string

The finger print of the key pair.

Id string

The ID of the Key Pair.

Instances []GetEcsKeyPairsKeyPairInstance

A list of ECS instances that has been bound this key pair.

KeyName string

The Key Pair Name.

KeyPairName string
ResourceGroupId string

The Resource Group Id.

Tags map[string]interface{}

The tags.

fingerPrint String

The finger print of the key pair.

id String

The ID of the Key Pair.

instances List<GetEcsKeyPairsKeyPairInstance>

A list of ECS instances that has been bound this key pair.

keyName String

The Key Pair Name.

keyPairName String
resourceGroupId String

The Resource Group Id.

tags Map<String,Object>

The tags.

fingerPrint string

The finger print of the key pair.

id string

The ID of the Key Pair.

instances GetEcsKeyPairsKeyPairInstance[]

A list of ECS instances that has been bound this key pair.

keyName string

The Key Pair Name.

keyPairName string
resourceGroupId string

The Resource Group Id.

tags {[key: string]: any}

The tags.

finger_print str

The finger print of the key pair.

id str

The ID of the Key Pair.

instances Sequence[GetEcsKeyPairsKeyPairInstance]

A list of ECS instances that has been bound this key pair.

key_name str

The Key Pair Name.

key_pair_name str
resource_group_id str

The Resource Group Id.

tags Mapping[str, Any]

The tags.

fingerPrint String

The finger print of the key pair.

id String

The ID of the Key Pair.

instances List<Property Map>

A list of ECS instances that has been bound this key pair.

keyName String

The Key Pair Name.

keyPairName String
resourceGroupId String

The Resource Group Id.

tags Map<Any>

The tags.

GetEcsKeyPairsKeyPairInstance

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

The Key Pair Name.

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

The Key Pair Name.

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

The Key Pair Name.

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

The Key Pair Name.

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

The Key Pair Name.

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

The Key Pair Name.

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.

GetEcsKeyPairsPair

FingerPrint string

The finger print of the key pair.

Id string

The ID of the Key Pair.

Instances List<Pulumi.AliCloud.Ecs.Inputs.GetEcsKeyPairsPairInstance>

A list of ECS instances that has been bound this key pair.

KeyName string

The Key Pair Name.

KeyPairName string
ResourceGroupId string

The Resource Group Id.

Tags Dictionary<string, object>

The tags.

FingerPrint string

The finger print of the key pair.

Id string

The ID of the Key Pair.

Instances []GetEcsKeyPairsPairInstance

A list of ECS instances that has been bound this key pair.

KeyName string

The Key Pair Name.

KeyPairName string
ResourceGroupId string

The Resource Group Id.

Tags map[string]interface{}

The tags.

fingerPrint String

The finger print of the key pair.

id String

The ID of the Key Pair.

instances List<GetEcsKeyPairsPairInstance>

A list of ECS instances that has been bound this key pair.

keyName String

The Key Pair Name.

keyPairName String
resourceGroupId String

The Resource Group Id.

tags Map<String,Object>

The tags.

fingerPrint string

The finger print of the key pair.

id string

The ID of the Key Pair.

instances GetEcsKeyPairsPairInstance[]

A list of ECS instances that has been bound this key pair.

keyName string

The Key Pair Name.

keyPairName string
resourceGroupId string

The Resource Group Id.

tags {[key: string]: any}

The tags.

finger_print str

The finger print of the key pair.

id str

The ID of the Key Pair.

instances Sequence[GetEcsKeyPairsPairInstance]

A list of ECS instances that has been bound this key pair.

key_name str

The Key Pair Name.

key_pair_name str
resource_group_id str

The Resource Group Id.

tags Mapping[str, Any]

The tags.

fingerPrint String

The finger print of the key pair.

id String

The ID of the Key Pair.

instances List<Property Map>

A list of ECS instances that has been bound this key pair.

keyName String

The Key Pair Name.

keyPairName String
resourceGroupId String

The Resource Group Id.

tags Map<Any>

The tags.

GetEcsKeyPairsPairInstance

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

The Key Pair Name.

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

The Key Pair Name.

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

The Key Pair Name.

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

The Key Pair Name.

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

The Key Pair Name.

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

The Key Pair Name.

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
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.