すべてのプロダクト
Search
ドキュメントセンター

Resource Orchestration Service:ALIYUN::ENS::KeyPair

最終更新日:Mar 17, 2025

ALIYUN::ENS::KeyPair は、RSA(Rivest-Shamir-Adleman)暗号化キーペアの公開鍵をインポートするために使用されます。

構文

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

プロパティ

プロパティ

タイプ

必須

編集可能

説明

制約

KeyPairName

String

はい

いいえ

キーペアの名前。

名前は次のルールに準拠する必要があります。

  • 名前は 2 ~ 128 文字である必要があります。

  • http:// または https:// で始めることはできません。

  • 文字、数字、コロン(:)、アンダースコア(_)、ハイフン(-)を含めることができます。

指定できるキーペアは 1 つだけです。

PublicKeyBody

String

いいえ

いいえ

キーペアの公開鍵。

指定できる公開鍵は 1 つだけです。

戻り値

Fn::GetAtt

  • KeyPairFingerPrint: キーペアのフィンガープリント。RFC 4716 で定義されている公開鍵フィンガープリント形式に基づいて、メッセージダイジェストアルゴリズム 5(MD5)が使用されます。

  • KeyPairName: キーペアの名前。

  • PrivateKeyBody: キーペアの公開鍵。

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

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": "キーペアのフィンガープリント。メッセージダイジェスト アルゴリズム 5(MD5)は、RFC 4716 で定義されている公開鍵フィンガープリント形式に基づいて使用されます。詳細については、「RFC 4716」をご参照ください。",
      "Value": {
        "Fn::GetAtt": [
          "KeyPair",
          "KeyPairFingerPrint"
        ]
      }
    },
    "KeyPairName": {
      "Description": "SSH キーペア名。",
      "Value": {
        "Fn::GetAtt": [
          "KeyPair",
          "KeyPairName"
        ]
      }
    },
    "PrivateKeyBody": {
      "Description": "キーペアの秘密鍵。秘密鍵は、PKCS#8 形式で PEM でエンコードされます。",
      "Value": {
        "Fn::GetAtt": [
          "KeyPair",
          "PrivateKeyBody"
        ]
      }
    }
  }
}