Skip to content

Add handling for when Instance_id is passed, but is Invalid #7

@dheerajoruganty

Description

@dheerajoruganty

Description:

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:

  1. Pass an invalid Instance_id to an API call.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions