aws / res

Research and Engineering Studio (RES) is an AWS supported open source product that enables IT administrators to provide an easy-to-use web portal for scientists and engineers to run technical computing workloads on AWS.
https://github.com/aws/res
Apache License 2.0
82 stars 17 forks source link

The Hibernation option is enabled only for Windows and not for other operating systems that support it. #59

Open aosorio-intervision opened 2 months ago

aosorio-intervision commented 2 months ago

Describe the bug According the documentation Amazon Linux 2 (ami-0816b6df20ad41aa6) and Ubuntu 22.04 (ami-02c4430a986b4f2ad) and RHEL 8 (additional configuration is required) AMIs should support hibernation. However, when we attempted to use these AMIs in the RES blue environment, the “Enable Instance Hibernation” option remained grayed out (the same for RHEL). It appears that this option is currently only available when selecting Windows as the OS.

Steps to reproduce Steps to reproduce the behavior:

  1. We ensured that the instance type was Nitro-based (one of the prerequisites for hibernation) and confirmed that the EBS volumes are encrypted by default (another requirement).
  2. We even used the AMIs that support hibernation without additional configuration and the option remains grayed out.
  3. We search in the source repo and we find that in the file virtual-desktop-create-session-form.tsx the option is hardcoded to be enable just for windows and disabled for the rest.

Expected behavior the hibernation option should be enable for all OS by default, as it is in the AWS console when we create an EC2 instance.

Actual behavior It's only allow for Windows OS.

image

Environment (please complete the following information):

RodrigoDiasDeOliveira commented 2 months ago

Whats Up i hpe it can helps you!

To resolve this issue, the hardcoded restriction in the file virtual-desktop-create-session-form.tsx should be modified to enable hibernation for all operating systems that meet the AWS requirements. This will align the behavior of the RES blue environment with AWS's general EC2 instance creation process.

Next Steps: Code Fix: Update the code to check for hibernation support dynamically based on the selected AMI and instance configuration, rather than restricting it to Windows OS. Testing: Test the updated configuration with the supported Linux AMIs to ensure that the hibernation option works as expected across different operating systems. This approach will ensure consistency with AWS's documentation and functionality, improving the user experience in the RES blue environment.

aosorio-intervision commented 2 months ago

Hi @RodrigoDiasDeOliveira , thanks for your response!

I was trying to do it in a local repo, but I am missing an important part. In the documentation is not clear how I can use the code with the CloudFormation template. Do I need to rebuild the ECR image that is pulled from the registry in order to support the Linux Hibernation?

RodrigoDiasDeOliveira commented 3 weeks ago

well bro i sorry for the gap, it seems the issue is related to enabling hibernation for Linux instances in specific AMIs (Amazon Linux 2, Ubuntu 22.04, and RHEL 8) within the RES interface, where the hibernation option is restricted to Windows only. Here’s a guide on the next steps for resolving this:

Next Steps for Resolution Update the Code: In the virtual-desktop-create-session-form.tsx file, hibernation is currently set to be available only for Windows. The solution would be to update the code to check dynamically if the selected AMI and instance configuration support hibernation. This will allow for greater flexibility and alignment with AWS requirements to support Linux.

Test the Updated Configuration: Once the adjustment is made, it’s essential to test hibernation with supported Linux AMIs. Confirm that the instance is Nitro-based and that EBS volumes are encrypted, as these are prerequisites for enabling hibernation.

Using the CloudFormation Template: Your friend mentioned uncertainty about applying the code in the environment using CloudFormation. If the RES environment uses an image from ECR (Elastic Container Registry), it will be necessary to rebuild this image for the updated code to reflect in production. This involves:

Updating the code in the local repository and building the Docker image to include the modification. Pushing the new image to ECR, ensuring the CloudFormation setup references this updated image to implement the changes. Admin Configuration in RES: An administrative setting may be needed to allow users to enable hibernation when launching EC2 through the interface. Check if there are RES configurations to activate this option, as the admin might need to enable hibernation globally.

These steps should help enable hibernation for Linux AMIs, aligning RES behavior with that expected on AWS.