Skip to content

What is the expected lifetime of cfg and svc instances? #2566

Answered by lucix-aws
mattjohnsonpint asked this question in Q&A
Discussion options

You must be logged in to vote

Is the cost of creating them is small or large? Is it even worth reusing them?

I would classify service clients as rather lightweight in this SDK. That said you do generally want to keep client instances around simply because of credential provision. If you're on a platform like EC2 or EKS, where credential provision requires network calls, you can save repeated instances of those calls because the client will cache credentials until they expire. This is not a hard rule though, just know that this is something to consider.

Are there any thread safety issues with multiple goroutines using the same svc instance?

No - we explicitly designate clients to be goroutine-safe

Does either the …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mattjohnsonpint
Comment options

Answer selected by mattjohnsonpint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants