老布這麼說
Yet another bootstrap theme.
2022-03-28
Read More
2022-03-25
Read More
2022-03-25
Read More
2022-03-17
使用這篇來記錄一下,自己有遇到過的 cognito issue
Issue List
How do I reset a Cognito user’s password that has expired?
- 問題:新建的 user 超過 7 天沒有 login 進去改 password
- error message : Temporary password has expired and must be reset by an administrator.
- 執行的 cmd 範例
aws cognito-idp admin-create-user --region us-east-1 --user-pool-id us-east-1_youruserpoolid --username theusername --message-action RESEND
- resend 後,預設的密碼會改變,要看信件中的 temporary password
- How do I reset a Cognito user’s password that has expired? - Stack Overflow
2022-03-14
HHKB 一直是我心目中想擁有的神器。
這次總算是下定決心,衝了一把 Happy Hacking Keyboard Professional HYBRID Type-S
鍵盤配置參考
Tips
同場加映
Reference
2022-03-10
使用 AWS SES 寄出通知信時,尤其是 gmail 時,會顯示為 via amazonses.com,然後此封 email 會被歸類為 spam
需要設定 DKIM 驗證,來避免此狀況
Reference
- How to prevent from gmail showing via amazonses.com? - MailBluster
- How to Set Up AWS SES and Avoid Spam Folders | by Rob Wilson | AWS in Plain English
- What is a DNS DKIM record? | Cloudflare
- 設定 SPF, DKIM, DMARC Email 驗證解決「Gmail 未經驗證網域」警告 - Soul & Shell Blog
- What is a DNS SPF record? | Cloudflare
同場加映
2022-03-10
使用 cognito 時,通常會想要客制化寄信出來的 message
目前的作法
- 因為需要在寄出來的信件中,顯示相關的 customer attribute,目前找到 & 使用的方式為 trigger lambda 的方式
- 修改 trigger 為 “Custom message”
aws cognito-idp update-user-pool --user-pool-id $POOL_ID --lambda-config CustomMessage="arn:aws:lambda:us-west-2:xxxTest"
- Custom message Lambda trigger - Amazon Cognito
- Customizing user pool workflows with Lambda triggers - Amazon Cognito
- spring - Cognito Customise Messages and Include User Attributes - Stack Overflow AWS console 介面中的 Message customizations Tab 無法設定使用 customer attribute
Reference
- Message Customization on Cognito - DEV Community 主要依照這篇來實作
- Custom message Lambda trigger - Amazon Cognito
- How to custom sender Email/SMS with 3rd party in AWS Cognito – Mr. 沙先生
- Send AWS Cognito emails with 3rd party ESPs
- Creating the CustomSMS Trigger in AWS Cognito using lambda | by Abiral Sthapit | Medium
- python - How to send a custom message for CustomMessage_AdminCreateUser trigger? - Stack Overflow 可以參考 TriggerEnum 的作法
- Authentication with AWS Cognito ⋆ Mark McDonnell 可以參考的 terraform example
2022-03-03
在 AWS 中,所產生的 log 都是會記錄到 cloud-watch 中,所以在產生 mail 通知時,如果能一並建立連結到 cloud-watch 的log,會是滿方便的
產生 url 的過程中,找到 AWS 是將 log_group, log_stream 進行了兩次 encodeURI,然後產生 url 的
可以參考的 python code
`
def get_cloud_watch_search_url(search, log_group, log_stream, region=None,):
“””Return a properly formatted url string for search cloud watch logs
search = "{$.message: "You are amazing"}
log_group = Is the group of message you want to search
log_stream = The stream of logs to search
"""
url = f'https://{region}.console.aws.amazon.com/cloudwatch/home?region={region}'
def aws_encode(value):
"""The heart of this is that AWS likes to quote things twice with some substitution"""
value = urllib.parse.quote_plus(value)
value = re.sub(r"\+", " ", value)
return re.sub(r"%", "$", urllib.parse.quote_plus(value))
bookmark = '#logsV2:log-groups'
bookmark += '/log-group/' + aws_encode(log_group)
bookmark += "/log-events/" + log_stream
bookmark += re.sub(r"%", "$", urllib.parse.quote("?filterPattern="))
bookmark += aws_encode(search)
return url + bookmark
`
Reference
2022-02-23
Read More
2022-02-22
Read More