# Reference AWS ParallelCluster v3 configuration for LigandScout Remote.
#
# Replace every REPLACE_ME value, then create the cluster with:
#
#   pcluster create-cluster --cluster-name my-cluster \
#       --cluster-configuration cluster-config.yaml
#
# Documentation: https://docs.inteligand.com/ls-remote/working-with-aws/

# The region this cluster is built in. This setting overrides the default region
# you set with `aws configure`, so it must match the region your key pair and
# subnet live in. Examples: eu-central-1, us-east-2, sa-east-1.
Region: REPLACE_ME

Image:
  # Ubuntu 22.04 is the operating system Inte:Ligand tests against.
  Os: ubuntu2204

HeadNode:
  # The head node runs iserver and the Slurm controller. It does no screening
  # itself, so a small instance is enough.
  InstanceType: t3.large

  Networking:
    # A public subnet. Placing compute nodes in a private subnet instead would
    # require a NAT gateway, which bills by the hour whether or not you run jobs.
    SubnetId: subnet-REPLACE_ME
    ElasticIp: true

  Ssh:
    # The EC2 key pair you created in the AWS console. You need the matching
    # .pem file both for `pcluster ssh` and for connecting from LigandScout-XT.
    KeyName: REPLACE_ME

  LocalStorage:
    RootVolume:
      Size: 50

  CustomActions:
    OnNodeConfigured:
      # Installs LigandScout-XT and iserver onto the shared volume and starts
      # iserver as a systemd service.
      Script: https://docs.inteligand.com/ls-remote/aws/bootstrap-iserver.sh
      Args:
        # Your LigandScout serial number. LigandScout-XT activates itself with
        # it on first use.
        - "REPLACE_ME"
        # Optional: pin different LigandScout-XT and iserver archives by adding
        # their URLs as a second and third argument.

Scheduling:
  Scheduler: slurm

  SlurmSettings:
    # Minutes an idle compute node stays up before it is terminated.
    ScaledownIdletime: 5

  SlurmQueues:
    - Name: compute
      # Switch to SPOT for up to 90% lower compute cost. Screening and conformer
      # generation sub-jobs can be restarted individually, so an interrupted
      # node costs you one sub-job rather than the whole run.
      CapacityType: ONDEMAND

      Networking:
        # Note the plural: compute queues take a list, unlike the head node.
        SubnetIds:
          - subnet-REPLACE_ME
        # Compute nodes need outbound internet access to fetch their own
        # bootstrap data and to activate LigandScout. Subnets do not always
        # auto-assign public IPs, so request one explicitly.
        AssignPublicIp: true

      ComputeResources:
        - Name: screening
          InstanceType: c6i.2xlarge
          # MinCount 0 means you pay for compute only while jobs are running.
          MinCount: 0
          MaxCount: 10

SharedStorage:
  # Mounted on every node as /shared. The bootstrap script installs
  # LigandScout-XT and iserver here, and screening databases and job results
  # live here too. Size it for the databases you intend to use.
  - Name: shared
    MountDir: /shared
    StorageType: Ebs
    EbsSettings:
      Size: 200
      VolumeType: gp3
      # This volume and everything on it is destroyed together with the cluster.
      # Set to Retain if you would rather keep it.
      DeletionPolicy: Delete
