All Products
Search
Document Center

Resource Orchestration Service:DATASOURCE::ECS::KeyPairs

Last Updated:Nov 26, 2024

DATASOURCE::ECS::KeyPairs is used to query key pairs.

Syntax

{
  "Type": "DATASOURCE::ECS::KeyPairs",
  "Properties": {
    "KeyPairFingerPrint": String,
    "KeyPairName": String,
    "ResourceGroupId": String,
    "Tags": List,
    "RefreshOptions": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

KeyPairFingerPrint

String

No

Yes

The fingerprint of the key pair.

The message-digest algorithm 5 (MD5) is used based on the public key fingerprint format defined in RFC 4716. For more information, see RFC 4716.

KeyPairName

String

No

Yes

The name of the key pair.

You can use the wildcard character (*) in regular expressions to perform fuzzy searches for key pairs. Examples:

  • *SshKey: queries key pairs whose names end with SshKey, including the key pair named SshKey.

  • SshKey*: queries key pairs whose names start with SshKey, including the key pair named SshKey.

  • *SshKey*: queries key pairs whose names contain SshKey in the middle position, including the key pair named SshKey.

  • SshKey: queries the key pair named SshKey.

ResourceGroupId

String

No

Yes

The ID of the resource group to which the key pair belongs.

None.

Tags

List

No

Yes

The tags of the key pair.

You can add up to 20 tags.

For more information, see Tags properties.

RefreshOptions

String

No

Yes

The refresh policy for data source resources when the stack is updated.

Valid values:

  • Never (default): does not refresh data source resources when the stack is updated.

  • Always: refreshes data source resources when the stack is updated.

Tags syntax

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags properties

Property

Type

Required

Editable

Description

Constraint

Value

String

No

No

The tag value of the key pair.

The tag value can be up to 128 characters in length and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Key

String

Yes

No

The tag key of the key pair.

The tag key must be 1 to 128 characters in length and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Return values (Fn::GetAtt)

  • KeyPairNames: the names of the key pairs.

  • KeyPairs: details of the key pairs.

Property

Type

Description

Constraint

KeyPairNames

List

The names of the key pairs.

None.

KeyPairs

List

Details of the key pairs.

None.

KeyPairName

String

The name of the key pair.

Example: testKeyPairName.

KeyPairFingerPrint

String

The fingerprint of the key pair.

Example: ABC1234567.

ResourceGroupId

String

The ID of the resource group.

Example: rg-amnhr7u7c7hj****.

Tags

List

The tags of the key pair.

None.

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "KeyPairName": {
      "Type": "String",
      "Description": "The name of the key pair. You can use the asterisk (*) symbol as a wildcard in regular expressions to query key pairs by performing a fuzzy search. Sample patterns:\n*SshKey: queries key pairs whose names end with SshKey, including the key pair named SshKey.\nSshKey*: queries key pairs whose names start with SshKey, including the key pair named SshKey.\n*SshKey*: queries key pairs whose names include SshKey, including the key pair named SshKey.\nSshKey: queries the key pair named SshKey."
    }
  },
  "Resources": {
    "KeyPairs": {
      "Type": "DATASOURCE::ECS::KeyPairs",
      "Properties": {
        "KeyPairName": {
          "Ref": "KeyPairName"
        }
      }
    }
  },
  "Outputs": {
    "KeyPairs": {
      "Value": {
        "Fn::GetAtt": [
          "KeyPairs",
          "KeyPairs"
        ]
      }
    },
    "KeyPairNames": {
      "Value": {
        "Fn::GetAtt": [
          "KeyPairs",
          "KeyPairNames"
        ]
      }
    }
  }
}