Tous les produits
Search
Centre de documentation

Resource Orchestration Service:ALIYUN::RAM::User

Dernière mise à jour :Aug 10, 2026

La ressource ALIYUN::RAM::User permet de créer un utilisateur RAM.

Syntaxe

{
  "Type": "ALIYUN::RAM::User",
  "Properties": {
    "UserName": String,
    "DisplayName": String,
    "LoginProfile": Map,
    "Groups": List,
    "MobilePhone": String,
    "Email": String,
    "Comments": String,
    "Policies": List,
    "PolicyAttachments": Map,
    "DeletionForce": Boolean
  }
}

Propriétés

Propriété

Type

Obligatoire

Modifiable

Description

Contraintes

UserName

String

Oui

Non

Le nom de l'utilisateur RAM.

La longueur doit être comprise entre 1 et 64 caractères. Le nom peut contenir des lettres, des chiffres, des points (.), des tirets (-) et des traits de soulignement (_).

Comments

String

Non

Oui

Les remarques.

La longueur doit être comprise entre 1 et 128 caractères.

DeletionForce

Boolean

Non

Oui

Indique s'il faut détacher de force les stratégies d'accès de l'utilisateur RAM.

Valeurs valides :

  • true : Détache de force les stratégies.

  • false (par défaut) : Ne détache pas de force les stratégies.

DisplayName

String

Non

Oui

Le nom affiché de l'utilisateur RAM.

La longueur doit être comprise entre 1 et 128 caractères.

Email

String

Non

Oui

L'adresse e-mail de l'utilisateur RAM.

Aucune

Groups

List

Non

Non

Les groupes d'utilisateurs auxquels l'utilisateur RAM appartient.

Aucune

LoginProfile

Map

Non

Non

Le profil de connexion de l'utilisateur RAM.

Pour plus d'informations, consultez la section Propriétés LoginProfile.

MobilePhone

String

Non

Oui

Le numéro de téléphone portable de l'utilisateur RAM.

Aucune

Policies

List

Non

Oui

Les stratégies d'accès appliquées à l'utilisateur RAM.

Pour plus d'informations, consultez la section Propriétés Policies.

PolicyAttachments

Map

Non

Oui

Les noms des stratégies système et personnalisées à ajouter.

Pour plus d'informations, consultez la section Propriétés PolicyAttachments.

Syntaxe LoginProfile

"LoginProfile": {
  "MFABindRequired": Boolean,
  "Password": String,
  "PasswordResetRequired": Boolean
}            

Propriétés LoginProfile

Propriété

Type

Obligatoire

Modifiable

Description

Contraintes

MFABindRequired

Boolean

Non

Non

Indique si l'authentification multifacteur (MFA) est requise pour l'utilisateur RAM.

Valeurs valides :

  • true : L'authentification MFA est requise. L'utilisateur RAM doit associer un dispositif MFA lors de sa prochaine connexion.

  • false : Aucune activation n'est requise.

Password

String

Non

Non

Le nouveau mot de passe de connexion à la console pour l'utilisateur RAM.

Le mot de passe doit respecter les exigences de complexité. La longueur doit être comprise entre 8 et 32 caractères.

PasswordResetRequired

Boolean

Non

Non

Indique si l'utilisateur RAM doit réinitialiser son mot de passe lors de sa prochaine connexion.

Valeurs valides :

  • true : La réinitialisation du mot de passe est obligatoire.

  • false : La réinitialisation du mot de passe n'est pas nécessaire.

Syntaxe Policies

"Policies": [
  {
    "PolicyName": String,
    "PolicyDocument": Map,
    "Description": String,
    "IgnoreExisting": Boolean
  }
]            

Propriétés Policies

Propriété

Type

Obligatoire

Modifiable

Description

Contraintes

PolicyDocument

Map

Oui

Oui

Le document de stratégie.

La longueur ne doit pas dépasser 2 048 caractères.

Pour plus d'informations, consultez la section Propriétés PolicyDocument.

PolicyName

String

Oui

Non

Le nom de la stratégie d'accès.

La longueur doit être comprise entre 1 et 128 caractères. Le nom peut contenir des lettres, des chiffres et des tirets (-).

Description

String

Non

Non

La description.

La longueur doit être comprise entre 1 et 1 024 caractères.

IgnoreExisting

Boolean

Non

Non

Indique s'il faut ignorer les stratégies existantes.

Valeurs valides :

  • true : ROS ne vérifie pas l'unicité. Si une stratégie portant le même nom existe déjà, ROS ignore la création de la stratégie. Si ROS n'a pas créé la stratégie, celle-ci est ignorée lors des phases de mise à jour et de suppression.

  • false : ROS effectue une vérification d'unicité. Si une stratégie portant le même nom existe déjà, ROS signale une erreur lors de la création de la stratégie.

Syntaxe PolicyDocument

"PolicyDocument": {
  "Version": String,
  "Statement": List
}

Propriétés PolicyDocument

Propriété

Type

Obligatoire

Modifiable

Description

Contraintes

Statement

List

Oui

Non

Les règles spécifiques de la stratégie d'accès.

Pour plus d'informations, consultez Propriétés Statement.

Version

String

Oui

Non

La version de la stratégie d'accès.

Aucune

Syntaxe Statement

"Statement": [
  {
    "Condition": Map,
    "Action": List,
    "Resource": List,
    "Effect": String,
    "NotAction": List
  }
]

Propriétés de l'instruction

Property

Type

Required

Editable

Description

Constraints

Action

List

No

No

Les opérations spécifiques associées à la politique d'accès.

Aucune

Condition

Map

No

No

Les conditions qui restreignent l'autorisation.

Aucune

Effect

String

No

No

L'effet de l'autorisation.

Valeurs valides :

  • Allow : Autorise.

  • Deny : Refuse.

NotAction

List

No

No

Les opérations exclues lors de l'autorisation ou du refus d'accès.

Aucune

Resource

List

No

No

Les ressources spécifiques associées à la politique d'accès.

Aucune

Syntaxe PolicyAttachments

"PolicyAttachments": {
  "Custom": List,
  "System": List
}

Propriétés PolicyAttachments

Propriété

Type

Obligatoire

Modifiable

Description

Contraintes

Custom

List

Non

Oui

La liste des noms de politiques personnalisées.

Le nombre de politiques doit être inférieur ou égal à 5.

System

List

Non

Oui

La liste des noms de politiques système.

Le nombre de politiques doit être inférieur ou égal à 20.

Valeurs de retour

Fn::GetAtt

  • UserName : le nom de l'utilisateur RAM.

  • UserId : l'ID de l'utilisateur RAM.

  • CreateDate : la date de création de l'utilisateur RAM.

  • LastLoginDate : la date de dernière connexion de l'utilisateur RAM.

Exemples

Scénario 1 : Créer un utilisateur RAM.

Création rapide

ROSTemplateFormatVersion: '2015-09-01'
Description: Test RAM User
Parameters: {}
Resources:
  User:
    Type: ALIYUN::RAM::User
    Properties:
      UserName: dev
      Policies:
        - PolicyName:
            Fn::Join:
              - '-'
              - - StackId
                - Ref: ALIYUN::StackId
          PolicyDocument:
            Statement:
              - Action:
                  - oss:*
                Effect: Allow
                Resource:
                  - '*'
            Version: '1'
Outputs: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test RAM User",
  "Parameters": {
  },
  "Resources": {
    "User": {
      "Type": "ALIYUN::RAM::User",
      "Properties": {
        "UserName": "dev",
        "Policies": [
          {
            "PolicyName": {
              "Fn::Join": [
                "-",
                [
                  "StackId",
                  {
                    "Ref": "ALIYUN::StackId"
                  }
                ]
              ]
            },
            "PolicyDocument": {
              "Statement": [
                {
                  "Action": [
                    "oss:*"
                  ],
                  "Effect": "Allow",
                  "Resource": [
                    "*"
                  ]
                }
              ],
              "Version": "1"
            }
          }
        ]
      }
    }
  },
  "Outputs": {
  }
}

Scénario 2 : Créer un utilisateur RAM et une clé AccessKey.

Création rapide

ROSTemplateFormatVersion: '2015-09-01'
Conditions:
  CreateInstance:
    Fn::Equals:
      - Ref: SelectInstance
      - false
Parameters:
  UserName:
    Type: String
    Description: Custom RAM user name
    Label:
      zh-cn: RAM User Name
      en: RAM User Name
    Default: test123123123
  RoleName:
    Type: String
    Description: Custom RAM role name
    Label:
      zh-cn: RAM Role Name
      en: RAM Role Name
    Default: test123123123
  SelectInstance:
    Type: Boolean
    Label:
      en: Whether to select an existing Bucket
      zh-cn: Whether to select an existing Bucket
    Default: true
  ExistBucketName:
    Type: String
    Label:
      en: Existing Bucket
      zh-cn: Existing Bucket
    AssociationProperty: ALIYUN::OSS::Bucket::BucketName
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${SelectInstance}
            - true
    Default: ''
  BucketName:
    Type: String
    Label:
      zh-cn: New Bucket Name
      en: NewBucketName
    Description:
      zh-cn: Bucket names must be globally unique within the scope of OSS. The length is 3 to 63 characters. It must start and end with a lowercase letter or digit, and can contain lowercase letters, digits, and hyphens (-).
      en: Bucket names must be globally unique within the scope of OSS. The length is 3 to 63 characters. It must start and end with a lowercase letter or digit, and can contain lowercase letters, digits, and hyphens (-).
    AssociationProperty: AutoCompleteInput
    AssociationPropertyMetadata:
      Length: 6
      Prefix: my-bucketname-
      CharacterClasses:
        - Class: lowercase
          min: 1
      Visible:
        Condition:
          Fn::Equals:
            - ${SelectInstance}
            - false
    AllowedPattern: ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$
  AccessControl:
    Type: String
    Label:
      en: Access Control
      zh-cn: Access Control
    Description:
      en: Set the access permission of the bucket
      zh-cn: Set the access permission of the bucket
    Default: private
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${SelectInstance}
            - false
    AllowedValues:
      - private
      - public-read
      - public-read-write
Resources:
  RamUser:
    Type: ALIYUN::RAM::User
    Properties:
      UserName:
        Ref: UserName
  RamAK:
    Type: ALIYUN::RAM::AccessKey
    Properties:
      UserName:
        Fn::GetAtt:
          - RamUser
          - UserName
    DependsOn: RamUser
  MyBucket:
    Condition: CreateInstance
    Type: ALIYUN::OSS::Bucket
    Properties:
      AccessControl:
        Ref: AccessControl
      BucketName:
        Ref: BucketName
  Role:
    Type: ALIYUN::RAM::Role
    Properties:
      RoleName:
        Ref: RoleName
      AssumeRolePolicyDocument:
        Version: '1'
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              RAM:
                - Fn::Sub: acs:ram::${ALIYUN::TenantId}:root
      Policies:
        - PolicyName:
            Fn::Join:
              - ''
              - - Policy-
                - Ref: ALIYUN::StackId
          PolicyDocument:
            Version: '1'
            Statement:
              - Effect: Allow
                Action:
                  - oss:PutObject
                Resource:
                  - Fn::Sub:
                      - acs:oss:*:*:${BucketName}/*
                      - BucketName:
                          Fn::If:
                            - CreateInstance
                            - Ref: BucketName
                            - Ref: ExistBucketName
Outputs:
  AKSecret:
    Value:
      Fn::GetAtt:
        - RamAK
        - AccessKeySecret
  AKId:
    Value:
      Fn::GetAtt:
        - RamAK
        - AccessKeyId
  UserId:
    Value:
      Fn::GetAtt:
        - RamUser
        - UserId
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - SelectInstance
          - ExistBucketName
          - BucketName
          - AccessControl
        Label:
          default: OSS
      - Parameters:
          - UserName
          - RoleName
        Label:
          default: RAM
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Conditions": {
    "CreateInstance": {
      "Fn::Equals": [
        {
          "Ref": "SelectInstance"
        },
        false
      ]
    }
  },
  "Parameters": {
    "UserName": {
      "Type": "String",
      "Description": "Custom RAM user name",
      "Label": {
        "zh-cn": "RAM User Name",
        "en": "RAM User Name"
      },
      "Default": "test123123123"
    },
    "RoleName": {
      "Type": "String",
      "Description": "Custom RAM role name",
      "Label": {
        "zh-cn": "RAM Role Name",
        "en": "RAM Role Name"
      },
      "Default": "test123123123"
    },
    "SelectInstance": {
      "Type": "Boolean",
      "Label": {
        "en": "Whether to select an existing Bucket",
        "zh-cn": "Whether to select an existing Bucket"
      },
      "Default": true
    },
    "ExistBucketName": {
      "Type": "String",
      "Label": {
        "en": "Existing Bucket",
        "zh-cn": "Existing Bucket"
      },
      "AssociationProperty": "ALIYUN::OSS::Bucket::BucketName",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Equals": [
              "${SelectInstance}",
              true
            ]
          }
        }
      },
      "Default": ""
    },
    "BucketName": {
      "Type": "String",
      "Label": {
        "zh-cn": "New Bucket Name",
        "en": "NewBucketName"
      },
      "Description": {
        "zh-cn": "Bucket names must be globally unique within the scope of OSS. The length is 3 to 63 characters. It must start and end with a lowercase letter or digit, and can contain lowercase letters, digits, and hyphens (-).",
        "en": "Bucket names must be globally unique within the scope of OSS. The length is 3 to 63 characters. It must start and end with a lowercase letter or digit, and can contain lowercase letters, digits, and hyphens (-)."
      },
      "AssociationProperty": "AutoCompleteInput",
      "AssociationPropertyMetadata": {
        "Length": 6,
        "Prefix": "my-bucketname-",
        "CharacterClasses": [
          {
            "Class": "lowercase",
            "min": 1
          }
        ],
        "Visible": {
          "Condition": {
            "Fn::Equals": [
              "${SelectInstance}",
              false
            ]
          }
        }
      },
      "AllowedPattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$"
    },
    "AccessControl": {
      "Type": "String",
      "Label": {
        "en": "Access Control",
        "zh-cn": "Access Control"
      },
      "Description": {
        "en": "Set the access permission of the bucket",
        "zh-cn": "Set the access permission of the bucket"
      },
      "Default": "private",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Equals": [
              "${SelectInstance}",
              false
            ]
          }
        }
      },
      "AllowedValues": [
        "private",
        "public-read",
        "public-read-write"
      ]
    }
  },
  "Resources": {
    "RamUser": {
      "Type": "ALIYUN::RAM::User",
      "Properties": {
        "UserName": {
          "Ref": "UserName"
        }
      }
    },
    "RamAK": {
      "Type": "ALIYUN::RAM::AccessKey",
      "Properties": {
        "UserName": {
          "Fn::GetAtt": [
            "RamUser",
            "UserName"
          ]
        }
      }
    },
    "MyBucket": {
      "Condition": "CreateInstance",
      "Type": "ALIYUN::OSS::Bucket",
      "Properties": {
        "AccessControl": {
          "Ref": "AccessControl"
        },
        "BucketName": {
          "Ref": "BucketName"
        }
      }
    },
    "Role": {
      "Type": "ALIYUN::RAM::Role",
      "Properties": {
        "RoleName": {
          "Ref": "RoleName"
        },
        "AssumeRolePolicyDocument": {
          "Version": "1",
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "RAM": [
                  {
                    "Fn::Sub": "acs:ram::${ALIYUN::TenantId}:root"
                  }
                ]
              }
            }
          ]
        },
        "Policies": [
          {
            "PolicyName": {
              "Fn::Join": [
                "",
                [
                  "Policy-",
                  {
                    "Ref": "ALIYUN::StackId"
                  }
                ]
              ]
            },
            "PolicyDocument": {
              "Version": "1",
              "Statement": [
                {
                  "Effect": "Allow",
                  "Action": [
                    "oss:PutObject"
                  ],
                  "Resource": [
                    {
                      "Fn::Sub": [
                        "acs:oss:*:*:${BucketName}/*",
                        {
                          "BucketName": {
                            "Fn::If": [
                              "CreateInstance",
                              {
                                "Ref": "BucketName"
                              },
                              {
                                "Ref": "ExistBucketName"
                              }
                            ]
                          }
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    }
  },
  "Outputs": {
    "AKSecret": {
      "Value": {
        "Fn::GetAtt": [
          "RamAK",
          "AccessKeySecret"
        ]
      }
    },
    "AKId": {
      "Value": {
        "Fn::GetAtt": [
          "RamAK",
          "AccessKeyId"
        ]
      }
    },
    "UserId": {
      "Value": {
        "Fn::GetAtt": [
          "RamUser",
          "UserId"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "SelectInstance",
            "ExistBucketName",
            "BucketName",
            "AccessControl"
          ],
          "Label": {
            "default": "OSS"
          }
        },
        {
          "Parameters": [
            "UserName",
            "RoleName"
          ],
          "Label": {
            "default": "RAM"
          }
        }
      ]
    }
  }
}

Scénario 3 : Créer un utilisateur RAM et une AccessKey, et accorder l'autorisation d'écriture (oss:PutObject) sur un compartiment OSS spécifique.

Création rapide

ROSTemplateFormatVersion: '2015-09-01'
Conditions:
  CreateInstance:
    Fn::Equals:
      - Ref: SelectInstance
      - false
Parameters:
  UserName:
    Type: String
    Description: Custom RAM user name
    Label:
      zh-cn: RAM User Name
      en: RAM User Name
    Default: test123123123
  RoleName:
    Type: String
    Description: Custom RAM role name
    Label:
      zh-cn: RAM Role Name
      en: RAM Role Name
    Default: test123123123
  SelectInstance:
    Type: Boolean
    Label:
      en: Whether to select an existing Bucket
      zh-cn: Whether to select an existing Bucket
    Default: true
  ExistBucketName:
    Type: String
    Label:
      en: Existing Bucket
      zh-cn: Existing Bucket
    AssociationProperty: ALIYUN::OSS::Bucket::BucketName
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${SelectInstance}
            - true
    Default: ''
  BucketName:
    Type: String
    Label:
      zh-cn: New Bucket Name
      en: NewBucketName
    Description:
      zh-cn: Bucket names must be globally unique within the scope of OSS. The length is 3 to 63 characters. It must start and end with a lowercase letter or digit, and can contain lowercase letters, digits, and hyphens (-).
      en: Bucket names must be globally unique within the scope of OSS. The length is 3 to 63 characters. It must start and end with a lowercase letter or digit, and can contain lowercase letters, digits, and hyphens (-).
    AssociationProperty: AutoCompleteInput
    AssociationPropertyMetadata:
      Length: 6
      Prefix: my-bucketname-
      CharacterClasses:
        - Class: lowercase
          min: 1
      Visible:
        Condition:
          Fn::Equals:
            - ${SelectInstance}
            - false
    AllowedPattern: ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$
  AccessControl:
    Type: String
    Label:
      en: Access Control
      zh-cn: Access Control
    Description:
      en: Set the access permission of the bucket
      zh-cn: Set the access permission of the bucket
    Default: private
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${SelectInstance}
            - false
    AllowedValues:
      - private
      - public-read
      - public-read-write
Resources:
  RamUser:
    Type: ALIYUN::RAM::User
    Properties:
      UserName:
        Ref: UserName
  RamAK:
    Type: ALIYUN::RAM::AccessKey
    Properties:
      UserName:
        Fn::GetAtt:
          - RamUser
          - UserName
    DependsOn: RamUser
  MyBucket:
    Condition: CreateInstance
    Type: ALIYUN::OSS::Bucket
    Properties:
      AccessControl:
        Ref: AccessControl
      BucketName:
        Ref: BucketName
  Role:
    Type: ALIYUN::RAM::Role
    Properties:
      RoleName:
        Ref: RoleName
      AssumeRolePolicyDocument:
        Version: '1'
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              RAM:
                - Fn::Sub: acs:ram::${ALIYUN::TenantId}:root
      Policies:
        - PolicyName:
            Fn::Join:
              - ''
              - - Policy-
                - Ref: ALIYUN::StackId
          PolicyDocument:
            Version: '1'
            Statement:
              - Effect: Allow
                Action:
                  - oss:PutObject
                Resource:
                  - Fn::Sub:
                      - acs:oss:*:*:${BucketName}/*
                      - BucketName:
                          Fn::If:
                            - CreateInstance
                            - Ref: BucketName
                            - Ref: ExistBucketName
Outputs:
  AKSecret:
    Value:
      Fn::GetAtt:
        - RamAK
        - AccessKeySecret
  AKId:
    Value:
      Fn::GetAtt:
        - RamAK
        - AccessKeyId
  UserId:
    Value:
      Fn::GetAtt:
        - RamUser
        - UserId
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - SelectInstance
          - ExistBucketName
          - BucketName
          - AccessControl
        Label:
          default: OSS
      - Parameters:
          - UserName
          - RoleName
        Label:
          default: RAM
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Conditions": {
    "CreateInstance": {
      "Fn::Equals": [
        {
          "Ref": "SelectInstance"
        },
        false
      ]
    }
  },
  "Parameters": {
    "UserName": {
      "Type": "String",
      "Description": "Custom RAM user name",
      "Label": {
        "zh-cn": "RAM User Name",
        "en": "RAM User Name"
      },
      "Default": "test123123123"
    },
    "RoleName": {
      "Type": "String",
      "Description": "Custom RAM role name",
      "Label": {
        "zh-cn": "RAM Role Name",
        "en": "RAM Role Name"
      },
      "Default": "test123123123"
    },
    "SelectInstance": {
      "Type": "Boolean",
      "Label": {
        "en": "Whether to select an existing Bucket",
        "zh-cn": "Whether to select an existing Bucket"
      },
      "Default": true
    },
    "ExistBucketName": {
      "Type": "String",
      "Label": {
        "en": "Existing Bucket",
        "zh-cn": "Existing Bucket"
      },
      "AssociationProperty": "ALIYUN::OSS::Bucket::BucketName",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Equals": [
              "${SelectInstance}",
              true
            ]
          }
        }
      },
      "Default": ""
    },
    "BucketName": {
      "Type": "String",
      "Label": {
        "zh-cn": "New Bucket Name",
        "en": "NewBucketName"
      },
      "Description": {
        "zh-cn": "Bucket names must be globally unique within the scope of OSS. The length is 3 to 63 characters. It must start and end with a lowercase letter or digit, and can contain lowercase letters, digits, and hyphens (-).",
        "en": "Bucket names must be globally unique within the scope of OSS. The length is 3 to 63 characters. It must start and end with a lowercase letter or digit, and can contain lowercase letters, digits, and hyphens (-)."
      },
      "AssociationProperty": "AutoCompleteInput",
      "AssociationPropertyMetadata": {
        "Length": 6,
        "Prefix": "my-bucketname-",
        "CharacterClasses": [
          {
            "Class": "lowercase",
            "min": 1
          }
        ],
        "Visible": {
          "Condition": {
            "Fn::Equals": [
              "${SelectInstance}",
              false
            ]
          }
        }
      },
      "AllowedPattern": "^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$"
    },
    "AccessControl": {
      "Type": "String",
      "Label": {
        "en": "Access Control",
        "zh-cn": "Access Control"
      },
      "Description": {
        "en": "Set the access permission of the bucket",
        "zh-cn": "Set the access permission of the bucket"
      },
      "Default": "private",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Equals": [
              "${SelectInstance}",
              false
            ]
          }
        }
      },
      "AllowedValues": [
        "private",
        "public-read",
        "public-read-write"
      ]
    }
  },
  "Resources": {
    "RamUser": {
      "Type": "ALIYUN::RAM::User",
      "Properties": {
        "UserName": {
          "Ref": "UserName"
        }
      }
    },
    "RamAK": {
      "Type": "ALIYUN::RAM::AccessKey",
      "Properties": {
        "UserName": {
          "Fn::GetAtt": [
            "RamUser",
            "UserName"
          ]
        }
      }
    },
    "MyBucket": {
      "Condition": "CreateInstance",
      "Type": "ALIYUN::OSS::Bucket",
      "Properties": {
        "AccessControl": {
          "Ref": "AccessControl"
        },
        "BucketName": {
          "Ref": "BucketName"
        }
      }
    },
    "Role": {
      "Type": "ALIYUN::RAM::Role",
      "Properties": {
        "RoleName": {
          "Ref": "RoleName"
        },
        "AssumeRolePolicyDocument": {
          "Version": "1",
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "RAM": [
                  {
                    "Fn::Sub": "acs:ram::${ALIYUN::TenantId}:root"
                  }
                ]
              }
            }
          ]
        },
        "Policies": [
          {
            "PolicyName": {
              "Fn::Join": [
                "",
                [
                  "Policy-",
                  {
                    "Ref": "ALIYUN::StackId"
                  }
                ]
              ]
            },
            "PolicyDocument": {
              "Version": "1",
              "Statement": [
                {
                  "Effect": "Allow",
                  "Action": [
                    "oss:PutObject"
                  ],
                  "Resource": [
                    {
                      "Fn::Sub": [
                        "acs:oss:*:*:${BucketName}/*",
                        {
                          "BucketName": {
                            "Fn::If": [
                              "CreateInstance",
                              {
                                "Ref": "BucketName"
                              },
                              {
                                "Ref": "ExistBucketName"
                              }
                            ]
                          }
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    }
  },
  "Outputs": {
    "AKSecret": {
      "Value": {
        "Fn::GetAtt": [
          "RamAK",
          "AccessKeySecret"
        ]
      }
    },
    "AKId": {
      "Value": {
        "Fn::GetAtt": [
          "RamAK",
          "AccessKeyId"
        ]
      }
    },
    "UserId": {
      "Value": {
        "Fn::GetAtt": [
          "RamUser",
          "UserId"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "SelectInstance",
            "ExistBucketName",
            "BucketName",
            "AccessControl"
          ],
          "Label": {
            "default": "OSS"
          }
        },
        {
          "Parameters": [
            "UserName",
            "RoleName"
          ],
          "Label": {
            "default": "RAM"
          }
        }
      ]
    }
  }
}

Scénario 4 : Créer des utilisateurs pour des groupes d'utilisateurs avec des politiques différentes.

Création rapide

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create sub-accounts, assign them to user groups and administrator groups, enable logon, generate AccessKeys, and attach read permissions for ECS and OSS.
  en: Create sub-accounts, assign them to user groups and administrator groups, enable logon, generate AccessKeys, and attach read permissions for ECS and OSS.
Parameters:
  GroupName1:
    Type: String
    Label:
      en: Group 1 Name
      zh-cn: Group 1 Name
    Description:
      en: The name of user group 1. Specify a group name that contains up to 64 characters, letters, digits, or hyphens (-).
      zh-cn: The name of user group 1. <br/>Specify a group name that contains up to 64 characters, letters, digits, or hyphens (-).
    ConstraintDescription:
      en: No more than 64 characters, letters, digits, or hyphens (-).
      zh-cn: No more than 64 characters, letters, digits, or hyphens (-).
    Default: UserGroup
    AllowedPattern: ^[a-zA-Z0-9\-]+$
    MinLength: 1
    MaxLength: 64
  GroupName2:
    Type: String
    Label:
      en: Group 2 Name
      zh-cn: Group 2 Name
    Description:
      en: The name of user group 2. <br>Specify a group name that contains up to 64 characters, letters, digits, or hyphens (-).
      zh-cn: The name of user group 2. <br>Specify a group name that contains up to 64 characters, letters, digits, or hyphens (-).
    ConstraintDescription:
      en: No more than 64 characters, letters, digits, or hyphens (-).
      zh-cn: No more than 64 characters, letters, digits, or hyphens (-).
    Default: AdminGroup
    AllowedPattern: ^[a-zA-Z0-9\-]+$
    MinLength: 1
    MaxLength: 64
  UserName:
    Type: String
    Label:
      en: User Name
      zh-cn: User Name
    Description:
      en: The user name cannot already exist. <br>It can contain letters, digits, periods (.), underscores (_), or hyphens (-), and must not exceed 64 characters.
      zh-cn: The user name cannot already exist. <br>It can contain letters, digits, periods (.), underscores (_), or hyphens (-), and must not exceed 64 characters.
    ConstraintDescription:
      en: No more than 64 characters, letters, digits, or hyphens (-).
      zh-cn: No more than 64 characters, letters, digits, or hyphens (-).
    Default: test-user
    AllowedPattern: '[a-zA-Z0-9\.\-\_]+$'
    MinLength: 1
    MaxLength: 64
  UserPassword:
    Type: String
    Label:
      en: User Password
      zh-cn: User Password
    Description:
      en: Specify a password that meets the password strength requirements. <br>For more information about password strength policies, see <a>GetPasswordPolicy</a>.
      zh-cn: Specify a password that meets the password strength requirements. <br>For more information about password strength policies, see <a href='https://www.alibabacloud.com/help/document_detail/28740.html' target='_blank'><b><font color='blue'>GetPasswordPolicy</font><font color='blue'></a>.
    NoEcho: true
Resources:
  RamGroup1:
    Type: ALIYUN::RAM::Group
    Properties:
      GroupName:
        Ref: GroupName1
  RamGroup2:
    Type: ALIYUN::RAM::Group
    Properties:
      GroupName:
        Ref: GroupName2
  RamUser:
    Type: ALIYUN::RAM::User
    Properties:
      Groups:
        - Ref: RamGroup1
        - Ref: RamGroup2
      LoginProfile:
        Password:
          Ref: UserPassword
        PasswordResetRequired: false
      UserName:
        Ref: UserName
  RamAK:
    Type: ALIYUN::RAM::AccessKey
    Properties:
      UserName:
        Fn::GetAtt:
          - RamUser
          - UserName
  RamManagedPolicy1:
    Type: ALIYUN::RAM::ManagedPolicy
    Properties:
      Groups:
        - Ref: RamGroup1
      PolicyDocument:
        Statement:
          - Action:
              - ecs:Describe*
            Effect: Allow
            Resource:
              - '*'
          - Action:
              - ecs:List*
            Effect: Allow
            Resource:
              - '*'
          - Action:
              - vpc:DescribeVpcs
              - vpc:DescribeVSwitches
            Effect: Allow
            Resource:
              - '*'
        Version: '1'
      PolicyName:
        Fn::Join:
          - '-'
          - - ECSReadOnly
            - StackId
            - Ref: ALIYUN::StackId
  RamManagedPolicy2:
    Type: ALIYUN::RAM::ManagedPolicy
    Properties:
      Groups:
        - Ref: RamGroup2
      PolicyDocument:
        Statement:
          - Action:
              - oss:*
            Effect: Allow
            Resource:
              - '*'
        Version: '1'
      PolicyName:
        Fn::Join:
          - '-'
          - - OSSReadOnly
            - StackId
            - Ref: ALIYUN::StackId
Outputs:
  RamAccessKeyId:
    Value:
      Fn::GetAtt:
        - RamAK
        - AccessKeyId
  RamUserId:
    Value:
      Fn::GetAtt:
        - RamUser
        - UserId
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - GroupName1
          - GroupName2
          - UserName
          - UserPassword
        Label:
          default: RAM
    TemplateTags:
      - acs:example:elastic computing:Create a user with different policies for user groups
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "Create sub-accounts, assign them to user groups and administrator groups, enable logon, generate AccessKeys, and attach read permissions for ECS and OSS.",
    "en": "Create sub-accounts, assign them to user groups and administrator groups, enable logon, generate AccessKeys, and attach read permissions for ECS and OSS."
  },
  "Parameters": {
    "GroupName1": {
      "Type": "String",
      "Label": {
        "en": "Group 1 Name",
        "zh-cn": "Group 1 Name"
      },
      "Description": {
        "en": "The name of user group 1. \u003cbr\u003eSpecify a group name that contains up to 64 characters, letters, digits, or hyphens (-).",
        "zh-cn": "The name of user group 1. \u003cbr\u003eSpecify a group name that contains up to 64 characters, letters, digits, or hyphens (-)."
      },
      "ConstraintDescription": {
        "en": "No more than 64 characters, letters, digits, or hyphens (-).",
        "zh-cn": "No more than 64 characters, letters, digits, or hyphens (-)."
      },
      "Default": "UserGroup",
      "AllowedPattern": "^[a-zA-Z0-9\\-]+$",
      "MinLength": 1,
      "MaxLength": 64
    },
    "GroupName2": {
      "Type": "String",
      "Label": {
        "en": "Group 2 Name",
        "zh-cn": "Group 2 Name"
      },
      "Description": {
        "en": "The name of user group 2. \u003cbr\u003eSpecify a group name that contains up to 64 characters, letters, digits, or hyphens (-).",
        "zh-cn": "The name of user group 2. \u003cbr\u003eSpecify a group name that contains up to 64 characters, letters, digits, or hyphens (-)."
      },
      "ConstraintDescription": {
        "en": "No more than 64 characters, letters, digits, or hyphens (-).",
        "zh-cn": "No more than 64 characters, letters, digits, or hyphens (-)."
      },
      "Default": "AdminGroup",
      "AllowedPattern": "^[a-zA-Z0-9\\-]+$",
      "MinLength": 1,
      "MaxLength": 64
    },
    "UserName": {
      "Type": "String",
      "Label": {
        "en": "User Name",
        "zh-cn": "User Name"
      },
      "Description": {
        "en": "The user name cannot already exist. \u003cbr\u003eIt can contain letters, digits, periods (.), underscores (_), or hyphens (-), and must not exceed 64 characters.",
        "zh-cn": "The user name cannot already exist. \u003cbr\u003eIt can contain letters, digits, periods (.), underscores (_), or hyphens (-), and must not exceed 64 characters."
      },
      "ConstraintDescription": {
        "en": "No more than 64 characters, letters, digits, or hyphens (-).",
        "zh-cn": "No more than 64 characters, letters, digits, or hyphens (-)."
      },
      "Default": "test-user",
      "AllowedPattern": "[a-zA-Z0-9\\.\\-\\_]+$",
      "MinLength": 1,
      "MaxLength": 64
    },
    "UserPassword": {
      "Type": "String",
      "Label": {
        "en": "User Password",
        "zh-cn": "User Password"
      },
      "Description": {
        "en": "Specify a password that meets the password strength requirements. \u003cbr\u003eFor more information about password strength policies, see \u003ca href='https://www.alibabacloud.com/help/document_detail/28740.html' target='_blank'\u003e\u003cb\u003e\u003cfont color='blue'\u003eGetPasswordPolicy\u003c/font\u003e\u003c/b\u003e\u003cfont color='blue'\u003e\u003c/a\u003e.",
        "zh-cn": "Specify a password that meets the password strength requirements. \u003cbr\u003eFor more information about password strength policies, see \u003ca href='https://www.alibabacloud.com/help/document_detail/28740.html' target='_blank'\u003e\u003cb\u003e\u003cfont color='blue'\u003eGetPasswordPolicy\u003c/font\u003e\u003c/b\u003e\u003cfont color='blue'\u003e\u003c/a\u003e."
      },
      "NoEcho": true
    }
  },
  "Resources": {
    "RamGroup1": {
      "Type": "ALIYUN::RAM::Group",
      "Properties": {
        "GroupName": {
          "Ref": "GroupName1"
        }
      }
    },
    "RamGroup2": {
      "Type": "ALIYUN::RAM::Group",
      "Properties": {
        "GroupName": {
          "Ref": "GroupName2"
        }
      }
    },
    "RamUser": {
      "Type": "ALIYUN::RAM::User",
      "Properties": {
        "Groups": [
          {
            "Ref": "RamGroup1"
          },
          {
            "Ref": "RamGroup2"
          }
        ],
        "LoginProfile": {
          "Password": {
            "Ref": "UserPassword"
          },
          "PasswordResetRequired": false
        },
        "UserName": {
          "Ref": "UserName"
        }
      }
    },
    "RamAK": {
      "Type": "ALIYUN::RAM::AccessKey",
      "Properties": {
        "UserName": {
          "Fn::GetAtt": [
            "RamUser",
            "UserName"
          ]
        }
      }
    },
    "RamManagedPolicy1": {
      "Type": "ALIYUN::RAM::ManagedPolicy",
      "Properties": {
        "Groups": [
          {
            "Ref": "RamGroup1"
          }
        ],
        "PolicyDocument": {
          "Statement": [
            {
              "Action": [
                "ecs:Describe*"
              ],
              "Effect": "Allow",
              "Resource": [
                "*"
              ]
            },
            {
              "Action": [
                "ecs:List*"
              ],
              "Effect": "Allow",
              "Resource": [
                "*"
              ]
            },
            {
              "Action": [
                "vpc:DescribeVpcs",
                "vpc:DescribeVSwitches"
              ],
              "Effect": "Allow",
              "Resource": [
                "*"
              ]
            }
          ],
          "Version": "1"
        },
        "PolicyName": {
          "Fn::Join": [
            "-",
            [
              "ECSReadOnly",
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        }
      }
    },
    "RamManagedPolicy2": {
      "Type": "ALIYUN::RAM::ManagedPolicy",
      "Properties": {
        "Groups": [
          {
            "Ref": "RamGroup2"
          }
        ],
        "PolicyDocument": {
          "Statement": [
            {
              "Action": [
                "oss:*"
              ],
              "Effect": "Allow",
              "Resource": [
                "*"
              ]
            }
          ],
          "Version": "1"
        },
        "PolicyName": {
          "Fn::Join": [
            "-",
            [
              "OSSReadOnly",
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        }
      }
    }
  },
  "Outputs": {
    "RamAccessKeyId": {
      "Value": {
        "Fn::GetAtt": [
          "RamAK",
          "AccessKeyId"
        ]
      }
    },
    "RamUserId": {
      "Value": {
        "Fn::GetAtt": [
          "RamUser",
          "UserId"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "GroupName1",
            "GroupName2",
            "UserName",
            "UserPassword"
          ],
          "Label": {
            "default": "RAM"
          }
        }
      ],
      "TemplateTags": [
        "acs:example:elastic computing:Create a user with different policies for user groups"
      ]
    }
  }
}

Pour plus d'exemples, consultez les modèles publics contenant cette ressource.