Skip to content

Instantly share code, notes, and snippets.

@chris
Created May 3, 2021 03:53
Show Gist options
  • Save chris/aee11705308b7329ddc3a39e5cd5758d to your computer and use it in GitHub Desktop.
Save chris/aee11705308b7329ddc3a39e5cd5758d to your computer and use it in GitHub Desktop.
Cognito user pool authorizer definition in Serverless Framework
functions:
myfunc:
handler: bin/myhandler
events:
- http:
path: myapipath
method: get
authorizer:
type: COGNITO_USER_POOLS
authorizerId:
Ref: MyAppAPIAuthorizer
resources:
Resources:
MyAppAPIAuthorizer:
Type: AWS::ApiGateway::Authorizer
Properties:
AuthorizerResultTtlInSeconds: 300
AuthType: String
IdentitySource: method.request.header.Authorization
Name: MyAppAPIAuthorizer
ProviderARNs:
- Fn::GetAtt: [MyUserPool, Arn]
RestApiId:
Ref: ApiGatewayRestApi
Type: COGNITO_USER_POOLS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment