全部产品
Search
文档中心

Resource Orchestration Service:ALIYUN::ECS::SSHKeyPairAttachment

更新时间:Jun 26, 2025

ALIYUN::ECS::SSHKeyPairAttachment digunakan untuk mengaitkan pasangan kunci SSH dengan instance Elastic Compute Service (ECS).

Sintaksis

{
  "Type": "ALIYUN::ECS::SSHKeyPairAttachment",
  "Properties": {
    "InstanceIds": List,
    "KeyPairName": String,
    "AutoReboot": Boolean
  }
}

Properti

Properti

Tipe

Diperlukan

Dapat Diedit

Deskripsi

Kendala

InstanceIds

Daftar

Ya

Ya

ID instance ECS yang ingin Anda ikat dengan pasangan kunci SSH.

Pisahkan ID dengan koma (,). Hanya instance berbasis Linux yang didukung.

KeyPairName

String

Ya

Tidak

Nama pasangan kunci SSH.

Tidak ada.

AutoReboot

Boolean

Tidak

Tidak

Menentukan apakah akan mengaktifkan instance ECS yang dalam keadaan Running agar pasangan kunci SSH dapat berfungsi.

Nilai valid:

  • true

  • false (default)

Nilai Pengembalian

Fn::GetAtt

Tidak ada.

Contoh

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  RegionId:
    Type: String
    AssociationProperty: ALIYUN::ECS::RegionId
  InstanceId:
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::InstanceId
    AssociationPropertyMetadata:
      RegionId: ${RegionId}
Resources:
  SSHKeyPairAttachment:
    Type: ALIYUN::ECS::SSHKeyPairAttachment
    Properties:
      KeyPairName: ssh_key_pai****
      InstanceIds:
        - Ref: InstanceId

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "RegionId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::RegionId"
    },
    "InstanceId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceId",
      "AssociationPropertyMetadata": {
        "RegionId": "${RegionId}"
      }
    }
  },
  "Resources": {
    "SSHKeyPairAttachment": {
      "Type": "ALIYUN::ECS::SSHKeyPairAttachment",
      "Properties": {
        "KeyPairName": "ssh_key_pai****",
        "InstanceIds": [
          {
            "Ref": "InstanceId"
          }
        ]
      }
    }
  }
}