AWS ParallelCluster に既存の FSx for Lustre と EFS をマウントする設定方法の紹介

2022.09.06

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

新規作成するクラスターに既存の FSx for Lustre と EFS をマウントする設定方法の記述の参考例が見つけられませんでした。マウントに成功したクラスターのコンフィグを紹介します。

設定方法早見

  • MountDirのパスはお好みで OK です
  • StorageTypeの指定はEfsFsxLustreの違いがあります
  • Efs or FsxLustreSettingsは見分けが付きにくいので注意
  • FileSystemIdはコピペミスに気をつけてください
    • ID から Lustre なのか、EFS なのか見分けつかないです

config 抜粋

SharedStorage:
  - MountDir: /mnt/efs-01
    Name: efs-single-az
    StorageType: Efs
    EfsSettings:
      FileSystemId: fs-0f1158ade79354809
  - MountDir: /mnt/lustre-01
    Name: fsx-for-lustre
    StorageType: FsxLustre
    FsxLustreSettings:
      FileSystemId: fs-0e359b1f0257ff1f7

コンフィグファイルの紹介

紹介するコンフィグは EFS を複数マウントする方法と大差はありません。FSx for Lustre と EFS の設定を比べると似ていて見間違いやすいです。

検証環境

項目
ParallelCluster 3.2.0
OS Amazon Linux 2
CPU Intel
Head Node t3.micro
Compute Node t3.micro

設定ファイル全文

SubnetIdや、CustomActions:など環境依存の設定項目は適時修正してください。既存の FSx for Lustre と EFS をマウントする記述例の参考としてお使いください。

Region: ap-northeast-1
Image:
  Os: alinux2
Tags:
  - Key: Name
    Value: AL2LustreCluster
# ----------------------------------------------------------------
# Head Node Settings
# ----------------------------------------------------------------
HeadNode:
  InstanceType: t3.micro
  Networking:
    ElasticIp: false
    SubnetId: subnet-035be95eeaa091603
  Ssh:
    KeyName: sandbox-key
  LocalStorage:
    RootVolume:
      Size: 35
      Encrypted: true
      VolumeType: gp3
      Iops: 3000
      Throughput: 125
  Iam:
    AdditionalIamPolicies:
      - Policy: arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
    S3Access:
      - BucketName: hpc-dev-postinstall-files
        EnableWriteAccess: false
# ----------------------------------------------------------------
# Compute Node Settings
# ----------------------------------------------------------------
Scheduling:
  Scheduler: slurm
  SlurmSettings:
    ScaledownIdletime: 5
  SlurmQueues:
    # ------ Debug 1 without Postinstall ------
    - Name: debug-1
      ComputeResources:
        - Name: debug-without-postinstall
          InstanceType: t3.micro
          MinCount: 0
          MaxCount: 10
          DisableSimultaneousMultithreading: false
      ComputeSettings:
        LocalStorage:
          RootVolume:
            Size: 35
            Encrypted: true
            VolumeType: gp3
            Iops: 3000
            Throughput: 125
      CapacityType: SPOT
      Networking:
        SubnetIds:
          - subnet-035be95eeaa091603
        PlacementGroup:
          Enabled: false
      Iam:
        AdditionalIamPolicies:
          - Policy: arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
        S3Access:
          - BucketName: hpc-dev-postinstall-files
            EnableWriteAccess: false
    # ------ Debug 2 with Postinstall ------
    - Name: debug-2
      ComputeResources:
        - Name: debug-run-postinstall
          InstanceType: t3.micro
          MinCount: 0
          MaxCount: 10
          DisableSimultaneousMultithreading: false
      ComputeSettings:
        LocalStorage:
          RootVolume:
            Size: 35
            Encrypted: true
            VolumeType: gp3
            Iops: 3000
            Throughput: 125
      CapacityType: SPOT
      Networking:
        SubnetIds:
          - subnet-035be95eeaa091603
        PlacementGroup:
          Enabled: false
      CustomActions:
        OnNodeConfigured:
          Script: s3://hpc-dev-postinstall-files/mount-lustre-al2/postinstall.sh
      Iam:
        AdditionalIamPolicies:
          - Policy: arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
        S3Access:
          - BucketName: hpc-dev-postinstall-files
            EnableWriteAccess: false
    # ------ Compute 1 ------
    - Name: c6ilarge
      ComputeResources:
        - Name: c6ilarge
          InstanceType: c6i.large
          MinCount: 0
          MaxCount: 10
          DisableSimultaneousMultithreading: true
      ComputeSettings:
        LocalStorage:
          RootVolume:
            Size: 35
            Encrypted: true
            VolumeType: gp3
            Iops: 3000
            Throughput: 125
      CapacityType: SPOT
      Networking:
        SubnetIds:
          - subnet-035be95eeaa091603
        PlacementGroup:
          Enabled: true
      CustomActions:
        OnNodeConfigured:
          Script: s3://hpc-dev-postinstall-files/mount-lustre-al2/postinstall.sh
      Iam:
        AdditionalIamPolicies:
          - Policy: arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
        S3Access:
          - BucketName: hpc-dev-postinstall-files
            EnableWriteAccess: false
# ----------------------------------------------------------------
# Shared Storage Settings
# ----------------------------------------------------------------
SharedStorage:
  - MountDir: /mnt/efs-01
    Name: efs-single-az
    StorageType: Efs
    EfsSettings:
      FileSystemId: fs-0f1158ade79354809
  - MountDir: /mnt/lustre-01
    Name: fsx-for-lustre
    StorageType: FsxLustre
    FsxLustreSettings:
      FileSystemId: fs-0e359b1f0257ff1f7
# ----------------------------------------------------------------
#  Other Settings
# ----------------------------------------------------------------
Monitoring:
  Logs:
    CloudWatch:
      Enabled: true
      RetentionInDays: 30
      DeletionPolicy: "Delete"
  Dashboards:
    CloudWatch:
      Enabled: false

ポイント

  • StorageTypeの指定はEfsFSxLustreの違いがあります
    • 大文字と小文字の違いにも注意してください
  • EfsSettingsFsxLustreSettingsEFから始まるから見落としやすいです
    • 上記箇所はStorageType:の1行下の設定項目です
    • どちらかのマウント設定をコピペして流用するときに気をつけてください

注意事項

ParallelCluster 3.2 のSharedStorageセクションのアップデートポリシーは更新不可項目です。たとえば既存の FSx for Lustre をマウントしたあとに Lustre を削除しました。クラスターから Lustre をアンマウントしたいと思ってもクラスターのコンフィグに書き込んだマウント設定は変更できません。

Update policy: If this setting is changed, the update is not allowed.
After changing this setting, the cluster can't be updated. You must revert the settings for the original cluster and create a new cluster with the updated settings. You can delete the original cluster at a later date. To create the new cluster, use pcluster create-cluster. To delete the original cluster, use pcluster delete-cluster.

Using pcluster update-cluster - AWS ParallelCluster

SharedStorage section - AWS ParallelCluster

仮に Lustre を削除したあとにクラスターの更新をかけたら

pcluster update-cluster実行時にもともとマウントされていた Lustre の ID をチェックして、その Lustre ID が存在しないとエラーが返ってきます。Lustre のマウント設定箇所をコメントアウトしてupdate-clusterを実行しても同エラーでした。

おわりに

見間違いやすいと思ったので書き残しました。設定項目名が少し違うことに気づいてもらえたら幸いです。