6

I am using AWS Amplify datastore. App-sync token in internally used by this service. Currently, App-sync token is expired so I changed expired date from Appsync / Settings / API keys. But this allow to edit expired date maximum for next one year.

Is their any why to set token expiry date forever or more then 1 year? because my client don't want that after one year we need to again change expiry date.

1 Answers1

7

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.

You can extend the expiry of an existing key programatically, but if you try to update the expiry (seconds since epoch) beyond one year, you will get the following error: 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

You could automate key updates with a lambda triggered by an EventBridge cron schedule rule.

fedonev
  • 20,327
  • 2
  • 25
  • 34
  • could you explain me how is the sintax for update the expiration date? I know how to generate the event that trigger the lambda but, inside the lambda how is the sintax – WhiteAB Jun 16 '22 at 18:53
  • 1
    @WhiteAB The SDKs implement the command in the same way. See the [UpdateApiKeyCommand](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-appsync/classes/updateapikeycommand.html) in the JS SDK, for instance. Feel free to ask a new question if you need more help. – fedonev Jun 17 '22 at 06:36