Whats the purpose of the ctx context.Context
parameter for config.LoadDefaultConfig
#2786
-
Does this need to be a request scoped context? All the examples i have found in documents show either We are utilizing https://github.com/aws/aws-lambda-go and are trying to figure out if the context we pass to the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hello @tomHaum, Thanks for reaching out. To clarify the context handling in your Lambda function: Do let me know if you have any questions. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hello @tomHaum Thanks for explaining.
-Moreover, with respect to your example, the context.Context is only relevant when making the actual DynamoDB API calls, not when setting up the client. Here is an example code :
Thanks, |
Beta Was this translation helpful? Give feedback.
Hello @tomHaum
Thanks for explaining.
The lambda.Start function is used to start a AWS Lambda function handler and the context provided to the Lambda function handler (the one you passing to lambda.Start) contains metadata about the current execution.
Therefore, the context provided to the Lambda function handler does not affect the aws.Config produced by config.LoadDefaultConfig. The context is primarily used for logging,making API calls , etc. within the Lambda function execution , but not for configuring the AWS SDK itself.
-Moreover, with respect to your example, the context.Context is only relevant when making the actual DynamoDB API calls, not when setting up the client.
Here …