DATASOURCE::ECS::KeyPairs is used to query one or more key pairs.

Syntax

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

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 RFC4716.
KeyPairName String No Yes The name of the key pair. You can use the asterisk (*) symbol as a wildcard in regular expressions to perform a fuzzy search 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 include SshKey, 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 specify up to 20 tags.

For more information, see Tags properties.

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://. The tag value 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://. The tag key 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 names of the key pairs. Sample name: testKeyPairName.
KeyPairFingerPrint String The fingerprint of the key pair. Sample fingerprint: ABC1234567.
ResourceGroupId String The ID of the resource group. Sample ID: rg-amnhr7u7c7hj****.
Tags List The tags of the key pair. None.

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "KeyPairName": {
      "Type": "String",
      "Description": "he 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"
        ]
      }
    }
  }
}