Skip to content

AWS Create ONTAP volume from existing Storage Virtual Machines(SVM) via Cloudformation

1

I want to create an AWS ONTAP Volume only Based on the existing Storage Virtual Machines(SVM) .

I have SVM ID and Name are available with me in order to use then in the new stack which i am creating to spin the new Volume(s).

Filesystem ID:  fs-00b23d16e032150db  
SVM ID is :  svm-04c2e2830ff42097e
SVM Name:  AWSDemosvm

I tried Below: But did not worked.

---
Description: "Create FSx for ONTAP Filesystem"
Resources:
  AWSDemoVolume:
    Type: "AWS::FSx::Volume"
    Properties:
      Name: AWSBackupDemovol001
      OntapConfiguration:
        JunctionPath: /AWSBackupDemovol001
        SizeInMegabytes: 150
        StorageEfficiencyEnabled: true
        StorageVirtualMachineId: 
        - !ImportValue "svm-04c2e2830ff42097e"
        TieringPolicy:
          CoolingPeriod: 0
          Name: AUTO		  
      VolumeType: "ONTAP"
      Tags:
        - Key: "Bacup_Tag"
          Value: "backup"
        - Key: "Created_By"
          Value: "Cloud Micron"
Outputs:
  FileSystemId:
    Value: !Ref "AWSdemocluster"
  SvmId:
    Value: !Ref "AWSDemosvm"
...
asked 4 years ago708 views
2 Answers
8

Hi, I see some errors in your CF YAML

You set the CoolingPeriod to 0. Per AWS documentation, the valid range for the cooling period is 2 to 183 days. If you want the default NetApp behavior, it's usually best to omit the CoolingPeriod line entirely and let the AUTO policy handle it, or set it to at least 2, see -> https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-fsx-volume-tieringpolicy.html#aws-properties-fsx-volume-tieringpolicy-properties

String vs. List: In code, the "-" before "!ImportValue" told AWS to expect an array. But the 'StorageVirtualMachineId' property requires a single "string". I think you need to code it like:

StorageVirtualMachineId: !ImportValue "svm-04c2e2830ff42097e"

As far as you already exported "svm-04c2e2830ff42097e" as Output in your former CF ... if "svm-04c2e2830ff42097e" is just the ID you simply need to handover the ID as string like:

StorageVirtualMachineId: "svm-04c2e2830ff42097e"

Size Constraint: FSx for ONTAP volumes typically require a minimum size of 1024 MiB (1 GiB). Your requested 150 MiB might trigger an "Invalid Parameter" error. Logical References: In your Outputs, you tried to !Ref things that weren't defined in the Resources section. I updated the output to return the ID of the volume you are actually creating.

Outputs:
  VolumeId:
    Description: "The ID of the newly created FSx Volume"
    Value: !Ref AWSDemoVolume

In sum I think the following should work:

AWSTemplateFormatVersion: '2010-09-09'
Description: "Create FSx for ONTAP Volume based on existing SVM"

Resources:
  AWSDemoVolume:
    Type: "AWS::FSx::Volume"
    Properties:
      Name: "AWSBackupDemovol001"
      VolumeType: "ONTAP"
      OntapConfiguration:
        # Pass the SVM ID directly as a string
        StorageVirtualMachineId: "svm-04c2e2830ff42097e"
        SizeInMegabytes: 1024  # Note: Minimum size for ONTAP volumes is usually 1024 MiB
        JunctionPath: "/AWSBackupDemovol001"
        StorageEfficiencyEnabled: true
        TieringPolicy:
          Name: "AUTO"
          # CoolingPeriod is only valid for SNAPSHOT_ONLY and AUTO policies (2-183 days). 
          # If you want it immediate, set it to the minimum (2) or omit for default.
          CoolingPeriod: 31 
      Tags:
        - Key: "Backup_Tag"
          Value: "backup"
        - Key: "Created_By"
          Value: "Cloud Micron"

Outputs:
  VolumeId:
    Description: "The ID of the newly created FSx Volume"
    Value: !Ref AWSDemoVolume
EXPERT
answered 3 months ago
0

There is catch in the template below where as per documentation it says clearly that it needs string thus you don't required !ImportValue here. just remove that.

Secondly, there is also another problem in the below code as you defined the CoolingPeriod: 0 which is not correct as value can not be zero either it should be minimum 2 or greater.

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.