-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
refactor: faster EC2 instance search #535
Conversation
@glasswalk3r Thank you for your commitment! I like the idea of verifying what can be verified in advance before the API call. But if this change is introduced, it appears that if there is a change in the format of the resource ID ( for example, prefix change I think the test code should run as stably as possible. |
Hi @k1LoW , You're right, there is a tradeoff. Unfortunately, there is no way to get to know the format dynamically, only to check if your account has migrated or not to the latest format. On the other hand, it could take years from now for AWS to change that again (if it will ever happen) and that would probably be a planned modification, with customer being notified well before the change is applied to avoid breaking compatibility. The instance ID is already at the second generation, no way to predict if it is going to change again or not. The only way I see to implement compatibility with the old way of What do you think? |
I think the test code should run as stably as possible. In other words, we believe that stability is better than expansion for faster performance. |
Understood @k1LoW ! It would not only keep things working as expected, but giving us a proper warning that something changed regarding the instance ID format. |
@glasswalk3r Thank you !!! Great ! |
Released as v1.24.4. |
Based on available documentation, this PR introduces some assertions to check if the
id
parameter has the expected format of a instance id.If does, than an attempt to find the instance is attempted, just like the original code.
If the
id
has not a instance id expected format, than an attempt with a tag name is attempted instead, avoiding an API request that would probably fail anyway.