How to set user name and group name in IAM using CloudFormation?

amazon-iam, aws-cloudformation

Solution

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.

Problem

I created a CloudFormation template and I wanted to create IAM user, to do that I used this JSON string: ``` "CFNUser" : { "Type" : "AWS::IAM::User", "Properties" : { "LoginProfile": { "Password": { "Ref" : "AdminPassword" } } } }, ``` Then for group I used this: ``` "CFNUserGroup" : { "Type" : "AWS::IAM::Group" }, ``` After creating the stack, I got the following: user name - IAMUsers-CFNUser-E1BT342YK7G6 group name - IAMUsers-CFNUserGroup-1UBUBRYALTIMI So my question is, how can I set the user name here? same goes for the group name?

Original source