1

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.

3

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.

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

CloudFormation AWS::IAM::Role resource documentation

  • can't we define IAM role name by defining Role ARN parameter ?.. – Hardeep Singh Dec 28 '15 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.