If an Instance_id is passed and it is invalid (e.g., the instance does not exist, has been terminated, or the Instance_id format is incorrect), the process currently fails and stops execution.
Scenarios Where This Might Occur:
A previously created instance has been terminated or deleted but its Instance_id is still referenced.
An incorrectly formatted or non-existent Instance_id is passed.
The Instance_id belongs to a different region than the one the API is targeting.
Steps to Reproduce:
Pass an invalid Instance_id to an API call.
Observe the process halt due to an error response from the API.
Expected Behavior:
The system should catch the error if the Instance_id is invalid.
The error should be logged with sufficient details (e.g., invalid ID, reason for failure).
The script should skip the invalid Instance_id and continue with other valid instances.
Possible Solutions:
Implement try-catch (or equivalent) error handling for operations involving Instance_id.
When an invalid Instance_id is detected, log the error, and move on to the next instance.
Ensure that the error handling works across different operations (e.g., start, stop, terminate, etc.).
Relevant Code/Section:
Add error handling to the get_instance_details EC2 API
Description:
If an
Instance_id
is passed and it is invalid (e.g., the instance does not exist, has been terminated, or theInstance_id
format is incorrect), the process currently fails and stops execution.Scenarios Where This Might Occur:
Instance_id
is still referenced.Instance_id
is passed.Instance_id
belongs to a different region than the one the API is targeting.Steps to Reproduce:
Instance_id
to an API call.Expected Behavior:
Instance_id
is invalid.Instance_id
and continue with other valid instances.Possible Solutions:
Instance_id
.Instance_id
is detected, log the error, and move on to the next instance.Relevant Code/Section:
Add error handling to the
get_instance_details
EC2 API