您需要使用 boto3 python 库为认知池设置“来自 ARN”。文档中没有任何地方说你必须这样做,但我前段时间在论坛中找到了这个提示,寻找相同的答案。
Cognito 只允许 cognito 使用 SES 的三个区域。如果您的游泳池不在其中之一,您无法匹配它们,并且不应该仅仅为此重新定位游泳池。无论区域匹配似乎都无法从下拉列表中进行选择。
这是我使用过的脚本
import boto3
from pprint import pprint
client = boto3.client("cognito-idp")
import json
pool_id = 'ap-southeast-2_dsfvbGuHU'
pool_config = dict(
UserPoolId=pool_id,
EmailConfiguration={
"SourceArn": "arn:aws:ses:us-west-2:421412422035:identity/example.com",
"ReplyToEmailAddress": "no-reply@example.com",
"EmailSendingAccount": "DEVELOPER",
"From": "no-reply@example.com",
},
AutoVerifiedAttributes=["email"],
VerificationMessageTemplate={
"SmsMessage": "Your verification code is {####}. ",
"EmailMessage": "Your verification code is {####}. ",
"EmailSubject": "Your verification code",
"EmailMessageByLink": "Please click the link below to verify your email address. {##Verify Email##} ",
"EmailSubjectByLink": "Your verification link",
"DefaultEmailOption": "CONFIRM_WITH_CODE",
},
LambdaConfig={
"CustomMessage": "arn:aws:lambda:ap-southeast-2:421084812035:function:sls-repo-dev-cognito-message-service",
"PostAuthentication": "arn:aws:lambda:ap-southeast-2:421084812035:function:sls-repo-dev-cognito-post-auth-service",
"PostConfirmation": "arn:aws:lambda:ap-southeast-2:421084812035:function:sls-repo-dev-cognito-post-confirmation-service",
"PreTokenGeneration": "arn:aws:lambda:ap-southeast-2:421084812035:function:sls-repo-dev-cognito-pretoken-gen-service",
},
)
res = client.update_user_pool(**pool_config)
response = client.describe_user_pool(UserPoolId=pool_id)
pprint(response)
小心使用脚本,因为它可能会覆盖您的某些设置。您可以评论和打印现有配置,以便复制设置。不要忘记您需要 aws CLI 凭据才能运行它