how can we set/assign name of any IAM role while creating an IAM role with cloudformation
. Say i want to create an IAM
role with name NewRole
, using cloudformation script, but i cant find any parameter in resource declaration for IAM role, where we can define name of the IAM role to be created.
Asked
Active
Viewed 4,032 times
2

Hardeep Singh
- 374
- 4
- 11
2 Answers
4
Simply provide the RoleName
(AWS docs) attribute on your role declaration.
yaml:
RoleLogicalId:
Type: "AWS::IAM::Role"
Properties:
RoleName: String
[...]
Note that the documentation contains warnings and notes the consequences of using this attribute.
p.s. @dsmsk80 was correct but this was changed.

Erik Erikson
- 156
- 2
1
IAM role name is not possible to set from CloudFormation template. But you know how it is formatted when the stack and related role resource is created:
CFStackName-CFIAMRoleResourceName-RandomString

dsmsk80
- 5,757
- 17
- 22
-
can't we define IAM role name by defining Role ARN parameter ?.. – Hardeep Singh Dec 28 '15 at 18:29