All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::RAM::User

Last Updated:Feb 07, 2026

Resource ALIYUN::RAM::User digunakan untuk membuat pengguna RAM.

Sintaks

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

Properti

Property Name

Type

Required

Updatable

Description

Constraints

UserName

String

Yes

No

Nama pengguna RAM.

Panjangnya 1 hingga 64 karakter. Dapat berisi huruf, angka, titik (.), tanda hubung (-), dan garis bawah (_).

DisplayName

String

No

Yes

Nama tampilan pengguna RAM.

Panjangnya 1 hingga 128 karakter.

LoginProfile

Map

No

No

Profil logon pengguna RAM.

Untuk informasi selengkapnya, lihat properti LoginProfile.

Groups

List

No

No

Kelompok pengguna yang diikuti oleh pengguna RAM.

None

MobilePhone

String

No

Yes

Nomor ponsel pengguna RAM.

None

Email

String

No

Yes

Kotak surat pengguna RAM.

None

Comments

String

No

Yes

Keterangan.

Panjangnya 1 hingga 128 karakter.

Policies

List

No

Yes

Kebijakan akses yang berlaku untuk pengguna RAM.

Untuk informasi selengkapnya, lihat properti Policies.

PolicyAttachments

Map

No

Yes

Nama kebijakan sistem dan kebijakan kustom yang akan ditambahkan.

Untuk informasi selengkapnya, lihat properti PolicyAttachments.

DeletionForce

Boolean

No

Yes

Menentukan apakah kebijakan akses harus diputus secara paksa dari pengguna RAM.

Nilai yang valid:

  • true: Memutus secara paksa.

  • false (default): Tidak memutus secara paksa.

Sintaks LoginProfile

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

Properti LoginProfile

Property Name

Type

Required

Updatable

Description

Constraints

MFABindRequired

Boolean

No

No

Menentukan apakah autentikasi multi-faktor (MFA) diperlukan untuk pengguna RAM.

Nilai yang valid:

  • true: Memerlukan MFA. Pengguna RAM harus mengikat perangkat MFA saat logon berikutnya.

  • false: Tidak perlu diaktifkan.

Password

String

No

No

Password logon Konsol baru untuk pengguna RAM.

Password harus memenuhi persyaratan kekuatan password. Panjangnya 8 hingga 32 karakter.

PasswordResetRequired

Boolean

No

No

Menentukan apakah pengguna RAM harus mengatur ulang password saat logon berikutnya.

Nilai yang valid:

  • true: Harus mengatur ulang password.

  • false: Tidak perlu mengatur ulang password.

Sintaks Policies

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

Properti kebijakan

Property Name

Type

Required

Updatable

Description

Constraints

Description

String

No

No

Keterangan.

Panjangnya 1 hingga 1024 karakter.

PolicyName

String

Yes

No

Nama kebijakan akses.

Panjangnya 1 hingga 128 karakter. Dapat berisi huruf, angka, dan tanda hubung (-).

PolicyDocument

Map

Yes

Yes

Isi kebijakan.

Panjangnya tidak melebihi 2048 karakter.

Untuk informasi selengkapnya, lihat properti PolicyDocument.

IgnoreExisting

Boolean

No

No

Menentukan apakah kebijakan yang sudah ada diabaikan.

Nilai yang valid:

  • true: ROS tidak memeriksa keunikan. Jika kebijakan dengan nama yang sama sudah ada, ROS mengabaikan proses pembuatan kebijakan tersebut. Jika ROS tidak membuat kebijakan tersebut, maka kebijakan tersebut diabaikan selama fase pembaruan dan penghapusan.

  • false: ROS melakukan pemeriksaan keunikan. Jika kebijakan dengan nama yang sama sudah ada, ROS melaporkan error saat membuat kebijakan.

Sintaks PolicyDocument

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

Properti PolicyDocument

Property Name

Type

Required

Updatable

Description

Constraints

Version

String

Yes

No

Versi kebijakan akses.

None

Statement

List

Yes

No

Aturan spesifik dari kebijakan akses.

Untuk informasi selengkapnya, lihat properti Statement.

Sintaks Statement

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

Properti Statement

Property Name

Type

Required

Updatable

Description

Constraints

Condition

Map

No

No

Kondisi yang membatasi otorisasi.

None

Action

List

No

No

Operasi spesifik untuk kebijakan akses.

None

Resource

List

No

No

Resource spesifik untuk kebijakan akses.

None

Effect

String

No

No

Efek otorisasi.

