すべてのプロダクト
Search
ドキュメントセンター

Resource Orchestration Service:ALIYUN::RAM::User

最終更新日:Feb 07, 2026

ALIYUN::RAM::User リソースは、Resource Access Management (RAM) ユーザーを作成します。

構文

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

プロパティ

プロパティ名

タイプ

必須

更新可能

説明

制約

UserName

String

はい

いいえ

RAM ユーザーの名前です。

長さは 1~64 文字です。使用できる文字は、英字、数字、ピリオド (.)、ハイフン (-)、アンダースコア (_) です。

DisplayName

String

いいえ

はい

RAM ユーザーの表示名です。

長さは 1~128 文字です。

LoginProfile

Map

いいえ

いいえ

RAM ユーザーのログインプロファイルです。

詳細については、「LoginProfile のプロパティ」をご参照ください。

Groups

List

いいえ

いいえ

RAM ユーザーが参加するユーザーグループです。

なし

MobilePhone

String

いいえ

はい

RAM ユーザーの携帯電話番号です。

なし

Email

String

いいえ

はい

RAM ユーザーのメールボックスです。

なし

Comments

String

いいえ

はい

備考です。

長さは 1~128 文字です。

Policies

List

いいえ

はい

RAM ユーザーに適用されるアクセスポリシーです。

詳細については、「Policies のプロパティ」をご参照ください。

PolicyAttachments

Map

いいえ

はい

追加するシステムポリシーとカスタムポリシーの名前です。

詳細については、「PolicyAttachments のプロパティ」をご参照ください。

DeletionForce

Boolean

いいえ

はい

RAM ユーザーからアクセスポリシーを強制的にバインド解除するかどうかを指定します。

有効な値:

  • true:強制的にバインド解除します。

  • false (デフォルト):強制的にバインド解除しません。

LoginProfile の構文

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

LoginProfile のプロパティ

プロパティ名

タイプ

必須

更新可能

説明

制約

MFABindRequired

Boolean

いいえ

いいえ

RAM ユーザーに多要素認証 (MFA) が必要かどうかを指定します。

有効な値:

  • true:MFA が必要です。RAM ユーザーは次回のログイン時に MFA デバイスをバインドする必要があります。

  • false:有効化は不要です。

Password

String

いいえ

いいえ

RAM ユーザーの新しいコンソールログインパスワードです。

パスワードはパスワード強度要件を満たす必要があります。長さは 8~32 文字です。

PasswordResetRequired

Boolean

いいえ

いいえ

RAM ユーザーが次回のログイン時にパスワードをリセットする必要があるかどうかを指定します。

有効な値:

  • true:パスワードをリセットする必要があります。

  • false:パスワードをリセットする必要はありません。

Policies の構文

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

Policies のプロパティ

プロパティ名

タイプ

必須

更新可能

説明

制約

Description

String

いいえ

いいえ

説明です。

長さは 1~1024 文字です。

PolicyName

String

はい

いいえ

アクセスポリシーの名前です。

長さは 1~128 文字です。使用できる文字は、英字、数字、ハイフン (-) です。

PolicyDocument

Map

はい

はい

ポリシードキュメントです。

長さは 2048 文字を超えてはなりません。

詳細については、「PolicyDocument のプロパティ」をご参照ください。

IgnoreExisting

Boolean

いいえ

いいえ

既存のポリシーを無視するかどうかを指定します。

有効な値:

  • true:Resource Orchestration Service (ROS) は一意性チェックを実行しません。同じ名前のポリシーが存在する場合、ROS はポリシー作成プロセスを無視します。ROS がポリシーを作成しなかった場合、更新および削除フェーズで無視されます。

  • false:ROS は一意性チェックを実行します。同じ名前のポリシーが存在する場合、ROS はポリシー作成時にエラーを報告します。

PolicyDocument の構文

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

PolicyDocument のプロパティ

プロパティ名

タイプ

必須

更新可能

説明

制約

Version

String

はい

いいえ

アクセスポリシーのバージョンです。

なし

Statement

List

はい

いいえ

アクセスポリシーの特定のルールです。

詳細については、「Statement のプロパティ」をご参照ください。

Statement の構文

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

Statement のプロパティ

プロパティ名

タイプ

必須

更新可能

説明

制約

Condition

Map

いいえ

いいえ

権限付与を制限する条件です。

なし

Action

List

いいえ

いいえ

アクセスポリシーの特定の操作です。

なし

Resource

List

いいえ

いいえ

アクセスポリシーの特定のリソースです。

なし

Effect

String

いいえ

いいえ

権限付与の効果です。

有効な値:

  • Allow:許可します。

  • Deny:拒否します。

PolicyAttachments の構文

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

PolicyAttachments のプロパティ

プロパティ名

タイプ

必須

更新の許可

説明

制約

Custom

List

いいえ

はい

カスタムポリシー名のリストです。

ポリシーの数は 5 以下である必要があります。

System

List

いいえ

はい

システムポリシー名のリストです。

ポリシーの数は 20 以下である必要があります。

戻り値

Fn::GetAtt

  • UserName:RAM ユーザーの名前。

  • UserId:RAM ユーザーの ID。

  • CreateDate:RAM ユーザーが作成された時間。

  • LastLoginDate:RAM ユーザーが最後にログインした時間。

シナリオ 1:RAM ユーザーの作成

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Description: RAM ユーザーのテスト
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": "RAM ユーザーのテスト",
  "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": {
  }
}

シナリオ 2:RAM ユーザーと AccessKey の作成

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Conditions:
  CreateInstance:
    Fn::Equals:
      - Ref: SelectInstance
      - false
Parameters:
  UserName:
    Type: String
    Description: カスタム RAM ユーザー名
    Label:
      zh-cn: RAM ユーザー名
      en: RAM User Name
    Default: test123123123
  RoleName:
    Type: String
    Description: カスタム RAM ロール名
    Label:
      zh-cn: RAM ロール名
      en: RAM Role Name
    Default: test123123123
  SelectInstance:
    Type: Boolean
    Label:
      en: Whether to select an existing Bucket
      zh-cn: 既存のバケットを選択するかどうか
    Default: true
  ExistBucketName:
    Type: String
    Label:
      en: Existing Bucket
      zh-cn: 既存のバケット
    AssociationProperty: ALIYUN::OSS::Bucket::BucketName
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${SelectInstance}
            - true
    Default: ''
  BucketName:
    Type: String
    Label:
      zh-cn: 新しいバケット名
      en: NewBucketName
    Description:
      zh-cn: バケット名は OSS の範囲内でグローバルに一意である必要があります。長さは 3~63 文字です。小文字または数字で始まり、小文字または数字で終わる必要があります。使用できる文字は、小文字、数字、ハイフン (-) です。
      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: アクセス制御
    Description:
      en: Set the access permission of the bucket
      zh-cn: バケットのアクセス権限を設定します
    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": "カスタム RAM ユーザー名",
      "Label": {
        "zh-cn": "RAM ユーザー名",
        "en": "RAM User Name"
      },
      "Default": "test123123123"
    },
    "RoleName": {
      "Type": "String",
      "Description": "カスタム RAM ロール名",
      "Label": {
        "zh-cn": "RAM ロール名",
        "en": "RAM Role Name"
      },
      "Default": "test123123123"
    },
    "SelectInstance": {
      "Type": "Boolean",
      "Label": {
        "en": "Whether to select an existing Bucket",
        "zh-cn": "既存のバケットを選択するかどうか"
      },
      "Default": true
    },
    "ExistBucketName": {
      "Type": "String",
      "Label": {
        "en": "Existing Bucket",
        "zh-cn": "既存のバケット"
      },
      "AssociationProperty": "ALIYUN::OSS::Bucket::BucketName",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Equals": [
              "${SelectInstance}",
              true
            ]
          }
        }
      },
      "Default": ""
    },
    "BucketName": {
      "Type": "String",
      "Label": {
        "zh-cn": "新しいバケット名",
        "en": "NewBucketName"
      },
      "Description": {
        "zh-cn": "バケット名は OSS の範囲内でグローバルに一意である必要があります。長さは 3~63 文字です。小文字または数字で始まり、小文字または数字で終わる必要があります。使用できる文字は、小文字、数字、ハイフン (-) です。",
        "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": "アクセス制御"
      },
      "Description": {
        "en": "Set the access permission of the bucket",
        "zh-cn": "バケットのアクセス権限を設定します"
      },
      "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"
          }
        }
      ]
    }
  }
}

