-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New AWS client #7240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New AWS client #7240
Conversation
Co-authored-by: Viren Nadkarni <viren.nadkarni@localstack.cloud>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! let's get it over the line :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't look in detail over the tests, but rest LGTM 👍
localstack/aws/connect.py
Outdated
""" | ||
TODO | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""" | |
TODO | |
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, forgot about that thing. Will add a description!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_stack
to 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,
dynamodblocal
orkinesis-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
InternalClientFactory
Scenario 5-6 will be taken care of by the
ExternalClientFactory
Sample 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_stack
functionality: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