Tous les produits
Search
Centre de documentation

Resource Orchestration Service:ALIYUN::ECS::SSHKeyPair

Dernière mise à jour :Aug 10, 2026

La ressource ALIYUN::ECS::SSHKeyPair crée une paire de clés SSH ou importe une paire existante.

Syntaxe

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

Propriétés

Propriété

Type

Obligatoire

Modifiable

Description

Contrainte

ResourceGroupId

String

Non

Oui

ID du groupe de ressources.

Aucune.

KeyPairName

String

Oui

Non

Nom de la paire de clés.

De 2 à 128 caractères. Peut contenir des lettres, des chiffres, des deux-points (:), des traits de soulignement (_) et des traits d'union (-). Doit commencer par une lettre. Ne peut pas commencer par http:// ni par https://.

PublicKeyBody

String

Non

Non

Clé publique.

Requis uniquement lors de l'importation d'une paire de clés existante.

Tags

List

Non

Oui

Les tags.

Maximum : 20.

Pour plus d'informations, consultez les propriétés Tags.

Syntaxe des tags

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

Propriétés des tags

Propriété

Type

Obligatoire

Modifiable

Description

Contrainte

Key

String

Oui

Non

Clé du tag.

De 1 à 128 caractères. Ne peut pas commencer par aliyun ni par acs:. Ne peut pas contenir http:// ni https://.

Value

String

Non

Non

Valeur du tag.

Jusqu'à 128 caractères. Ne peut pas commencer par aliyun ni par acs:. Ne peut pas contenir http:// ni https://.

Valeurs de retour

Fn::GetAtt

  • KeyPairFingerPrint : empreinte de la paire de clés. Le hachage MD5 est calculé selon le format d'empreinte de clé publique défini dans la RFC 4716.

  • PrivateKeyBody : clé privée RSA non chiffrée au format PKCS#8 encodé en PEM. Cette valeur n'est renvoyée que lors de la création d'une nouvelle paire de clés. Elle n'est pas disponible pour les clés importées.

  • KeyPairName : nom de la paire de clés.

  • Arn : nom de ressource Alibaba Cloud (ARN).

Exemples

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"
        ]
      }
    }
  }
}

Des exemples YAML supplémentaires sont disponibles sur GitHub.