You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Management-Utilities/auto_create_sm_relationships/README.md
+40-46Lines changed: 40 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,61 +15,55 @@ This script is used to ensure that all your volumes, in all your FSxN file syste
15
15
## Set Up
16
16
There are a few things you need to do in order to get this script to run properly:
17
17
18
-
- Set up a secret for each of the FSxN file systems in the AWS Secrets Manager. Each secret should have two "keys" (they can be named anything, since you set the name of the key the scretsTable defined below.):
18
+
- Set up a secret for each of the FSxN file systems in the AWS Secrets Manager. Each secret should have two "keys" (they can be named anything, since you set the name of the key the scretsTable defined below):
19
19
- username - set to the username you want the script to use when issuing API to the ONTAP system.
20
20
- password - set to the password of the username specified with the username key.
21
21
- Edit the top of the script and fill in a few variables:
22
-
- partnerTable - This table provides the association with a source FSxN file system to its partner cluster (i.e. where its volumes should be SnapMirror'ed to.) There should be five fields for each entry:
23
-
- fsxId - Set to the AWS ID of the FSx file system.
24
-
- svmName - Set to the SVM name on the FSxN file system.
25
-
- partnerFsxnIP - Set to the IP address of the management port of the partner FSxN file system.
26
-
- partnerSvmName - The name of the SVM where you want the SnapMirror destination volume to reside.
27
-
- partnerSvmSourceName - Is the "peered name" of the source SVM. Usually, it is the same as the source SVM, but can be different if that same name already exists on the partner file system. When you peer the SVM it will require you to create an alias for the source SVM so all the SVM names are unique.
22
+
- partnerTable - This table provides the association with a source FSxN file system to its partner cluster (i.e. where its volumes should be SnapMirror'ed to.) There should be five fields for each entry:
23
+
- fsxId - Set to the AWS ID of the FSx file system.
24
+
- svmName - Set to the SVM name on the FSxN file system.
25
+
- partnerFsxnIP - Set to the IP address of the management port of the partner FSxN file system.
26
+
- partnerSvmName - The name of the SVM where you want the SnapMirror destination volume to reside.
27
+
- partnerSvmSourceName - Is the "peered name" of the source SVM. Usually, it is the same as the source SVM, but can be different if that same name already exists on the partner file system. When you peer the SVM it will require you to create an alias for the source SVM so all the SVM names are unique.
28
+
- dynamodbPartnersTableName and dynamodbRegion - Instead of filling out the partnerTable in the source code, you can populate a DynamoDB table with the information and define these two variables to point to that table. Note that if both partnerTable and these two variables are defined, the partnerTable will be used. Also note that the required fields in the DynamoDB are a little different than the partnerTable. Here are the fields that should be defined in the DynamoDB table:
29
+
- soureceId - Which is the concatenation of the source file system ID followed by a ":" followed by the SVM name. It is done this way because the id has to be unique in the table. It is split up into its two components in the script when it is read in.
30
+
- partnerFsxnIp - Set to the IP address of the management port of the partner FSxN file system.
31
+
- partnerSvmName - The name of the SVM where you want the SnapMirror destination volume to reside.
32
+
- partnerSvmSourceName - Is the "peered name" of the source SVM. Usually, it is the same as the source SVM, but can be different if that same name already exists on the partner file system. When you peer the SVM it will require you to create an alias for the source SVM so all the SVM names are unique.
33
+
- secretsTable - This table provides the secret name, and username and password keys to use for each of the file systems. It should have 4 fields:
34
+
- fsxId - Set to the AWS File System ID.
35
+
- secretName - Set to the name of the secret created in step one.
36
+
- usernameKey - Set to the name of the key that holds the username.
37
+
- passwordKey - Set to the name of the key that holds the password.
38
+
- dynamodbSecretsTableName and dynamodbRegion - Instead of defining the secretsTable in the source code, you can populate a DynamoDB table with the information and define these variables to point to that table. The table should have the same fields as the secretsTable defined above
39
+
- secretsManagerRegion - Set to the region where the Secrets Manager has been set up.
40
+
- destinationVolumeSuffix - Set to the string you want appended to the source volume name to create the destination volume name.
41
+
- snapMirrorPolicy - Set to the Data ONTAP SnapMirror policy you want the assigned to the SnapMirror relationship.
42
+
- maxSnapMirrorRelationships - Set to the maximum number of SnapMirror relationship initializations you want this script to create in a single run.
43
+
- dryRun - If set to 'True' (case sensitive) the script will just show what it would have done, instead of actually creating the SnapMirror relationships.
44
+
- protectAll - If set to 'True' (case sensitive) the script will protect all volumes that don't have a "protect_volume" tag set to "skip". If set to 'False' it will only protect volumes that have a "protect_volume" tag set to "protect".
28
45
29
-
**NOTE:** Instead of defining the partnersTable in the script, you can define dynamodbPartnersTableName and dynamodbRegion and the script will read in the partner information from the specified DynamoDB table. The partners table should have the following fields:
46
+
- If you want to run this script as a Lambda program, then you'll need to:
47
+
- Create a role that has the following permissions:
48
+
- secretsmanager:GetSecretValue
49
+
- ec2:DescribeRegions
50
+
- fsx:DescribeFileSystems
51
+
- fsx:DescribeVolumes
52
+
- fsx:ListTagsForResources
53
+
- dynamodb:GetItem - Optional, only needed if you are using a DynamoDB table to access the secretsTable or partnerTable.
30
54
31
-
- soureceId - Which is the concatentation of the source file system ID followed by a ":" followed by the SVM name. It is done this way because the id has to be unique in the table. It is split up into its two components in the script when it is read in.
32
-
- partnerFsxnIp - Set to the IP address of the management port of the partner FSxN file system.
33
-
- partnerSvmName - The name of the SVM where you want the SnapMirror destination volume to reside.
34
-
- partnerSvmSourceName - Is the "peered name" of the source SVM. Usually, it is the same as the source SVM, but can be different if that same name already exists on the partner file system. When you peer the SVM it will require you to create an alias for the source SVM so all the SVM names are unique.
35
-
36
-
- secretsTable - This table provides the secret name, and username and password keys to use for each of the file systems. It should have 4 fields:
37
-
- fsxId - Set to the AWS File System ID.
38
-
- secretName - Set to the name of the secret created in step one.
39
-
- usernameKey - Set to the name of the key that holds the username.
40
-
- passwordKey - Set to the name of the key that holds the password.
41
-
42
-
**NOTE:** Instead of defining the secretsTable in the script, you can define dynamodbSecretsTableName and dynamodbRegion and the script will read in the secretsTable information from the specified DynamoDB table. The table should have the same fields as the secretsTable defined above.
43
-
44
-
- secretsManagerRegion - Set to the region where the Secrets Manager has been set up.
45
-
- destinationVolumeSuffix - Set to the string you want appended to the source volume name to create the destination volume name.
46
-
- snapMirrorPolicy - Set to the Data ONTAP SnapMirror policy you want the assigned to the SnapMirror relationship.
47
-
- maxSnapMirrorRelationships - Set to the maximum number of SnapMirror relationship initializations you want this script to create in a single run.
48
-
- dryRun - If set to 'True' (case sensitive) the script will just show what it would have done, instead of actually creating the SnapMirror relationships.
49
-
- protectAll - If set to 'True' (case sensitive) the script will protect all volumes that don't have a "protect_volume" tag set to "skip". If set to 'False' it will only protect volumes that have a "protect_volume" tag set to "protect".
50
-
51
-
If you want to run this script as a Lambda program, then you'll need to
52
-
- Create a role that has the following permissions:
53
-
- secretsmanager:GetSecretValue
54
-
- ec2:DescribeRegions
55
-
- fsx:DescribeFileSystems
56
-
- fsx:DescribeVolumes
57
-
- fsx:ListTagsForResources
58
-
- dynamodb:GetItem - Optional, only needed if you are using a DynamoDB table to access the secretsTable or partnersTable.
59
-
60
-
Create AWS endpoints for any services that it uses. Currently that is:
61
-
- ec2
62
-
- fsx
63
-
- SecretsManager
64
-
- dynamodb - Optional, only needed if you are using a DynamoDB table to access the secretsTable or partnersTable.
55
+
- Create AWS endpoints for any services that it uses. Currently that is:
56
+
- ec2
57
+
- fsx
58
+
- SecretsManager
59
+
- dynamodb - Optional, only needed if you are using a DynamoDB table to access the secretsTable or partnersTable.
65
60
66
61
# Running The Script
67
62
To run the script on a Linux host, you just need to change the UNIX permissions on the file to be executable, then run it as a command:
68
-
63
+
```
69
64
chmod +x auto_creaate_sm_relationships
70
-
71
-
./auto_create_sm_relationships
72
-
65
+
./auto_create_sm_relationships
66
+
```
73
67
To run it as a Lambda function you will need to:
74
68
- Create the Lambda function with a Python runtime, from scratch, and paste the program into code box and save it.
75
69
- Associate the role created above with the Lambda function.
0 commit comments