How do I keep the time in sync in docker based lambda functions

0

I have a lambda using a container based off of the public.ecr.aws/lambda/python:3.9 image and the time is getting out of sync over time. What do I need to install and run so the time gets synced from amazon.pool.ntp.org?

  • Are you using x86 or arm64 for your Lambda function?

hb2638
asked 2 years ago528 views
3 Answers
0
Accepted Answer

It's not clear from the error message which is the timestamp for "now" and which is the timestamp in the signature. Is it possible that the request signature was generated when the function was created; and because the function has been warm for a while that signature has expired? If so, that's not time drift; it means that you'll need to regenerate the signature before calling the service.

profile pictureAWS
EXPERT
answered 2 years ago
0

As a Lambda function runs for 15 minutes maximum, this does not seem a real issue to me. Seems even difficult to notice this. How did you notice the drift?

rik2803
answered 2 years ago
  • I got an error making a boto3 call --> botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the PutLogEvents operation: Signature expired: 20220211T120131Z is now earlier than 20220211T120138Z (20220211T120638Z - 5 min.)

    Also, the lambda doesn't get killed off immediately, it sticks around for an unspecified amount of time to service additional requests. This is to avoid/reduce the number of cold starts.

0

Didn't provide enough info of this but this error was occurring from a Lambda Extension we wrote and this error was a result of a race condition where the extension was "frozen" by AWS between lambda invocations.... and it got frozen after signing a AWS request but before actually sending it out.

hb2638
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions