Amazon FSx for NetApp ONTAP のスナップショット、クローン、SnapMirror を CloudFormation で作成してみた

Amazon FSx for NetApp ONTAP のスナップショット、クローン、SnapMirror を CloudFormation で作成してみた

Amazon FSx for NetApp ONTAP のスナップショット、クローン、SnapMirror を AWS CloudFormation で作成しました。スナップショットからのクローンと別ファイルシステムへの SnapMirror 関係をテンプレートで作成し、初回転送まで確認しました。
2026.11.24

はじめに

2026年11月23日に、Amazon FSx for NetApp ONTAP のアップデートが発表されました。このアップデートで、スナップショット、クローン、レプリケーションの作成と管理を、FSx コンソールと AWS CloudFormation から行えるようになりました。

https://aws.amazon.com/jp/about-aws/whats-new/2026/11/amazon-fsx-for-netapp-ontap-additional-resources/

この記事では、これらを CloudFormation のテンプレートで実際に作成した結果を紹介します。

検証環境

ファイルシステムは、ソースと宛先の2台を作りました。

  • リージョン:東京(ap-northeast-1)
  • デプロイタイプ:SINGLE_AZ_1(第1世代 Single-AZ)
  • ストレージ:SSD 1,024 GiB
  • スループット:128 MBps
  • ネットワーク:デフォルト VPC の ap-northeast-1a にあるサブネット(2台とも同じ)。セキュリティグループは指定なし
  • パスフレーズ:KMS キーと Secrets Manager のシークレット各1つ(クラスターピア用)
ソース 宛先
SVM svmsrc svmdst
ボリューム srcvol(RW、10,240 MiB) dstvol(DP、10,240 MiB)

環境スタックの作成には18分37秒かかりました。そのうち約16分は、2台のファイルシステムの並列作成です。

環境のテンプレートとデプロイコマンド

01-env.yaml として保存します。

AWSTemplateFormatVersion: '2010-09-09'
Description: FSx for ONTAP (Gen1 Single-AZ) x2, SVM, volumes, and cluster peer passphrase secret for verification

Parameters:
  SubnetId:
    Type: AWS::EC2::Subnet::Id
    Description: Subnet for both file systems (same VPC, same AZ)

Resources:
  # ---- Source file system ----
  SrcFileSystem:
    Type: AWS::FSx::FileSystem
    Properties:
      FileSystemType: ONTAP
      StorageCapacity: 1024
      StorageType: SSD
      SubnetIds: [!Ref SubnetId]
      OntapConfiguration:
        DeploymentType: SINGLE_AZ_1
        ThroughputCapacity: 128
        PreferredSubnetId: !Ref SubnetId
        AutomaticBackupRetentionDays: 0
      Tags:
        - Key: Name
          Value: verify-src

  SrcSvm:
    Type: AWS::FSx::StorageVirtualMachine
    Properties:
      FileSystemId: !Ref SrcFileSystem
      Name: svmsrc
      RootVolumeSecurityStyle: UNIX

  SrcVolume:
    Type: AWS::FSx::Volume
    Properties:
      Name: srcvol
      VolumeType: ONTAP
      OntapConfiguration:
        JunctionPath: /srcvol
        SizeInMegabytes: '10240'
        StorageEfficiencyEnabled: 'true'
        StorageVirtualMachineId: !Ref SrcSvm
        SnapshotPolicy: none

  # ---- Destination file system ----
  DstFileSystem:
    Type: AWS::FSx::FileSystem
    Properties:
      FileSystemType: ONTAP
      StorageCapacity: 1024
      StorageType: SSD
      SubnetIds: [!Ref SubnetId]
      OntapConfiguration:
        DeploymentType: SINGLE_AZ_1
        ThroughputCapacity: 128
        PreferredSubnetId: !Ref SubnetId
        AutomaticBackupRetentionDays: 0
      Tags:
        - Key: Name
          Value: verify-dst

  DstSvm:
    Type: AWS::FSx::StorageVirtualMachine
    Properties:
      FileSystemId: !Ref DstFileSystem
      Name: svmdst
      RootVolumeSecurityStyle: UNIX

  # DP volume that receives the SnapMirror transfer
  DstVolume:
    Type: AWS::FSx::Volume
    Properties:
      Name: dstvol
      VolumeType: ONTAP
      OntapConfiguration:
        OntapVolumeType: DP
        SizeInMegabytes: '10240'
        StorageVirtualMachineId: !Ref DstSvm

  # ---- Cluster peer passphrase (KMS key + Secrets Manager secret) ----
  PassphraseKey:
    Type: AWS::KMS::Key
    Properties:
      Description: Encrypts the FSx cluster peer passphrase secret (verification)
      KeyPolicy:
        Version: '2012-10-17'
        Statement:
          - Sid: Enable IAM policies
            Effect: Allow
            Principal:
              AWS: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:root
            Action: kms:*
            Resource: '*'
          - Sid: Allow FSx to decrypt the cluster peer passphrase
            Effect: Allow
            Principal:
              Service: fsx.amazonaws.com
            Action: kms:Decrypt
            Resource: '*'
            Condition:
              StringEquals:
                kms:ViaService: !Sub secretsmanager.${AWS::Region}.amazonaws.com
                aws:SourceAccount: !Ref AWS::AccountId

  PassphraseSecret:
    Type: AWS::SecretsManager::Secret
    Properties:
      Description: FSx cluster peer passphrase (verification)
      KmsKeyId: !Ref PassphraseKey
      GenerateSecretString:
        PasswordLength: 32
        ExcludePunctuation: true

  PassphraseSecretPolicy:
    Type: AWS::SecretsManager::ResourcePolicy
    Properties:
      SecretId: !Ref PassphraseSecret
      ResourcePolicy:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              Service: fsx.amazonaws.com
            Action: secretsmanager:GetSecretValue
            Resource: '*'
            Condition:
              StringEquals:
                aws:SourceAccount: !Ref AWS::AccountId

Outputs:
  SrcFileSystemId:
    Value: !Ref SrcFileSystem
  DstFileSystemId:
    Value: !Ref DstFileSystem
  SrcSvmId:
    Value: !Ref SrcSvm
  DstSvmId:
    Value: !Ref DstSvm
  SrcVolumeId:
    Value: !Ref SrcVolume
  DstVolumeId:
    Value: !Ref DstVolume
  PassphraseSecretArn:
    Value: !Ref PassphraseSecret
aws cloudformation create-stack \
  --stack-name fsx-verify-env \
  --template-body file://01-env.yaml \
  --parameters ParameterKey=SubnetId,ParameterValue=<サブネットID>

以降のコマンドに出てくる ID と IP アドレスはダミーの値です。

スナップショットとクローン

スナップショットは AWS::FSx::Snapshot、スナップショットポリシーは AWS::FSx::SnapshotPolicy で宣言します。クローンは AWS::FSx::Volume の CloneConfiguration に親ボリュームを指定して作ります。CloneConfiguration に SnapshotId を加えるとそのスナップショットからのクローン(復元)になります。スナップショット、ポリシー、2つのクローンは、1つのテンプレートにまとめました。

テンプレートと作成

02-snapshot-clone.yaml として保存します。

AWSTemplateFormatVersion: '2010-09-09'
Description: Snapshot, snapshot policy, and volume clones for FSx for ONTAP (verification)

Parameters:
  FileSystemId:
    Type: String
  SvmId:
    Type: String
  VolumeId:
    Type: String
    Description: Parent volume ID (fsvol-...)

Resources:
  # Snapshot of the parent volume
  Snapshot:
    Type: AWS::FSx::Snapshot
    Properties:
      Name: snap-cfn-01
      VolumeId: !Ref VolumeId

  # Custom snapshot policy (hourly, keep 3, SnapMirror label "hourly")
  SnapshotPolicy:
    Type: AWS::FSx::SnapshotPolicy
    Properties:
      Name: policy-cfn-hourly
      FileSystemId: !Ref FileSystemId
      Schedules:
        - Name: hourly
          Count: 3
          SnapmirrorLabel: hourly

  # Clone of the parent volume's current state (no snapshot specified)
  CloneFromVolume:
    Type: AWS::FSx::Volume
    Properties:
      Name: clonecurrent
      VolumeType: ONTAP
      OntapConfiguration:
        JunctionPath: /clonecurrent
        StorageVirtualMachineId: !Ref SvmId
        CloneConfiguration:
          ParentVolumeId: !Ref VolumeId

  # Clone from the snapshot (restore)
  CloneFromSnapshot:
    Type: AWS::FSx::Volume
    Properties:
      Name: clonesnap
      VolumeType: ONTAP
      OntapConfiguration:
        JunctionPath: /clonesnap
        StorageVirtualMachineId: !Ref SvmId
        CloneConfiguration:
          ParentVolumeId: !Ref VolumeId
          SnapshotId: !Ref Snapshot

Outputs:
  SnapshotId:
    Value: !Ref Snapshot
  SnapshotArn:
    Value: !GetAtt Snapshot.ResourceARN
  SnapshotPolicyId:
    Value: !GetAtt SnapshotPolicy.SnapshotPolicyId
  CloneFromVolumeId:
    Value: !Ref CloneFromVolume
  CloneFromSnapshotId:
    Value: !Ref CloneFromSnapshot

ソース側のファイルシステム、SVM、srcvol を指定してデプロイしました。

aws cloudformation create-stack \
  --stack-name fsx-verify-snapshot-clone \
  --template-body file://02-snapshot-clone.yaml \
  --parameters \
    ParameterKey=FileSystemId,ParameterValue=fs-0123456789abcdef0 \
    ParameterKey=SvmId,ParameterValue=svm-0123456789abcdef0 \
    ParameterKey=VolumeId,ParameterValue=fsvol-0123456789abcdef0

所要時間は、各リソースの最初の CREATE_IN_PROGRESS から CREATE_COMPLETE までの時間です。スタック全体は、スタック自体のイベントで測りました。

リソース 所要時間
スタック全体 約2分8秒
SnapshotPolicy 約19秒
Snapshot 約1分2秒
CloneFromVolume 約1分2秒
CloneFromSnapshot 約2分2秒(注)

注:CloneFromSnapshot は、Snapshot の CREATE_COMPLETE の約1秒後に Resource creation Initiated となりました。そこから完了まで約1分1秒でした。

作成されたスナップショット、ポリシー、クローン

describe-snapshots と describe-snapshot-policies の出力(抜粋)
aws fsx describe-snapshots --output json
"Name": "snap-cfn-01",
"VolumeId": "fsvol-0123456789abcdef0",
"CreationTime": "2026-11-24T13:35:50.244000+09:00",
"Lifecycle": "AVAILABLE",
"SnapshotType": "ONTAP",
"OntapConfiguration": {
    "SizeInMegabytes": 0,
    "UUID": "<uuid>"
}
aws fsx describe-snapshot-policies --output json
"Name": "policy-cfn-hourly",
"Enabled": true,
"Schedules": [
    {
        "Name": "hourly",
        "Count": 3,
        "SnapmirrorLabel": "hourly"
    }
],
"Scope": "FILESYSTEM",
"Lifecycle": "CREATED",

describe-volumes の出力では、clonecurrent の CloneConfiguration に ParentVolumeId が含まれていました。clonesnap の CloneConfiguration には、ParentVolumeId と SnapshotId が含まれていました。どちらも Lifecycle は CREATED で、サイズは親と同じ 10,240 MiB です。

今回の検証では、SnapshotId を指定せずに clonecurrent を作成しました。すると、親ボリューム srcvol に clone_clonecurrent.2026-11-24_043607.0 というスナップショットが作られていました。

ポリシーの割り当て

作成したポリシーは、ボリュームの SnapshotPolicy にポリシー名を指定して割り当てます。今回は clonesnap に割り当てました。02-snapshot-clone.yaml からの変更は、DependsOn と SnapshotPolicy の2行の追加です。

  # Clone from the snapshot (restore)
  CloneFromSnapshot:
    Type: AWS::FSx::Volume
    DependsOn: SnapshotPolicy
    Properties:
      Name: clonesnap
      VolumeType: ONTAP
      OntapConfiguration:
        JunctionPath: /clonesnap
        SnapshotPolicy: policy-cfn-hourly
        StorageVirtualMachineId: !Ref SvmId
        CloneConfiguration:
          ParentVolumeId: !Ref VolumeId
          SnapshotId: !Ref Snapshot

