Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

#2: Implemented lifecycle of an EC2 instance #6

Merged
merged 23 commits into from
Jul 13, 2022

Conversation

tomuben
Copy link
Collaborator

@tomuben tomuben commented Jun 16, 2022

fixes #2

@tomuben tomuben temporarily deployed to AWS June 16, 2022 13:01 Inactive
2. moved method STACK_NAME into class CloudFormationStack
@tomuben tomuben temporarily deployed to AWS June 16, 2022 14:34 Inactive
@tomuben tomuben temporarily deployed to AWS June 17, 2022 10:23 Inactive
@tomuben tomuben changed the title #2: Implemented launch of an EC2 instance #2: Implemented lifecycle of an EC2 instance Jun 17, 2022
2. Changed implementation of random_string_generator.py
3. renamed function execute_setup_ec2() => run_lifecycle_for_ec2()
4. minor changes
@tomuben tomuben temporarily deployed to AWS June 20, 2022 05:59 Inactive
@tomuben tomuben temporarily deployed to AWS June 30, 2022 12:56 Inactive
Copy link
Collaborator

@tkilias tkilias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions and thoughts. Should we use aws localstack for testing the aws_access class. And can we refactor things, such that we have the context manager for keys and cloud formation, but on the other hand, use creation and closing idependently as CLI. Means the create CLI stores everything necessary on disk and close loads this and then closes everything. Reason is, I need the exact functionalities for handling ec2 instances also for GPU tests and development.
Another question, could we add the Key creation into the cloud formation template.

test/test_key_file_manager.py Outdated Show resolved Hide resolved
@tomuben
Copy link
Collaborator Author

tomuben commented Jul 4, 2022

Another question, could we add the Key creation into the cloud formation template.

It is possible, see here, but I there are a few reasons to not do this:

  1. For some cases (maybe debugging/tests) we might want to use an existing KeyPair. In order to implement that we would have to assemble the cloudformation yaml file dynamically, which makes the code more difficult.
  2. We still need to get access to the private key of the Keypair. I assume the best way would be to write the private key to a temporary file (as we do now). Then the management of the lifecycle of this file would become independent of the lifecycle of the KeyPair (which is managed within the lifecycle of the cloudformation stack)
  3. The code to get access to the private key is not much easier: First one has to find the Key-Id, and after that use AWS SSM to get the value of the private key.

@tomuben
Copy link
Collaborator Author

tomuben commented Jul 4, 2022

And can we refactor things, such that we have the context manager for keys and cloud formation, but on the other hand, use creation and closing idependently as CLI. Means the create CLI stores everything necessary on disk and close loads this and then closes everything. Reason is, I need the exact functionalities for handling ec2 instances also for GPU tests and development.

Of, course, I am happy if the code will be reused. But the question is if you want to use it from within Python code, or via CLI. Let's discuss offline.

@tomuben tomuben temporarily deployed to AWS July 4, 2022 14:43 Inactive
@tomuben tomuben temporarily deployed to AWS July 5, 2022 15:01 Inactive
@tomuben tomuben temporarily deployed to AWS July 5, 2022 17:17 Inactive
@tomuben
Copy link
Collaborator Author

tomuben commented Jul 5, 2022

Should we use aws localstack for testing the aws_access class.

I added new tests which use localstack. However I realized that localstack simply mocks many things. It's not possible to test error scenarios (e.g. verify that a client error is thrown when a cloudformation stack is being accessed after it has been deleted).

@tomuben tomuben temporarily deployed to AWS July 8, 2022 14:03 Inactive
@tomuben tomuben temporarily deployed to AWS July 8, 2022 16:35 Inactive
test/test_serialization.py Outdated Show resolved Hide resolved
2. For EC2 Key use full uuid string
3. For Cloudformation stack check if stack name exists
@tomuben tomuben temporarily deployed to AWS July 11, 2022 18:27 Inactive
@tomuben tomuben temporarily deployed to AWS July 12, 2022 16:48 Inactive
@tomuben tomuben temporarily deployed to AWS July 12, 2022 17:02 Inactive
@tomuben tomuben temporarily deployed to AWS July 13, 2022 13:12 Inactive
exasol_script_languages_developer_sandbox/lib/cf_stack.py Outdated Show resolved Hide resolved
test/test_serialization.py Show resolved Hide resolved
test/test_serialization.py Show resolved Hide resolved
@tomuben tomuben temporarily deployed to AWS July 13, 2022 13:46 Inactive
test/test_serialization.py Outdated Show resolved Hide resolved
test/test_serialization.py Outdated Show resolved Hide resolved
@tomuben tomuben temporarily deployed to AWS July 13, 2022 14:14 Inactive
@tomuben tomuben merged commit beea108 into main Jul 13, 2022
@tomuben tomuben deleted the feature/2_implement_launch_of_an_ec2_instance branch July 13, 2022 14:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement launch of an EC2 instance
2 participants