gpt4 book ai didi

aws-cloudformation - 将 Lambda 触发器附加到 Cloudformation 中的 Cognito 用户池

转载 作者:行者123 更新时间:2023-12-03 07:14:16 26 4
gpt4 key购买 nike

我希望自定义当您调用 adminCreateUser() 时 Cognito 发送给新用户的电子邮件

我可以看到您通过 Lambda 函数执行此操作,例如 -

https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html

exports.handler = (event, context, callback) => {
if(event.userPoolId === "theSpecialUserPool") {
if(event.triggerSource === "CustomMessage_AdminCreateUser") {
event.response.smsMessage = "Welcome to the service. Your user name is " + event.request.usernameParameter + " Your temporary password is " + event.request.codeParameter;
event.response.emailSubject = "Welcome to the service";
event.response.emailMessage = "Welcome to the service. Your user name is " + event.request.usernameParameter + " Your temporary password is " + event.request.codeParameter;
}
}
callback(null, event);
};

我还可以看到 AWS::Cognito::UserPool 有一个 LambdaConfig 对象,以及一个 CustomMessage 字段

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-lambdaconfig.html

看起来这就是附着点:)

但是我看不到精确的附件机制:(

CustomMessage 字段定义很神秘 -

CustomMessage

A custom Message AWS Lambda trigger.

Required: No
Type: String
Minimum: 20
Maximum: 2048
Pattern: arn:[\w+=/,.@-]+:[\w+=/,.@-]+:([\w+=/,.@-]*)?:[0-9]+:[\w+=/,.@-]+(:[\w+=/,.@-]+)?(:[\w+=/,.@-]+)?

Update requires: No interruption

即它只是一个字符串 - 但这是字符串

  • ARN
  • 引用
  • 内联 Lambda 主体声明?

有人知道 LambdaConfig.CustomMessage 绑定(bind)支持上述哪种格式吗?

最佳答案

根据 CustomMessage 字符串值的验证模式,它看起来支持 ARN,因为该字符串必须包含 arn

关于aws-cloudformation - 将 Lambda 触发器附加到 Cloudformation 中的 Cognito 用户池,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65469675/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com