awslabs / service-workbench-on-aws

A platform that provides researchers with one-click access to collaborative workspace environments operating across teams, universities, and datasets while enabling university IT stakeholders to manage, monitor, and control spending, apply security best practices, and comply with corporate governance.
Apache License 2.0
177 stars 119 forks source link

[Misc] EC2-RStudio-Server 1.4.1717 is not compatible with new versions of SWB #1146

Closed BoPeng closed 1 year ago

BoPeng commented 1 year ago

Describe the bug When starting a workspace with EC3-RStudio-Server 1.4.1717 from AWS Marketplace, it fails with an error message for missing parameter IsAppStreamEnabled.

To Reproduce Steps to reproduce the behavior:

  1. Go to AWS Marketplace, subscribe the EC2-RStudio-Server
  2. Copy to Service Catalog, fix a version description bug (#1143 ) and import RStudio Server
  3. Create a configuration, create a workspace

Expected behavior RStudio should start, but it fails with missing parameter for cloudformation

Screenshots

image

Versions (please complete the following information):

Additional context

This is a known problem with a PR on https://github.com/RLOpenCatalyst/Service_Workbench_Templates/pull/6. It should have been fixed on https://github.com/RLOpenCatalyst/Service_Workbench_Templates but the version from AWS Marketplace.

maghirardelli commented 1 year ago

Hi @BoPeng !

Thanks for asking about this! We love to hear you're customizing workspace types! When you do this, you will probably have to customize the template of the product you bring into Service Catalog with some custom parameters Service Workbench will assume the imported SC products have. These parameters are used by Service Workbench services to support our functionality. I'd recommend referencing the existing SWB-provided templates for guidance on how to use these parameters, but what you do with them is up to your design. From looking at the templates, and your error, you need to add:

EgressStoreIamPolicyDocument:
    Type: String
    Description: The IAM policy for launched workstation to access egress store
SolutionNamespace:
  Type: String
  Description: The namespace value provided when onboarding the Member account
IsAppStreamEnabled:
  Type: String
  AllowedValues: [true, false]
  Description: Is AppStream enabled for this workspace

Further, this is not a bug as it is a customization of the product and it is expected to behave like this if the template is not set up correctly in a compatible way.

I'll change this to a customer-inquiry and let us know how it goes!

Thanks, Marianna

BoPeng commented 1 year ago

Thanks for the help. after adding the parameters to the original template (convert from JSON to YML), I can now start rstudio. However, there is no "connect" button showing how to connect so I will have to learn how to connect to this instance.

image

For future reference, the updated template is

AWSTemplateFormatVersion: '2010-09-09'
Description: AWS CloudFormation base Template for EC2 AMI launching.
Parameters:
  KeyName:
    Description: Name of an existing EC2 KeyPair to enable SSH access to the web server
    Type: AWS::EC2::KeyPair::KeyName
    ConstraintDescription: must be the name of an existing EC2 KeyPair.
  InstanceType:
    Description: WebServer EC2 instance type
    Type: String
    AllowedValues:
    - t2.large
    ConstraintDescription: must be a valid EC2 instance type.
  SolutionNamespace:
    Type: String
    Description: The namespace value provided when onboarding the Member account
  IsAppStreamEnabled:
    Type: String
    AllowedValues: [true, false]
    Description: Is AppStream enabled for this workspace
  EgressStoreIamPolicyDocument:
    Type: String
    Description: The IAM policy for launched workstation to access egress store
  VPC:
    Description: The VPC to deploy into
    Type: AWS::EC2::VPC::Id
  SubnetID:
    Type: AWS::EC2::Subnet::Id
    Description: Id of an existing subnet (for the primary network) in your Virtual
      Private Cloud (VPC)
    ConstraintDescription: Must be an existing subnet in the selected Virtual Private
      Cloud.
  SecurityGroup:
    Type: AWS::EC2::SecurityGroup::Id
    Description: Id of an existing security group (for the primary network) in your
      Virtual Private Cloud (VPC)
    ConstraintDescription: Must be an existing security group in the selected Virtual
      Private Cloud.
  Architectures:
    Description: Instance instruction set architecture
    Type: String
    AllowedValues:
    - x86-64
Mappings:
  Architectures:
    x86-64:
      Name: ami-02b697751b86204b5
Resources:
  EC2Instance:
    Type: AWS::EC2::Instance
    Properties:
      KeyName:
        Ref: KeyName
      InstanceType:
        Ref: InstanceType
      ImageId:
        Fn::FindInMap:
        - Architectures
        - Ref: Architectures
        - Name
      NetworkInterfaces:
      - DeviceIndex: '0'
        GroupSet:
        - Ref: SecurityGroup
        SubnetId:
          Ref: SubnetID
Outputs:
  InstanceName:
    Value:
      Ref: EC2Instance
    Description: EC2 instance name
  PublicDNSName:
    Value:
      Fn::GetAtt:
      - EC2Instance
      - PublicDnsName
    Description: DNS Name of the newly created EC2 instance
maghirardelli commented 1 year ago

Awesome! Thanks for sending back the template that works!

For the connection, there may be some branching code that controls if the button appears on the Environment Card. I'd take a look at these UI components for the Service Catalog Environments.

Let us know how it goes!

Thanks, Marianna

BoPeng commented 1 year ago

I have since switched to building the latst RStudio server using packer, instead of using the outdated version from AWS Marketplace.