02-snapshot-clone.yaml の CloneFromSnapshot を、この内容に置き換えます。置き換えたテンプレートを 02b-snapshot-clone-with-policy.yaml として保存し、スタックを更新しました。

aws cloudformation update-stack \
  --stack-name fsx-verify-snapshot-clone \
  --template-body file://02b-snapshot-clone-with-policy.yaml \
  --parameters \
    ParameterKey=FileSystemId,UsePreviousValue=true \
    ParameterKey=SvmId,UsePreviousValue=true \
    ParameterKey=VolumeId,UsePreviousValue=true

割り当ての確認には、clonesnap のボリューム ID(スタックの出力 CloneFromSnapshotId)を指定した describe-volumes を使います。

aws fsx describe-volumes --volume-ids fsvol-0123456789abcdef2 \
  --query 'Volumes[0].[Name,Lifecycle,OntapConfiguration.SnapshotPolicy]' --output json

SnapshotPolicy は、スタックが UPDATE_COMPLETE となってから約1分後の確認で policy-cfn-hourly へ変わっていました。

SnapMirror

SnapMirror には、クラスターピア、SVM ピア、SnapMirror 関係が必要です。今回は SnapMirror ポリシーも作成しました。スタックは2つに分け、先にクラスターピアのスタック(03a-cluster-peers.yaml)を作成しました。その後で SVM ピア、SnapMirror ポリシー、SnapMirror 関係のスタック(03b-snapmirror.yaml)を作成しました。

クラスターピア

AWS::FSx::ClusterPeer の PeerAddresses には相手ファイルシステムの intercluster IP を指定します。AWS::FSx::FileSystem の Fn::GetAtt で取得できる属性は DNSName、LustreMountName、ResourceARN、RootVolumeId の4つです。intercluster IP は含まれません。そのため、intercluster IP は describe-file-systems で取得し、スタックのパラメーターで渡しました。

aws fsx describe-file-systems --file-system-ids fs-0123456789abcdef0 fs-0123456789abcdef1 \
  --query 'FileSystems[].[FileSystemId,OntapConfiguration.Endpoints.Intercluster.IpAddresses]' --output json
[
    [
        "fs-0123456789abcdef0",
        [
            "10.0.1.10",
            "10.0.1.11"
        ]
    ],
    [
        "fs-0123456789abcdef1",
        [
            "10.0.1.20",
            "10.0.1.21"
        ]
    ]
]

クラスターピアは両方のファイルシステムに1つずつ作り、同じパスフレーズのシークレットを渡します。宛先側にはソースの IP、ソース側には宛先の IP を指定します。03a-cluster-peers.yaml として保存します。

AWSTemplateFormatVersion: '2010-09-09'
Description: Cluster peers for FSx for ONTAP (verification)

Parameters:
  SrcFileSystemId:
    Type: String
  DstFileSystemId:
    Type: String
  SrcIntercluster:
    Type: CommaDelimitedList
    Description: Intercluster IP addresses of the source file system (read with describe-file-systems)
  DstIntercluster:
    Type: CommaDelimitedList
    Description: Intercluster IP addresses of the destination file system (read with describe-file-systems)
  PassphraseSecretArn:
    Type: String

Resources:
  # Cluster peer is mutual: create one on each file system with the same passphrase
  ClusterPeerOnDst:
    Type: AWS::FSx::ClusterPeer
    Properties:
      FileSystemId: !Ref DstFileSystemId
      PeerAddresses: !Ref SrcIntercluster
      PassphraseSecretArn: !Ref PassphraseSecretArn
      AllowedSvmMode: ALL

  ClusterPeerOnSrc:
    Type: AWS::FSx::ClusterPeer
    DependsOn: ClusterPeerOnDst
    Properties:
      FileSystemId: !Ref SrcFileSystemId
      PeerAddresses: !Ref DstIntercluster
      PassphraseSecretArn: !Ref PassphraseSecretArn
      AllowedSvmMode: ALL

