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.
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.
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:
CloudFormation AWS::IAM::Role resource documentation