Conversation
thrau
left a comment
There was a problem hiding this comment.
this looks pretty good to me now! i like the fact that we have a single abstraction for creating clients, that we can easily replace/extend.
i'd like to get @dfangl and @dominikschubert to give feedback on this. we can get it over the line while @viren-nadkarni is OOO
Co-authored-by: Viren Nadkarni <viren.nadkarni@localstack.cloud>
thrau
left a comment
There was a problem hiding this comment.
looks great! let's get it over the line :-)
dominikschubert
left a comment
There was a problem hiding this comment.
Didn't look in detail over the tests, but rest LGTM 👍
| """ | ||
| TODO | ||
| """ |
There was a problem hiding this comment.
| """ | |
| TODO | |
| """ |
There was a problem hiding this comment.
Ah yes, forgot about that thing. Will add a description!
alexrashed
left a comment
There was a problem hiding this comment.
This is great! The scenarios make it easier to think about the different ways of connecting two services, the typing will be great, and the tests are getting more and more extensive! 🚀
I only have a few smaller questions and comments (which in turn are mostly about comments in the code)...
alexrashed
left a comment
There was a problem hiding this comment.
Thanks for fixing all my pedantic and nitpicky comments! Great to see this new client being merged, this will change the way LocalStack services communicate with each other quite substantially! 🚀
Summary
The new AWS API client stack with support for sending additional metadata for internal calls.
We want to gradually move all functionality and use of
aws_stackto this and remove it.Supported Scenarios
Our new AWS client factory needs to take different scenarios of usage into account.
Scenarios
Internal Hidden
Request which either AWS does not do, or does not document in any way. Used for LS workarounds or completely hidden calls.
❌ CloudTrail
❌ IAM Enforcement
✔️ In Memory Possible
Internal as Service
Call of a service to another service as that service principal. Usually has a sourcearn of the resource on which behalf the request was made.
✔️ CloudTrail
✔️ IAM Enforcement
✔️ In memory possible
Internal as Role
Call of a service which assumed a provided role (assumption is enforced via “Internal as Service` itself) beforehand, as that role.
✔️ CloudTrail
✔️ IAM Enforcement
✔️ In memory possible
Internal as calling User
According to @dominikschubert this is the case for some CloudFormation functionality. Basically, CloudFormation does requests on behalf of the user which created the stack.
✔️ CloudTrail
✔️ IAM Enforcement
✔️ In memory possible
External for third-party providers
Used for communication to provider backends outside of our control. For example,
dynamodblocalorkinesis-mock.❌ CloudTrail
❌ IAM Enforcement
❌ In memory possible
External for testing
Used by testing clients to test our resources using boto3.
✔️ CloudTrail
✔️ IAM Enforcement
❌ In memory possible
Factories
This PR provides two subtypes of client factories.
Scenario 1-4 will be taken care of by the
InternalClientFactoryScenario 5-6 will be taken care of by the
ExternalClientFactorySample usage
Calls made from outside of LocalStack (eg. in integration tests etc.)
Calls made internally across services
Performance
New client clocks faster for equivalent
aws_stackfunctionality:Other notes
Created by a mob programming session by @alexrashed @dominikschubert @simonrw @thrau @viren-nadkarni @dfangl
Sample use in DynamoDB: aws-client...aws-client-dynamodb
Tests
Unit tested, against a fake Gateway with the real handlers.
The unit tests aim to test the above mentioned scenarios, even though there is some duplication.
Some of the unit tests will in the next iteration be used to check some "convenience utilities", like creating a client directly for a to-be-assumed role, etc.
Potential future use for test clients:
Future work