Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::RAM::User

Última atualização: Jul 24, 2026

O recurso ALIYUN::RAM::User cria um usuário do RAM.

Sintaxe

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

Propriedades

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrições

UserName

String

Sim

Não

Nome do usuário do RAM.

Deve ter de 1 a 64 caracteres. Pode conter letras, dígitos, pontos (.), hifens (-) e sublinhados (_).

Comments

String

Não

Sim

Observações sobre o usuário.

Deve ter de 1 a 128 caracteres.

DeletionForce

Boolean

Não

Sim

Defina se as políticas de acesso devem ser desvinculadas à força do usuário do RAM.

Valores válidos:

  • true: Desvincula à força.

  • false (padrão): Não desvincula à força.

DisplayName

String

Não

Sim

Nome de exibição do usuário do RAM.

Deve ter de 1 a 128 caracteres.

Email

String

Não

Sim

Endereço de e-mail do usuário do RAM.

Nenhuma

Groups

List

Não

Não

Grupos de usuários aos quais o usuário do RAM pertence.

Nenhuma

LoginProfile

Map

Não

Não

Perfil de logon do usuário do RAM.

Para mais informações, consulte LoginProfile properties.

MobilePhone

String

Não

Sim

Número de telefone celular do usuário do RAM.

Nenhuma

Policies

List

Não

Sim

Políticas de acesso aplicáveis ao usuário do RAM.

Para mais informações, consulte Policies properties.

PolicyAttachments

Map

Não

Sim

Nomes das políticas de sistema e personalizadas a adicionar.

Para mais informações, consulte PolicyAttachments properties.

Sintaxe de LoginProfile

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

Propriedades de LoginProfile

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrições

MFABindRequired

Boolean

Não

Não

Defina se a autenticação multifator (MFA) é obrigatória para o usuário do RAM.

Valores válidos:

  • true: Exige MFA. O usuário do RAM deve vincular um dispositivo MFA no próximo logon.

  • false: Não exige ativação.

Password

String

Não

Não

Nova senha de logon no console para o usuário do RAM.

A senha deve atender aos requisitos de complexidade. Deve ter de 8 a 32 caracteres.

PasswordResetRequired

Boolean

Não

Não

Defina se o usuário do RAM precisa redefinir a senha no próximo logon.

Valores válidos:

  • true: É necessário redefinir a senha.

  • false: Não é necessário redefinir a senha.

Sintaxe de Policies

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

Propriedades de Policies

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrições

PolicyDocument

Map

Sim

Sim

Documento da política.

Não pode exceder 2048 caracteres.

Para mais informações, consulte PolicyDocument properties.

PolicyName

String

Sim

Não

Nome da política de acesso.

Deve ter de 1 a 128 caracteres. Pode conter letras, dígitos e hifens (-).

Description

String

Não

Não

Descrição da política.

Deve ter de 1 a 1024 caracteres.

IgnoreExisting

Boolean

Não

Não

Defina se as políticas existentes devem ser ignoradas.

Valores válidos:

  • true: O ROS não verifica a unicidade. Se já existir uma política com o mesmo nome, o ROS ignora o processo de criação. Caso o ROS não tenha criado a política, ela será ignorada durante as fases de atualização e exclusão.

  • false: O ROS verifica a unicidade. Se já existir uma política com o mesmo nome, o ROS relata um erro ao tentar criar a política.

Sintaxe de PolicyDocument

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

Propriedades de PolicyDocument

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrições

Statement

List

Sim

Não

Regras específicas da política de acesso.

Para mais informações, consulte Statement properties.

Version

String

Sim

Não

Versão da política de acesso.

Nenhuma

Sintaxe de Statement

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

Propriedades de Statement

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrições

Action

List

Não

Não

Operações específicas da política de acesso.

Nenhuma

Condition

Map

Não

Não

Condições que restringem a autorização.

Nenhuma

Effect

String

Não

Não

Efeito da autorização.

Valores válidos:

  • Allow: Permite a ação.

  • Deny: Nega a ação.

NotAction

List

Não

Não

Operações excluídas quando o acesso é permitido ou negado.

Nenhuma

Resource

List

Não

Não

Recursos específicos da política de acesso.

Nenhuma

Sintaxe de PolicyAttachments

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

Propriedades de PolicyAttachments

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrições

Custom

List

Não

Sim

Lista de nomes de políticas personalizadas.

A quantidade de políticas deve ser menor ou igual a 5.

System

List

Não

Sim

Lista de nomes de políticas de sistema.

A quantidade de políticas deve ser menor ou igual a 20.

Valores de retorno

Fn::GetAtt

  • UserName: Nome do usuário do RAM.

  • UserId: ID do usuário do RAM.

  • CreateDate: Data e hora de criação do usuário do RAM.

  • LastLoginDate: Data e hora do último logon do usuário do RAM.

Exemplos

Cenário 1: Crie um usuário do RAM.

Criação rápida

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": {
  }
}

Cenário 2: Crie um usuário do RAM e uma AccessKey.

Criação rápida

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

Cenário 3: Crie um usuário do RAM e uma AccessKey, concedendo permissão de escrita (oss:PutObject) em um bucket do OSS específico.

Criação rápida

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

Cenário 4: Crie usuários para grupos de usuários com políticas diferentes.

Criação rápida

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

Para mais exemplos, consulte modelos públicos que contêm este recurso.