Outputs:
  ClusterPeerOnDstId:
    Value: !GetAtt ClusterPeerOnDst.ClusterPeerId
  ClusterPeerOnSrcId:
    Value: !GetAtt ClusterPeerOnSrc.ClusterPeerId

IP のパラメーターは値にカンマを含むので、値をダブルクォート(")で囲み、引数全体をシングルクォート(')で囲みます。PassphraseSecretArn には、環境スタックの出力の値を渡します。

aws cloudformation create-stack \
  --stack-name fsx-verify-cluster-peers \
  --template-body file://03a-cluster-peers.yaml \
  --parameters \
    ParameterKey=SrcFileSystemId,ParameterValue=fs-0123456789abcdef0 \
    ParameterKey=DstFileSystemId,ParameterValue=fs-0123456789abcdef1 \
    'ParameterKey=SrcIntercluster,ParameterValue="10.0.1.10,10.0.1.11"' \
    'ParameterKey=DstIntercluster,ParameterValue="10.0.1.20,10.0.1.21"' \
    ParameterKey=PassphraseSecretArn,ParameterValue=<シークレットARN>

スタックは約35秒で完了し、クラスターピアは宛先側、ソース側の順に作成されました。スタックが CREATE_COMPLETE になった 13:43:42 以降、ピアの状態は次のように推移しました。

aws fsx describe-cluster-peers \
  --query 'ClusterPeers[].[ClusterPeerId,FileSystemId,Lifecycle,Status,AuthenticationStatus.State]' --output text
確認時刻 ソース側(Status / AuthenticationStatus.State) 宛先側(Status / AuthenticationStatus.State)
13:43:54〜13:48:17(5回の確認) available / ok unavailable / pending
13:56:49 available / ok available / ok

03b-snapmirror.yaml のスタックは、クラスターピアのスタックの完了から約3分半後の 13:47:07 に作成を開始し、13:48:07 に完了しました。宛先側のクラスターピアは、直前の 13:46:11 と直後の 13:48:17 の確認で unavailable / pending でした。

SVM ピア、SnapMirror ポリシー、SnapMirror 関係

いずれも宛先ファイルシステム側に作ります。SVM ピアの PeerClusterName には、FsxId の後ろにソースのファイルシステム ID から fs- を除いた部分を続けた値を指定しました。テンプレートでは、この値を Fn::Join、Fn::Select、Fn::Split で組み立てています。03b-snapmirror.yaml として保存します。

AWSTemplateFormatVersion: '2010-09-09'
Description: SVM peer, SnapMirror policy, and SnapMirror relationship for FSx for ONTAP (verification)

Parameters:
  SrcFileSystemId:
    Type: String
  DstFileSystemId:
    Type: String
  DstSvmId:
    Type: String
  DstVolumeId:
    Type: String
    Description: DP volume on the destination file system
  SrcSvmName:
    Type: String
  SrcVolumeName:
    Type: String

Resources:
  # SVM peer is created from the destination SVM

  SvmPeer:
    Type: AWS::FSx::StorageVirtualMachinePeer
    Properties:
      StorageVirtualMachineId: !Ref DstSvmId
      PeerSvmName: !Ref SrcSvmName
      PeerClusterName: !Join ['', ['FsxId', !Select [1, !Split ['fs-', !Ref SrcFileSystemId]]]]
      Applications: [SNAPMIRROR]

  # Custom SnapMirror policy on the destination file system
  SnapmirrorPolicy:
    Type: AWS::FSx::SnapmirrorPolicy
    Properties:
      FileSystemId: !Ref DstFileSystemId
      Name: policy-cfn-copyall
      SnapshotCopyMode: COPY_ALL_SOURCE_SNAPSHOTS
      NetworkCompressionEnabled: true

  # Relationship is created on the destination file system. The baseline transfer starts automatically
  SnapmirrorRelationship:
    Type: AWS::FSx::SnapmirrorRelationship
    DependsOn: SvmPeer
    Properties:
      Source:
        Path: !Sub ${SrcSvmName}:${SrcVolumeName}
      Destination:
        VolumeId: !Ref DstVolumeId
      PolicyId: !GetAtt SnapmirrorPolicy.SnapmirrorPolicyId
      TransferSchedule: hourly

Outputs:
  SvmPeerId:
    Value: !GetAtt SvmPeer.StorageVirtualMachinePeerId
  SnapmirrorPolicyId:
    Value: !GetAtt SnapmirrorPolicy.SnapmirrorPolicyId
  SnapmirrorRelationshipId:
    Value: !GetAtt SnapmirrorRelationship.SnapmirrorRelationshipId
aws cloudformation create-stack \
  --stack-name fsx-verify-snapmirror \
  --template-body file://03b-snapmirror.yaml \
  --parameters \
    ParameterKey=SrcFileSystemId,ParameterValue=fs-0123456789abcdef0 \
    ParameterKey=DstFileSystemId,ParameterValue=fs-0123456789abcdef1 \
    ParameterKey=DstSvmId,ParameterValue=svm-0123456789abcdef1 \
    ParameterKey=DstVolumeId,ParameterValue=fsvol-0123456789abcdef1 \
    ParameterKey=SrcSvmName,ParameterValue=svmsrc \
    ParameterKey=SrcVolumeName,ParameterValue=srcvol

スタックは約1分で完了しました。SnapmirrorPolicy は約19秒、SvmPeer は約36秒、SnapmirrorRelationship は約19秒でした。

作成された SVM ピアの PeerClusterName は次の値で、State は PEERED でした。

aws fsx describe-storage-virtual-machine-peers \
  --query 'StorageVirtualMachinePeers[].[StorageVirtualMachinePeerId,Lifecycle,State,PeerSvmName,PeerClusterName]' --output text
svmpeer-0123456789abcdef0	CREATED	PEERED	svmsrc	FsxId0123456789abcdef0

初回転送

スタックは 13:48:07 に完了し、13:48:16 の最初の確認で SnapMirror 関係の State は UNINITIALIZED でした。30秒間隔で確認したところ 13:56:07 まで UNINITIALIZED のままで、13:56:37 に初めて SNAPMIRRORED となりました。UNINITIALIZED の間も Healthy は true でした。

aws fsx describe-snapmirror-relationships --output json
"State": "SNAPMIRRORED",
"Healthy": true,
"LagTimeInMinutes": 8,
"ExportedSnapshot": {
    "SnapshotId": "fsvolsnap-0123456789abcdef3",
    "SnapshotName": "snapmirror.<uuid>_2163915976.2026-11-24_044803"
},
"TransferState": {
    "State": "success",
    "BytesTransferred": 8096,
    "Duration": "PT3S",
    "EndTime": "2026-11-24T13:48:08+09:00"
}

TransferState では、転送は EndTime の 13:48:08 に完了していましたが、State が SNAPMIRRORED になったのは、その約8分〜8分半後でした。

SnapMirror ポリシーは COPY_ALL_SOURCE_SNAPSHOTS です。宛先ボリュームには、関係の作成前から srcvol にあった snap-cfn-01 と clone_clonecurrent… に加えて、初回転送で作られた snapmirror.… が、ソースと同じ名前で存在していました。

aws fsx describe-snapshots --filters Name=volume-id,Values=fsvol-0123456789abcdef1 \
  --query 'Snapshots[].[SnapshotId,Name,VolumeId,Lifecycle]' --output text
fsvolsnap-0123456789abcdef1	snap-cfn-01	fsvol-0123456789abcdef1	AVAILABLE
fsvolsnap-0123456789abcdef2	clone_clonecurrent.2026-11-24_043607.0	fsvol-0123456789abcdef1	AVAILABLE
fsvolsnap-0123456789abcdef3	snapmirror.<uuid>_2163915976.2026-11-24_044803	fsvol-0123456789abcdef1	AVAILABLE

まとめ

CloudFormation で、Amazon FSx for NetApp ONTAP のスナップショット、クローン、SnapMirror を設定、管理できることを確認しました。

従来、これらの設定と管理は ONTAP CLI または REST API に限られていました。今回のアップデートで、FSx コンソールと CloudFormation からも行えるようになりました。

再現性や履歴管理のために ONTAP 環境の設定を IaC で管理する要件がある場合は、CloudFormation を試してみてください。

この記事をシェアする

AWSのお困り事はクラスメソッドへ

関連記事