シナリオ 3:RAM ユーザーと AccessKey を作成し、指定された OSS バケットへの書き込み権限 (oss:PutObject) を付与

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Conditions:
  CreateInstance:
    Fn::Equals:
      - Ref: SelectInstance
      - false
Parameters:
  UserName:
    Type: String
    Description: カスタム RAM ユーザー名
    Label:
      zh-cn: RAM ユーザー名
      en: RAM User Name
    Default: test123123123
  RoleName:
    Type: String
    Description: カスタム RAM ロール名
    Label:
      zh-cn: RAM ロール名
      en: RAM Role Name
    Default: test123123123
  SelectInstance:
    Type: Boolean
    Label:
      en: Whether to select an existing Bucket
      zh-cn: 既存のバケットを選択するかどうか
    Default: true
  ExistBucketName:
    Type: String
    Label:
      en: Existing Bucket
      zh-cn: 既存のバケット
    AssociationProperty: ALIYUN::OSS::Bucket::BucketName
    AssociationPropertyMetadata:
      Visible:
        Condition:
          Fn::Equals:
            - ${SelectInstance}
            - true
    Default: ''
  BucketName:
    Type: String
    Label:
      zh-cn: 新しいバケット名
      en: NewBucketName
    Description:
      zh-cn: バケット名は OSS の範囲内でグローバルに一意である必要があります。長さは 3~63 文字です。小文字または数字で始まり、小文字または数字で終わる必要があります。使用できる文字は、小文字、数字、ハイフン (-) です。
      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: アクセス制御
    Description:
      en: Set the access permission of the bucket
      zh-cn: バケットのアクセス権限を設定します
    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": "カスタム RAM ユーザー名",
      "Label": {
        "zh-cn": "RAM ユーザー名",
        "en": "RAM User Name"
      },
      "Default": "test123123123"
    },
    "RoleName": {
      "Type": "String",
      "Description": "カスタム RAM ロール名",
      "Label": {
        "zh-cn": "RAM ロール名",
        "en": "RAM Role Name"
      },
      "Default": "test123123123"
    },
    "SelectInstance": {
      "Type": "Boolean",
      "Label": {
        "en": "Whether to select an existing Bucket",
        "zh-cn": "既存のバケットを選択するかどうか"
      },
      "Default": true
    },
    "ExistBucketName": {
      "Type": "String",
      "Label": {
        "en": "Existing Bucket",
        "zh-cn": "既存のバケット"
      },
      "AssociationProperty": "ALIYUN::OSS::Bucket::BucketName",
      "AssociationPropertyMetadata": {
        "Visible": {
          "Condition": {
            "Fn::Equals": [
              "${SelectInstance}",
              true
            ]
          }
        }
      },
      "Default": ""
    },
    "BucketName": {
      "Type": "String",
      "Label": {
        "zh-cn": "新しいバケット名",
        "en": "NewBucketName"
      },
      "Description": {
        "zh-cn": "バケット名は OSS の範囲内でグローバルに一意である必要があります。長さは 3~63 文字です。小文字または数字で始まり、小文字または数字で終わる必要があります。使用できる文字は、小文字、数字、ハイフン (-) です。",
        "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": "アクセス制御"
      },
      "Description": {
        "en": "Set the access permission of the bucket",
        "zh-cn": "バケットのアクセス権限を設定します"
      },
      "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"
          }
        }
      ]
    }
  }
}

シナリオ 4:異なるポリシーを持つユーザーグループのユーザーを作成

クイック作成

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: サブアカウントを作成し、ユーザーグループと管理者グループに割り当て、ログインを有効にし、AccessKey を生成し、ECS と 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: グループ 1 名
    Description:
      en: The name of user group 1. 
