Tous les produits
Search
Centre de documentation

Resource Orchestration Service:ALIYUN::RAM::AttachPolicyToRole

Dernière mise à jour :Aug 10, 2026

Attache une politique à un rôle RAM.

Syntaxe

{
  "Type": "ALIYUN::RAM::AttachPolicyToRole",
  "Properties": {
    "PolicyName": String,
    "PolicyType": String,
    "RoleName": String
  }
}

Propriétés

Nom de la propriété Type Obligatoire Mise à jour autorisée Description Contraintes
PolicyName String Oui Non Nom de la politique. Aucune.
PolicyType String Oui Non Type de politique. Valeurs valides :
  • System
  • Custom
RoleName String Oui Non Nom du rôle. Exemple : dev. Aucune.

Valeurs de retour

Fn::GetAtt

Aucune.

Exemples

  • Format YAML

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      Role:
        Type: String
        AssociationProperty: ALIYUN::RAM::Role
    Resources:
      AttachPolicyToRole:
        Type: ALIYUN::RAM::AttachPolicyToRole
        Properties:
          PolicyName: OSS-Administrator
          PolicyType: Custom
          RoleName:
            Ref: Role
    
  • Format JSON

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "Role": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::RAM::Role"
        }
      },
      "Resources": {
        "AttachPolicyToRole": {
          "Type": "ALIYUN::RAM::AttachPolicyToRole",
          "Properties": {
            "PolicyName": "OSS-Administrator",
            "PolicyType": "Custom",
            "RoleName": {
              "Ref": "Role"
            }
          }
        }
      }
    }