Aws AppSync 令牌到期日期

Aws AppSync token expiry date

我正在使用 AWS Amplify 数据存储。此服务内部使用的应用程序同步令牌。目前,App-sync 令牌已过期,因此我从 Appsync / Settings / API keys 更改了过期日期。但这允许编辑下一年的最大过期日期。

他们为什么要将令牌有效期设置为永远或超过 1 年?因为我的客户不希望一年后我们需要再次更改到期日期。

AppSync API key docs: API keys are configurable for up to 365 days, and you can extend an existing expiration date for up to another 365 days from that day.

您可以通过编程方式 extend the expiry 现有密钥,但如果您尝试更新超过一年的到期时间(自纪元以来的秒数),您将收到以下错误:The API key expiration must be set to a value between 1 and 365 days.

aws appsync update-api-key --api-id xxxxxxxx --id da2-xxxxxxxx --expires 1669880629

您可以使用由 EventBridge cron schedule rule 触发的 lambda 自动更新密钥。