Specify a group name that contains up to 64 characters, letters, digits, or hyphens (-). zh-cn: ユーザーグループ 1 の名前です。<br/>最大 64 文字の英字、数字、またはハイフン (-) を含むグループ名を指定します。 ConstraintDescription: en: No more than 64 characters, letters, digits, or hyphens (-). zh-cn: 最大 64 文字の英字、数字、またはハイフン (-)。 Default: UserGroup AllowedPattern: ^[a-zA-Z0-9\-]+$ MinLength: 1 MaxLength: 64 GroupName2: Type: String Label: en: Group 2 Name zh-cn: グループ 2 名 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: ユーザーグループ 2 の名前です。<br/>最大 64 文字の英字、数字、またはハイフン (-) を含むグループ名を指定します。 ConstraintDescription: en: No more than 64 characters, letters, digits, or hyphens (-). zh-cn: 最大 64 文字の英字、数字、またはハイフン (-)。 Default: AdminGroup AllowedPattern: ^[a-zA-Z0-9\-]+$ MinLength: 1 MaxLength: 64 UserName: Type: String Label: en: User Name zh-cn: ユーザー名 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: ユーザー名は既存のものと重複できません。<br/>英字、数字、ピリオド (.)、アンダースコア (_)、またはハイフン (-) を含めることができ、64 文字を超えてはなりません。 ConstraintDescription: en: No more than 64 characters, letters, digits, or hyphens (-). zh-cn: 最大 64 文字の英字、数字、またはハイフン (-)。 Default: test-user AllowedPattern: '[a-zA-Z0-9\.\-\_]+$' MinLength: 1 MaxLength: 64 UserPassword: Type: String Label: en: User Password zh-cn: ユーザーパスワード 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: パスワード強度要件を満たすパスワードを指定します。<br/>パスワード強度ポリシーの詳細については、<a href='https://www.alibabacloud.com/help/document_detail/28740.html' target='_blank'><b><font color='blue'>GetPasswordPolicy</font></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:エラスティックコンピューティング:異なるポリシーを持つユーザーグループのユーザーを作成 <br/>
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "サブアカウントを作成し、ユーザーグループと管理者グループに割り当て、ログインを有効にし、AccessKey を生成し、ECS と 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": "グループ 1 名"
      },
      "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": "ユーザーグループ 1 の名前です。
最大 64 文字の英字、数字、またはハイフン (-) を含むグループ名を指定します。" }, "ConstraintDescription": { "en": "No more than 64 characters, letters, digits, or hyphens (-).", "zh-cn": "最大 64 文字の英字、数字、またはハイフン (-)。" }, "Default": "UserGroup", "AllowedPattern": "^[a-zA-Z0-9\\-]+$", "MinLength": 1, "MaxLength": 64 }, "GroupName2": { "Type": "String", "Label": { "en": "Group 2 Name", "zh-cn": "グループ 2 名" }, "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": "ユーザーグループ 2 の名前です。<br/>最大 64 文字の英字、数字、またはハイフン (-) を含むグループ名を指定します。" }, "ConstraintDescription": { "en": "No more than 64 characters, letters, digits, or hyphens (-).", "zh-cn": "最大 64 文字の英字、数字、またはハイフン (-)。" }, "Default": "AdminGroup", "AllowedPattern": "^[a-zA-Z0-9\\-]+$", "MinLength": 1, "MaxLength": 64 }, "UserName": { "Type": "String", "Label": { "en": "User Name", "zh-cn": "ユーザー名" }, "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": "ユーザー名は既存のものと重複できません。<br/>英字、数字、ピリオド (.)、アンダースコア (_)、またはハイフン (-) を含めることができ、64 文字を超えてはなりません。" }, "ConstraintDescription": { "en": "No more than 64 characters, letters, digits, or hyphens (-).", "zh-cn": "最大 64 文字の英字、数字、またはハイフン (-)。" }, "Default": "test-user", "AllowedPattern": "[a-zA-Z0-9\\.\\-\\_]+$", "MinLength": 1, "MaxLength": 64 }, "UserPassword": { "Type": "String", "Label": { "en": "User Password", "zh-cn": "ユーザーパスワード" }, "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": "パスワード強度要件を満たすパスワードを指定します。<br/>パスワード強度ポリシーの詳細については、<a href='https://www.alibabacloud.com/help/document_detail/28740.html' target='_blank'><b><font color='blue'>GetPasswordPolicy</font></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:エラスティックコンピューティング:異なるポリシーを持つユーザーグループのユーザーを作成" ] } } }

その他の例については、「このリソースを含むパブリックテンプレート」をご参照ください。