15

我创建了一个 CloudFormation 模板,并且我想创建 IAM 用户,为此我使用了这个 JSON 字符串:

"CFNUser" : {
  "Type" : "AWS::IAM::User",
  "Properties" : {
    "LoginProfile": {
      "Password": { "Ref" : "AdminPassword" }
    }
  }
},

然后对于我使用的组:

"CFNUserGroup" : {
  "Type" : "AWS::IAM::Group"
},

创建堆栈后,我得到以下信息:

用户名 - IAMUsers-CFNUser-E1BT342YK7G6

组名 - IAMUsers-CFNUserGroup-1UBUBRYALTIMI

所以我的问题是,如何在这里设置用户名?组名也一样?

4

3 回答 3

20

After talking with one of the AWS support, at this time of writing, it is not possible to specify your own username and group name in IAM using CloudFormation template :-(

Maybe there's a reason why they do not allow user to do this...anyway it's good thing that I have answer to this question and I will be glad if someone find this useful.

于 2013-04-27T16:16:05.397 回答
4

亚马逊从 2016 年 7 月 20 日起增加了支持。 https://aws.amazon.com/about-aws/whats-new/2016/07/aws-cloudformation-adds-support-for-aws-iot-and-additional-updates /

{
  "Type": "AWS::IAM::User",
  "Properties": {
    "Groups": [ String, ... ],
    "LoginProfile": LoginProfile Type,
    "ManagedPolicyArns": [ String, ... ],
    "Path": String,
    "Policies": [ Policies, ... ],
    "UserName": String
  }
}
于 2016-07-21T09:00:08.873 回答
2

对于组,它是 GroupName 属性:

    "CFNUserGroup" : {
       "Type" : "AWS::IAM::Group",
       "Properties": {
          "GroupName": "My_CFN_User_Group"
        }
     }

于 2018-02-25T23:40:07.033 回答