All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::RamRoleAttachment

Last Updated:Jun 19, 2026

Menetapkan RAM role instance ke satu atau beberapa instance ECS.

Sintaksis

{
  "Type": "ALIYUN::ECS::RamRoleAttachment",
  "Properties": {
    "Policy": String,
    "RamRoleName": String,
    "InstanceIds": List
  }
}

Properti

Property name

Type

Required

Updatable

Description

Constraints

Policy

String

No

No

Kebijakan akses.

Harus terdiri dari 1 hingga 1.024 karakter. Menentukan kebijakan akses tambahan untuk lebih membatasi izin dari RAM role. Untuk informasi selengkapnya, lihat Access policy overview.

RamRoleName

String

Yes

No

Nama instance RAM role.

Gunakan RAM API ListRoles untuk mengkueri instance RAM role yang telah Anda buat.

InstanceIds

List

Yes

No

Daftar ID instans.

Array JSON berisi ID instans. Anda dapat menentukan hingga 100 instans.

Nilai kembalian

Fn::GetAtt

  • RamRoleName: Nama RAM role instance.

  • InstanceIds: Daftar ID instans.

Contoh

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  Policy:
    Type: String
    Description: |-
      Kebijakan akses. Saat Anda memberikan instance RAM role kepada instance ECS, Anda dapat menentukan kebijakan tambahan ini untuk lebih membatasi izin dari RAM role.
      Kebijakan harus terdiri dari 1 hingga 1.024 karakter.
    MinLength: 1
    MaxLength: 1024
    Default:
      Statement:
        - Action:
            - '*'
          Effect: Allow
          Resource:
            - '*'
      Version: '1'
  RamRoleName:
    Type: String
    Description: Nama instance RAM role.
    Default: testRamRoleName
  InstanceIds:
    Type: Json
    Description: ID instance ECS yang ingin Anda beri instance RAM role.
    MinLength: 1
    MaxLength: 100
    Default:
      - i-***
      - i-***
Resources:
  RamRoleAttachment:
    Type: ALIYUN::ECS::RamRoleAttachment
    Properties:
      Policy:
        Ref: Policy
      RamRoleName:
        Ref: RamRoleName
      InstanceIds:
        Ref: InstanceIds
Outputs:
  RamRoleName:
    Description: Nama instance RAM role.
    Value:
      Fn::GetAtt:
        - RamRoleAttachment
        - RamRoleName
  InstanceIds:
    Description: Daftar ID instance ECS.
    Value:
      Fn::GetAtt:
        - RamRoleAttachment
        - InstanceIds

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "Policy": {
      "Type": "String",
      "Description": "Kebijakan akses. Saat Anda memberikan instance RAM role kepada instance ECS, Anda dapat menentukan kebijakan tambahan ini untuk lebih membatasi izin dari RAM role.\nKebijakan harus terdiri dari 1 hingga 1.024 karakter.",
      "MinLength": 1,
      "MaxLength": 1024,
      "Default": {"Statement": [{"Action": ["*"],"Effect": "Allow","Resource": ["*"]}],"Version":"1"}
    },
    "RamRoleName": {
      "Type": "String",
      "Description": "Nama instance RAM role.",
      "Default": "testRamRoleName"
    },
    "InstanceIds": {
      "Type": "Json",
      "Description": "ID instance ECS yang ingin Anda beri instance RAM role.",
      "MinLength": 1,
      "MaxLength": 100,
      "Default": ["i-***", "i-***"]
    }
  },
  "Resources": {
    "RamRoleAttachment": {
      "Type": "ALIYUN::ECS::RamRoleAttachment",
      "Properties": {
        "Policy": {
          "Ref": "Policy"
        },
        "RamRoleName": {
          "Ref": "RamRoleName"
        },
        "InstanceIds": {
          "Ref": "InstanceIds"
        }
      }
    }
  },
  "Outputs": {
    "RamRoleName": {
      "Description": "Nama instance RAM role.",
      "Value": {
        "Fn::GetAtt": [
          "RamRoleAttachment",
          "RamRoleName"
        ]
      }
    },
    "InstanceIds": {
      "Description": "Daftar ID instance ECS.",
      "Value": {
        "Fn::GetAtt": [
          "RamRoleAttachment",
          "InstanceIds"
        ]
      }
    }
  }
}