Nilai yang valid:

  • Allow: Mengizinkan.

  • Deny: Menolak.

Sintaks PolicyAttachments

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

Properti PolicyAttachments

Property Name

Type

Required

Allow Updates

Description

Constraints

Custom

List

No

Yes

Daftar nama kebijakan kustom.

Jumlah kebijakan harus kurang dari atau sama dengan 5.

System

List

No

Yes

Daftar nama kebijakan sistem.

Jumlah kebijakan harus kurang dari atau sama dengan 20.

Nilai yang dikembalikan

Fn::GetAtt

  • UserName: Nama pengguna RAM.

  • UserId: ID pengguna RAM.

  • CreateDate: Waktu pembuatan pengguna RAM.

  • LastLoginDate: Waktu logon terakhir pengguna RAM.

Contoh

Skenario 1: Buat pengguna RAM.

Buat cepat

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

Skenario 2: Buat pengguna RAM dan AccessKey.

Buat cepat

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

Skenario 3: Buat pengguna RAM dan AccessKey, serta berikan izin menulis (oss:PutObject) ke bucket OSS tertentu.

Buat cepat

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

Skenario 4: Buat pengguna untuk kelompok pengguna dengan kebijakan berbeda.

Buat cepat

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Buat sub-akun, tetapkan ke kelompok pengguna dan kelompok administrator, aktifkan masuk, hasilkan AccessKey, serta sambungkan izin baca untuk ECS dan OSS.
  en: Buat sub-akun, tetapkan ke kelompok pengguna dan kelompok administrator, aktifkan masuk, hasilkan AccessKey, serta sambungkan izin baca untuk ECS dan OSS.
Parameters:
  GroupName1:
    Type: String
    Label:
      en: Nama Kelompok 1
      zh-cn: Nama Kelompok 1
    Description:
      en: Nama kelompok pengguna 1. <br/>Tentukan nama kelompok yang berisi maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
      zh-cn: Nama kelompok pengguna 1. <br/>Tentukan nama kelompok yang berisi maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
    ConstraintDescription:
      en: Maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
      zh-cn: Maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
    Default: UserGroup
    AllowedPattern: ^[a-zA-Z0-9\-]+$
    MinLength: 1
    MaxLength: 64
  GroupName2:
    Type: String
    Label:
      en: Nama Kelompok 2
      zh-cn: Nama Kelompok 2
    Description:
      en: Nama kelompok pengguna 2. <br>Tentukan nama kelompok yang berisi maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
      zh-cn: Nama kelompok pengguna 2. <br>Tentukan nama kelompok yang berisi maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
    ConstraintDescription:
      en: Maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
      zh-cn: Maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
    Default: AdminGroup
    AllowedPattern: ^[a-zA-Z0-9\-]+$
    MinLength: 1
    MaxLength: 64
  UserName:
    Type: String
    Label:
      en: Nama Pengguna
      zh-cn: Nama Pengguna
    Description:
      en: Nama pengguna tidak boleh sudah ada. <br>Nama ini dapat berisi huruf, angka, titik (.), garis bawah (_), atau tanda hubung (-), dan tidak boleh melebihi 64 karakter.
      zh-cn: Nama pengguna tidak boleh sudah ada. <br>Nama ini dapat berisi huruf, angka, titik (.), garis bawah (_), atau tanda hubung (-), dan tidak boleh melebihi 64 karakter.
    ConstraintDescription:
      en: Maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
      zh-cn: Maksimal 64 karakter, huruf, angka, atau tanda hubung (-).
    Default: test-user
    AllowedPattern: '[a-zA-Z0-9\.\-\_]+$'
    MinLength: 1
    MaxLength: 64
  UserPassword:
    Type: String
    Label:
      en: Kata Sandi Pengguna
      zh-cn: Kata Sandi Pengguna
    Description:
      en: Tentukan kata sandi yang memenuhi persyaratan kekuatan kata sandi. <br>Untuk informasi selengkapnya mengenai kebijakan kekuatan kata sandi, lihat <a>GetPasswordPolicy</a>.
      zh-cn: Tentukan kata sandi yang memenuhi persyaratan kekuatan kata sandi. <br>Untuk informasi selengkapnya mengenai kebijakan kekuatan kata sandi, lihat <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:komputasi elastis:Buat pengguna dengan kebijakan berbeda untuk kelompok pengguna
<br/>
{
  "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"
      ]
    }
  }
}

Untuk contoh lainnya, lihat templat publik yang berisi resource ini.