Todos los productos
Search
Centro de documentos

Resource Orchestration Service:ALIYUN::ENS::KeyPair

Última actualización: Sep 04, 2026

ALIYUN::ENS::KeyPair sirve para importar la clave pública de un key pair cifrado con Rivest-Shamir-Adleman (RSA).

Sintaxis

{
  "Type": "ALIYUN::ENS::KeyPair",
  "Properties": {
    "KeyPairName": String,
    "PublicKeyBody": String
  }
}

Propiedades

Propiedad

Tipo

Obligatorio

Editable

Descripción

Restricción

KeyPairName

String

Sí

No

Nombre del key pair.

El nombre debe cumplir las siguientes reglas:

  • Debe tener una longitud de 2 a 128 caracteres.

  • Debe comenzar con una letra y no puede empezar con http:// ni con https://.

  • Puede contener letras, dígitos, dos puntos (:), guiones bajos (_) y guiones (-).

Solo se permite especificar un key pair.

PublicKeyBody

String

No

No

Clave pública del key pair.

Solo se permite especificar una clave pública.

Valores de retorno

Fn::GetAtt

  • KeyPairFingerPrint: huella digital del key pair. Se usa el algoritmo de resumen de mensaje 5 (MD5) según el formato de huella digital de clave pública definido en Request for Comments (RFC) 4716.

  • KeyPairName: nombre del key pair.

  • PrivateKeyBody: clave pública del key pair.

Ejemplos

Formato YAML

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  KeyPairName:
    Type: String
    Description:
      en: |-
        The name of the key pair. The name must conform to the following naming conventions:
        The name must be 2 to 128 characters in length, and can contain letters, digits, colons (:), underscores (_), and hyphens (-).
        It must start with a letter but cannot start with http:// or https://.
    Required: true
  PublicKeyBody:
    Type: String
    Description:
      en: SSH Public key. If PublicKeyBody is specified, existed public key body will be imported instead of creating new SSH key pair.
    Required: false
Resources:
  KeyPair:
    Type: ALIYUN::ENS::KeyPair
    Properties:
      KeyPairName:
        Ref: KeyPairName
      PublicKeyBody:
        Ref: PublicKeyBody
Outputs:
  KeyPairFingerPrint:
    Description: 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.
    Value:
      Fn::GetAtt:
        - KeyPair
        - KeyPairFingerPrint
  KeyPairName:
    Description: SSH Key pair name.
    Value:
      Fn::GetAtt:
        - KeyPair
        - KeyPairName
  PrivateKeyBody:
    Description: The private key of the key pair. The private key is encoded with PEM in the PKCS#8 format.
    Value:
      Fn::GetAtt:
        - KeyPair
        - PrivateKeyBody

Formato JSON

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "KeyPairName": {
      "Type": "String",
      "Description": {
        "en": "The name of the key pair. The name must conform to the following naming conventions:\nThe name must be 2 to 128 characters in length, and can contain letters, digits, colons (:), underscores (_), and hyphens (-).\nIt must start with a letter but cannot start with http:// or https://."
      },
      "Required": true
    },
    "PublicKeyBody": {
      "Type": "String",
      "Description": {
        "en": "SSH Public key. If PublicKeyBody is specified, existed public key body will be imported instead of creating new SSH key pair."
      },
      "Required": false
    }
  },
  "Resources": {
    "KeyPair": {
      "Type": "ALIYUN::ENS::KeyPair",
      "Properties": {
        "KeyPairName": {
          "Ref": "KeyPairName"
        },
        "PublicKeyBody": {
          "Ref": "PublicKeyBody"
        }
      }
    }
  },
  "Outputs": {
    "KeyPairFingerPrint": {
      "Description": "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.",
      "Value": {
        "Fn::GetAtt": [
          "KeyPair",
          "KeyPairFingerPrint"
        ]
      }
    },
    "KeyPairName": {
      "Description": "SSH Key pair name.",
      "Value": {
        "Fn::GetAtt": [
          "KeyPair",
          "KeyPairName"
        ]
      }
    },
    "PrivateKeyBody": {
      "Description": "The private key of the key pair. The private key is encoded with PEM in the PKCS#8 format.",
      "Value": {
        "Fn::GetAtt": [
          "KeyPair",
          "PrivateKeyBody"
        ]
      }
    }
  }
}