Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::ECS::SSHKeyPair

Última atualização: Jul 02, 2026

O recurso ALIYUN::ECS::SSHKeyPair cria um par de chaves SSH ou importa um par existente.

Sintaxe

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

Propriedades

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

ResourceGroupId

String

Não

Sim

ID do grupo de recursos.

Nenhuma.

KeyPairName

String

Sim

Não

Nome do par de chaves.

De 2 a 128 caracteres. Aceita letras, dígitos, dois pontos (:), sublinhados (_) e hifens (-). Deve começar com uma letra. Não pode iniciar com http:// ou https://.

PublicKeyBody

String

Não

Não

Chave pública.

Necessária apenas ao importar um par de chaves existente.

Tags

List

Não

Sim

As tags.

Máximo: 20.

Para mais informações, consulte Propriedades de Tags.

Sintaxe de Tags

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

Propriedades de Tags

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

Key

String

Sim

Não

Chave da tag.

De 1 a 128 caracteres. Não pode começar com aliyun ou acs:. Não pode conter http:// ou https://.

Value

String

Não

Não

Valor da tag.

Até 128 caracteres. Não pode começar com aliyun ou acs:. Não pode conter http:// ou https://.

Valores de retorno

Fn::GetAtt

  • KeyPairFingerPrint: impressão digital do par de chaves. O hash MD5 é calculado com base no formato de impressão digital de chave pública definido na RFC 4716.

  • PrivateKeyBody: chave privada RSA não criptografada no formato PKCS#8 codificado em PEM. Retornada apenas durante a criação de um novo par de chaves. Indisponível para chaves importadas.

  • KeyPairName: nome do par de chaves.

  • Arn: Alibaba Cloud Resource Name (ARN).

Exemplos

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

Mais exemplos em YAML estão disponíveis no GitHub.