I'm using the serverless framework and I need to override some default values for the UserPool created by the Lambda function. What's the correct way to do it?
My serverless.yml
is creating two user-pool
(same name), one for the lambda function and another for the UserPool
resource:
service: userpool
custom:
stage: dev
poolName: user-pool
provider:
name: aws
runtime: nodejs6.10
stage: ${opt:stage, self:custom.stage}
functions:
preSignUp:
handler: handler.preSignUp
events:
- cognitoUserPool:
pool: ${self:custom.poolName}
trigger: PreSignUp
resources:
Resources:
UserPool:
Type: "AWS::Cognito::UserPool"
Properties:
UserPoolName: ${self:custom.poolName}
AliasAttributes:
- email
AutoVerifiedAttributes:
- email
Schema:
- Name: name
AttributeDataType: String
Mutable: true
Required: true
- Name: email
AttributeDataType: String
Mutable: false
Required: true
As per the Serverless documentation in https://serverless.com/framework/docs/providers/aws/guide/resources/#aws---resources
If you have created a Cognito User Pool resource which follows this format CognitoUserPool{normalizedPoolId}, you can give the normalizedPoolId for each of your lambda functions.
In your case you have defined the Cognito User Pool as "CognitoUserPoolTestPool" which allows you to use TestPool in your lambdas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With