# User Pool Authorizer from Resource?

**URL:** <https://forum.serverless.com/t/user-pool-authorizer-from-resource/5821>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [September 17, 2018, 11:01am UTC](https://forum.serverless.com/t/user-pool-authorizer-from-resource/5821 "2018-09-17T11:01:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrNiels](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/drniels/32/2550_2.png) [@DrNiels](https://forum.serverless.com/u/DrNiels)\
**Post date:** [September 17, 2018, 11:01am UTC](https://forum.serverless.com/t/user-pool-authorizer-from-resource/5821/1 "2018-09-17T11:01:14Z")

</div>

Hi,

I’m creating an AWS UserPool in my serverless.yml. I want to use that user pool for authorization on some endpoints. I can easily do that by setting the authorizer to the ARN of the generated user pool, but then I need to check for the ARN beforehand.

Can I somehow set the authorizer by the resource name, e.g.,

> ```
> authorizer:
> Ref: CognitoUserPoolMyUserPool
> 
> ```

or something similar?

---

<div class="post-metadata">

**Author:** ![DrNiels](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/drniels/32/2550_2.png) [@DrNiels](https://forum.serverless.com/u/DrNiels)\
**Post date:** [January 21, 2019, 1:46pm UTC](https://forum.serverless.com/t/user-pool-authorizer-from-resource/5821/2 "2019-01-21T13:46:19Z")

</div>

Hi, I’d like to come back to this topic, since I do not have a solution yet and would assume, that this is possible but out of my knowledge. I currently create my lambda functions like this:

```
my-function:
  handler: functions/handler.my_function
  package:
    individually: true
    include:
      - functions/handler.js
  events:
    - http:
        path: /function
        method: get
        cors: true
        authorizer:
          arn: arn:aws:cognito-idp:eu-west-1:123456789:userpool/eu-west-1_xxxxxxxxx

```

Problem is, when I create a new userpool for some reason, like changing the name, I need to update the ARN and so on. So, how can I reference the userpool that I created within the very same serverless.yml as authorizer?

Thanks a lot for anyone helping!

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [January 30, 2019, 5:41am UTC](https://forum.serverless.com/t/user-pool-authorizer-from-resource/5821/3 "2019-01-30T05:41:09Z")

</div>

You need to use GetAtt instead of Ref.

[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html)

For example `!GetAtt [CognitoUserPoolMyUserPool, Arn]`
