Todos los productos
Search
Centro de documentos

Resource Orchestration Service:ALIYUN::ECS::SSHKeyPair

Última actualización: Sep 04, 2026

ALIYUN::ECS::SSHKeyPair crea una key pair de SSH o importa una existente.

Sintaxis

{
  "Type": "ALIYUN::ECS::SSHKeyPair",
  "Properties": {
    "ResourceGroupId": String,
    "KeyPairName": String,
    "PublicKeyBody": String,
    "Tags": List
  }
}

Propiedades

Propiedad

Tipo

Obligatorio

Editable

Descripción

Restricción

ResourceGroupId

String

No

Sí

ID del resource group.

Ninguna.

KeyPairName

String

Sí

No

Nombre de la key pair.

De 2 a 128 caracteres. Puede contener letras, dígitos, dos puntos (:), guiones bajos (_) y guiones (-). Debe comenzar con una letra. No puede comenzar con http:// ni con https://.

PublicKeyBody

String

No

No

Clave pública.

Obligatorio solo al importar una key pair existente.

Tags

List

No

Sí

Etiquetas.

Máximo: 20.

Para obtener más información, consulte Tags properties.

Sintaxis de etiquetas

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

Propiedades de etiquetas

Propiedad

Tipo

Obligatorio

Editable

Descripción

Restricción

Key

String

Sí

No

Clave de la etiqueta.

De 1 a 128 caracteres. No puede comenzar con aliyun ni con acs:. No puede contener http:// ni https://.

Value

String

No

No

Valor de la etiqueta.

Hasta 128 caracteres. No puede comenzar con aliyun ni con acs:. No puede contener http:// ni https://.

Valores de retorno

Fn::GetAtt

  • KeyPairFingerPrint: huella digital de la key pair. El hash MD5 se calcula según el formato de huella digital de clave pública definido en RFC 4716.

  • PrivateKeyBody: clave privada RSA sin cifrar en formato PKCS#8 codificado en PEM. Se devuelve únicamente al crear una nueva key pair. No está disponible para claves importadas.

  • KeyPairName: nombre de la key pair.

  • Arn: Alibaba Cloud Resource Name (ARN).

Ejemplos

ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
  SSHKeyPair:
    Type: ALIYUN::ECS::SSHKeyPair
    Properties:
      KeyPairName:
        Fn::Sub: ess-${ALIYUN::StackId}
Outputs:
  KeyPairFingerPrint:
    Description: 'The fingerprint of the key pair. The public key fingerprint format defined in RFC4716: MD5 message digest algorithm. '
    Value:
      Fn::GetAtt:
        - SSHKeyPair
        - KeyPairFingerPrint
  KeyPairName:
    Description: SSH Key pair name.
    Value:
      Fn::GetAtt:
        - SSHKeyPair
        - KeyPairName
  PrivateKeyBody:
    Description: 'The private key of the key pair. Content of the RSA private key in the PKCS#8 format of the unencrypted PEM encoding. Refer to: https://www.openssl.org/docs/apps/pkcs8.html.User only can get the private key one time when and only when SSH key pair is created.'
    Value:
      Fn::GetAtt:
        - SSHKeyPair
        - PrivateKeyBody
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
  },
  "Resources": {
    "SSHKeyPair": {
      "Type": "ALIYUN::ECS::SSHKeyPair",
      "Properties": {
        "KeyPairName": {
          "Fn::Sub": "ess-${ALIYUN::StackId}"
        }
      }
    }
  },
  "Outputs": {
    "KeyPairFingerPrint": {
      "Description": "The fingerprint of the key pair. The public key fingerprint format defined in RFC4716: MD5 message digest algorithm. ",
      "Value": {
        "Fn::GetAtt": [
          "SSHKeyPair",
          "KeyPairFingerPrint"
        ]
      }
    },
    "KeyPairName": {
      "Description": "SSH Key pair name.",
      "Value": {
        "Fn::GetAtt": [
          "SSHKeyPair",
          "KeyPairName"
        ]
      }
    },
    "PrivateKeyBody": {
      "Description": "The private key of the key pair. Content of the RSA private key in the PKCS#8 format of the unencrypted PEM encoding. Refer to: https://www.openssl.org/docs/apps/pkcs8.html.User only can get the private key one time when and only when SSH key pair is created.",
      "Value": {
        "Fn::GetAtt": [
          "SSHKeyPair",
          "PrivateKeyBody"
        ]
      }
    }
  }
}

Hay ejemplos adicionales en YAML available en GitHub.