Skip to content
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

handling terminated EC2 instances in up command #60

Open
hiroTochigi opened this issue Aug 1, 2024 · 0 comments
Open

handling terminated EC2 instances in up command #60

hiroTochigi opened this issue Aug 1, 2024 · 0 comments

Comments

@hiroTochigi
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant