All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::SSHKeyPairAttachment

最終更新日:Nov 03, 2023

ALIYUN::ECS::SSHKeyPairAttachment is used to attach an SSH key pair to Elastic Compute Service (ECS) instances.

Syntax

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

Properties

Property

Type

Required

Editable

Description

Constraint

InstanceIds

List

Yes

Yes

The IDs of the ECS instances to which you want to attach an SSH key pair.

Separate IDs with commas (,). Only Linux-based instances are supported.

KeyPairName

String

Yes

No

The name of the SSH key pair.

None.

AutoReboot

Boolean

No

No

Specifies whether to enable the ECS instance that is in the Running state to make the SSH key pair take effect.

Valid values:

  • true

  • false (default)

Return values

Fn::GetAtt

None.

Examples

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