|
| 1 | +# Export NetApp FSxN to a CloudFormation Template |
| 2 | + |
| 3 | +## Overview |
| 4 | +This folder provides a script that will create a CloudFormation template based on the current configuration of an existing FSx for ONTAP file system. |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | +- An FSxN file system you want to create a CloudFormation template for. |
| 8 | +- An AWS account with permissions to "describe" the FSxN file system and its virtual storage machines, and volumes. |
| 9 | +- The AWS CLI installed and configured on your local machine. You can find instructions on how to do that [here](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html). |
| 10 | + |
| 11 | +## Running the script |
| 12 | + |
| 13 | +The script takes the following parameters: |
| 14 | +- `-f fs-id`: The ID of the FSxN file system you want to create the CloudFormation template for. This is a required parameter. |
| 15 | +- `-n name`: Is an optional name to be appended to all the volumes, svms and NetBIOS names. This is so you can test the CloudFormation template while the original machine is still running. |
| 16 | + |
| 17 | +The script will output the CloudFormation template in JSON format. You can redirect this output to a file if you want to save it. |
| 18 | + |
| 19 | +Note that since you can't retrieve credentials from the FSxN configuration the script will create |
| 20 | +parameters that will allow you to provide an AWS Secrets Manager secret that should contain the credentials. |
| 21 | +There will be one parameter for the password of the 'fsxadmin' account. That secret will just need one 'key' |
| 22 | +named "password" with the desired fsxadmin password. There will also be a parameter for each SVMs that has an |
| 23 | +Active Directory configured for it so you can provide a secret that should have a 'username' and 'password' key |
| 24 | +that will be used to join the SVM to the domain. |
| 25 | + |
| 26 | +An example run: |
| 27 | +``` |
| 28 | +$ python export_fsxn_cf.py -f fs-0123456789abcdef0 -n test > fsxn_template.json |
| 29 | +Warning: Volume rvnw_vol_autogrow does not have a junction path yet it is required for a Cloudformation template so setting it to /rvnw_vol_autogrow |
| 30 | +Warning: Volume unixdata does not have a junction path yet it is required for a Cloudformation template so setting it to /unixdata |
| 31 | +Warning: Volume effictest2 is a DP volume and cannot have the StorageEfficiencyEnabled property, removing it from the CloudFormation template. |
| 32 | +Warning: Volume effictest2 is a DP volume and cannot have the SnapshotPolicy property, removing it from the CloudFormation template. |
| 33 | +Warning: Volume effictest2 is a DP volume and cannot have the SecurityStyle property, removing it from the CloudFormation template. |
| 34 | +Warning: Could not find root volume for SVM fsa. Setting the security style to UNIX |
| 35 | +``` |
| 36 | + |
| 37 | +## Notes |
| 38 | +- For multi availability zone deployments, the script will do the following in regards to the Endpoint IP Address Range: |
| 39 | + - If the file system is in the 198.19.0.0/16 address range (the AWS default), the script will not provide an address range forcing AWS to just allocate a new address range from the 198.19.0.0/16 CIDR block. |
| 40 | + - If it isn't in the 198.19.0.0/16 address range then it will create a parameter so you can specify a new address range for testing purposes, with a default set to the current address range. |
| 41 | +- Since AWS requires you to provide a junction path when creating a volume, if the script finds a volume without a junction path it will set it to `/volume_name`. A warning message will be outputted if this happens to alert you. |
| 42 | +- Since AWS doesn't allow you to specify these parameters when creating a DP type volume, their current settings will be removed from the CloudFormation template: |
| 43 | + - SecurityStyle |
| 44 | + - SnapshotPolicy |
| 45 | + - StorageEfficiencyEnabled |
| 46 | +- If, for some reason, the script can't find the attributes of the root volume of a SVM (unlikely but there are reasons how this can happen), it will set the security style of the SVM to 'NTFS' if the SVM has a Active Directory configuration, otherwise it will set it to a 'UNIX' security style. A warning message will be outputted if this happens to alert you. |
| 47 | +- Since AWS only allows an Active Directory Distinguished Name (DN) to start with "OU=", if the script finds a DN that doesn't start with "OU=" it will ignore it and will output a warning message to alert you. However the DN is set to "CN=Computers", which is the default DN that ONTAP will use when joining a domain to AD, it will not output an warning message with the assumption that by not providing a DN it will be set to "CN=Computers". |
| 48 | +- While some testing was performed, hence the `-n` option, not for all possible FSxN configurations were tested. If you run into any issues with the script, or have suggestions for improvements, please open an [issue](https://github.com/NetApp/FSx-ONTAP-samples-scripts/issues) on GitHub. |
| 49 | + |
| 50 | +## Author Information |
| 51 | + |
| 52 | +This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors). |
| 53 | + |
| 54 | +## License |
| 55 | + |
| 56 | +Licensed under the Apache License, Version 2.0 (the "License"). |
| 57 | + |
| 58 | +You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0). |
| 59 | + |
| 60 | +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an _"AS IS"_ basis, without WARRANTIES or conditions of any kind, either express or implied. |
| 61 | + |
| 62 | +See the License for the specific language governing permissions and limitations under the License. |
| 63 | + |
| 64 | +© 2025 NetApp, Inc. All Rights Reserved. |
0 commit comments