# Is it wrong that how to attach IAM Role to Lambda on the page "AWS Lambda Guide - IAM"?

**URL:** <https://forum.serverless.com/t/is-it-wrong-that-how-to-attach-iam-role-to-lambda-on-the-page-aws-lambda-guide-iam/12068>\
**Category:** Serverless Framework\
**Tags:** aws, lambda, iam\
**Created:** [July 21, 2020, 7:26am UTC](https://forum.serverless.com/t/is-it-wrong-that-how-to-attach-iam-role-to-lambda-on-the-page-aws-lambda-guide-iam/12068 "2020-07-21T07:26:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ichoss](https://avatars.discourse-cdn.com/v4/letter/i/43a26b/32.png) [@ichoss](https://forum.serverless.com/u/ichoss)\
**Post date:** [July 21, 2020, 7:26am UTC](https://forum.serverless.com/t/is-it-wrong-that-how-to-attach-iam-role-to-lambda-on-the-page-aws-lambda-guide-iam/12068/1 "2020-07-21T07:26:24Z")

</div>

Is it wrong that how to attach IAM Role to Lambda on the section _Custom IAM Roles_ on the page [AWS Lambda Guide - IAM](https://www.serverless.com/framework/docs/providers/aws/guide/iam/)?

I doubt following sentence is wrong.

> The `role` attribute can have a value of the logical name of the role, the ARN of the role, or an object that will resolve in the ARN of the role.

When I defined on `serverless.yml` as follows, an error occurred.

```yaml
...
functions:
  func:
    role: customRole
resources:
  Resources:
    customRole:
      Type: AWS::IAM::Role
      Properties:
        Path: /my/cust/path/
        RoleName: CustomRole
...

```

But when I defined on `serverless.yml` as follows, an error does **NOT** occurred.

```yaml
...
functions:
  func:
    role: !GetAtt customRole.Arn
resources:
  Resources:
    customRole:
      Type: AWS::IAM::Role
      Properties:
        Path: /my/cust/path/
        RoleName: CustomRole
...

```

Therefore, I doubt that the `role` attribute can **NOT** have a value of the logical name of the role.
