Skip to content

handling terminated EC2 instances in up command #60

@hiroTochigi

Description

@hiroTochigi

Description

There are several issues related to the handling of terminated EC2 instances in the up command. The current implementation has the following problems:

  1. Existing Configuration Data:

    • If an EC2 instance is manually terminated, the previous configuration data remains in the Treehouses config. This obsolete data can interfere with the proper functioning of the up command.
  2. Old SSH Tunnel Configuration:

    • The old SSH tunnel configuration file and the obsolete SSH tunnel process may still exist. These remnants prevent the up command from storing new configuration data into the Treehouses config and from controlling the new instance.
  3. Obsolete SSH Tunnel Process:

    • The presence of an obsolete SSH tunnel process can block the command from opening a new SSH tunnel.

Tasks

  1. Clean Up Old Configuration Data:

    • Add logic to the script to clean up any existing configuration data in the Treehouses config related to the terminated instance before storing new configuration data.
  2. Remove Old SSH Tunnel Configuration:

    • Ensure the script removes any old SSH tunnel configuration files and stops any obsolete SSH tunnel processes before opening a new SSH tunnel.
  3. Update Script Logic:

    • Enhance the script to handle these clean-up tasks automatically, ensuring that the up command can store new configuration data, control the new instance, and open a new SSH tunnel without conflicts.

Proposed Solution

Modify the up function in the script to include the following steps:

  1. Check and Remove Old Configuration Data:

    • Before creating a new EC2 instance, check if the instance state is terminated.
    • If the instance state is terminated, remove any existing configuration data in the Treehouses config related to the old instance.
  2. Clean Up Old SSH Tunnel Configurations:

    • Remove any old SSH tunnel configuration files.
    • Stop any obsolete SSH tunnel processes.
  3. Proceed with New Instance Creation:

    • Create the new EC2 instance.
    • Store the new configuration data into the Treehouses config.
    • Open the new SSH tunnel.

This solution will ensure that the up command can handle terminated EC2 instances effectively and avoid conflicts with old configuration data and processes.

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