Skip to content

Commit be61c2c

Browse files
authored
Merge pull request #217 from NetApp/add_cf_ext_samples
Updated based no comments received.
2 parents d6cd6be + f50493a commit be61c2c

File tree

9 files changed

+79
-16
lines changed

9 files changed

+79
-16
lines changed

CloudFormation/NetApp-FSxN-Custom-Resources-Samples/README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Outputs:
5656
```
5757
You can use the above template to create the role by running the following command:
5858
```
59-
aws cloudformation create-stack --stack-name create_execution_role_for_NetApp_CF_extensions --template-body file://<path-to-template> --capabilities CAPABILITY_NAMED_IAM
59+
aws cloudformation create-stack --stack-name CreateExecutionRoleForNetAppCFextensions --template-body file://<path-to-template> --capabilities CAPABILITY_NAMED_IAM
6060
```
6161

6262
### Step 2: Activate the Extensions
@@ -86,11 +86,30 @@ Where:
8686
- `<aws-region>` is the AWS region you want to activate the extensions in.
8787
- `<subnet-id>,<subnet-id>` are the subnet(s) you want to deploy the link in. No spaces between the subnet IDs.
8888
Only one is required, but is recommended to have at least two. These subnets must have access to the FSxN management endpoint.
89-
- `<security-group-id>,<security-group-id>` are the security group that will be attached to the Lambda Link function.
89+
- `<security-group-id>,<security-group-id>` are the security group(s) that will be attached to the Lambda Link function.
90+
The security groups must allow access to the FSxN management endpoint over port 443.
9091
No spaces between the security group IDs. Only one is required.
9192
- `<link_name>` is the name you want to give the link. It is also used as the name assigned to the link Lambda function.
9293

93-
Once you have done this, you are ready to start using the examples in this repository.
94+
### Step 4: Create an AWS Secret Manager Secret
95+
All of the extensions use an AWS Secrets Manager secret to obtain the credentials needed to manage the FSx for ONTAP file system.
96+
The secret should be a JSON object with the one key. The key can be named anything, but the value should be of the form `"username:password"`.
97+
This allows you to use any username you want. If you want to use fsxadmin (the default admin for an FSx for ONTAP file system), then the value can be just that user's password.
98+
99+
The following command can be used to create a secret:
100+
```
101+
aws secretsmanager create-secret --name <secret-name> --secret-string '{"<key-name>":"<username>:<password>"}'
102+
```
103+
Where:
104+
```
105+
<secret-name> is the name you want to give the secret.
106+
<key-name> is the name of the key in the secret. It can be anything you want.
107+
<username> is the username you want to use to manage the FSx for ONTAP file system.
108+
<password> is the password for the username.
109+
```
110+
111+
## Sample CloudFormation Templates
112+
Once you have done the above steps you are ready to start using the examples in this repository.
94113

95114
| File | Description |
96115
|------|-------------|

CloudFormation/NetApp-FSxN-Custom-Resources-Samples/scripts/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ There are also a couple scripts that can be used to help enable the NetApp FSxN
1616
|deploy_link | This script will use CloudFormation to deploy a Workload Factory Link.|
1717
|createClone.py | This is a Python script that will create a clone of a volume using boto to deploy a CloudFormation stack that creates a clone.|
1818

19+
## Usage
20+
To run these scripts you'll need to download them, change the permissions to be executable, and then run them. For example:
21+
```bash
22+
chmod +x create_volume
23+
./create_volme -r us-west-2 -l arn:aws:lambda:ca-central-1:759999999999:function:wf-link -s arn:aws:secretsmanager:us-east-1:759999999999:secret:fsnSecret-yyaL32 -f fs-02a89999999999999 -v prod -n vol1 -t ../create_volume.yaml
24+
```
25+
26+
To see the required parameters for each script, you can run the script with the `-h` flag. For example:
27+
```bash
28+
./create_volume -h
29+
Usage: create_volume [-r region] -l link_ARN -s secret_ARN [-k secret_key] -f fsx_id -v svm_name -n volune_name [-z size_in_MB] [-a aggregate] -t template
30+
Notes:
31+
The default region is the region configured in the AWS CLI.
32+
The default secret key is 'credentials'.
33+
The default aggregate is "aggr1".
34+
The default size is 20MB.
35+
```
36+
1937
## Author Information
2038

2139
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors).

CloudFormation/NetApp-FSxN-Custom-Resources-Samples/scripts/create_SM_relationship

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
################################################################################
1313
usage () {
1414
cat <<EOF
15-
Usage: $(basename $0) [--region region] --source-link-arn link_arn --source-secret-arn secret_arn [--source-secret-key password] --source-fsx fsx_id --source-svm svm_name --source-vol vol_name \\
16-
--dest-link-arn link_arn --dest-secret-arn secret_arn [--dest-sceret-key password] --dest-fsx fsx_id --dest-svm svm_name [--dest-vol vol_name_dp] \\
15+
Usage: $(basename $0) [--region region] --source-link-arn link_arn --source-secret-arn secret_arn [--source-secret-key key] --source-fsx fsx_id --source-svm svm_name --source-vol vol_name \\
16+
--dest-link-arn link_arn --dest-secret-arn secret_arn [--dest-sceret-key key] --dest-fsx fsx_id --dest-svm svm_name [--dest-vol vol_name_dp] \\
1717
--template templete_filename [--dest-aggr aggregate1]
1818
Notes:
1919
The default region is whatever the default region is in the AWS CLI configuration.
20-
The default secret key is 'password'.
20+
The default secret key is 'credentials'.
2121
The default destination volume name is the source volume name with '_dp' appended.
2222
The default aggregate is 'aggr1'.
2323
EOF
@@ -26,13 +26,13 @@ EOF
2626
# Instead of passing a bunch of parameters, set the values of the variables here.
2727
sourceLinkArn=""
2828
sourceSecretArn=""
29-
sourceSecretKey="password"
29+
sourceSecretKey="credentials"
3030
sourceFsxId=""
3131
sourceSvmName=""
3232
sourceVolumeName=""
3333
destinationLinkArn=""
3434
destinationSecretArn=""
35-
destinationSecretKey="password"
35+
destinationSecretKey="credentials"
3636
destinationFsxId=""
3737
destinationSvmName=""
3838
destinationAggregate="aggr1"

CloudFormation/NetApp-FSxN-Custom-Resources-Samples/scripts/create_clone

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ cat <<EOF
1212
Usage: $(basename $0) [-r region] -l link_arn -s secret_arn [-k secretKey] -f fsx_id -v svm_name -p parent_volume_name [-c clone_volume_name] -t templete_filename
1313
Notes:
1414
The default region is whatever the default region is for the AWS CLI.
15-
The default secretKey is 'password'.
15+
The default secretKey is 'credentials'.
1616
The clone_volume_name defaults to the parent_volume_name with '_clone' appended.
1717
EOF
1818
}
1919
#
2020
# Set the default values.
2121
linkArn=""
2222
secretArn=""
23-
secretKey="password"
23+
secretKey="credentials"
2424
fsxId=""
2525
svmName=""
2626
parentVolumeName=""

CloudFormation/NetApp-FSxN-Custom-Resources-Samples/scripts/create_export_policy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
################################################################################
1212
usage () {
1313
cat <<EOF
14-
Usage: $(basename $0) [-r region] -l link_ARN -s secret_ARN -k secret_key -f fsx_id -v svm_name -n policy_name [-p protocols] -c match_CIDR -t templete_filename
14+
Usage: $(basename $0) [-r region] -l link_ARN -s secret_ARN [-k secret_key] -f fsx_id -v svm_name -n policy_name [-p protocols] -c match_CIDR -t templete_filename
1515
Notes:
1616
The default region is whatever the default region is set in the AWS CLI.
1717
The default protocols is "any"
18+
The default secret_key is "credentials"
1819
EOF
1920
}
2021
#
2122
# Set the default values.
2223
linkArn=""
2324
secretArn=""
24-
secretKey="password"
25+
secretKey="credentials"
2526
fsxId=""
2627
svmName=""
2728
policyName=""

CloudFormation/NetApp-FSxN-Custom-Resources-Samples/scripts/create_snapshot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ cat <<EOF
1313
Usage: $(basename $0) [-r region] -l link_ARN -s secret_ARN [-k secret_key] -f fsx_id -v svm_name -n volume_name -p snapshot_name -t templete_filename
1414
Notes:
1515
The default region is the region configured in the AWS CLI.
16-
The default secret key is 'password'.
16+
The default secret key is 'credentials'.
1717
EOF
1818
}
1919
#
2020
# Set the default values.
2121
linkArn=""
2222
secretArn=""
23-
secretKey="password"
23+
secretKey="credentials"
2424
fsxId=""
2525
svmName=""
2626
volumeName=""

CloudFormation/NetApp-FSxN-Custom-Resources-Samples/scripts/create_volume

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cat <<EOF
1313
Usage: $(basename $0) [-r region] -l link_ARN -s secret_ARN [-k secret_key] -f fsx_id -v svm_name -n volune_name [-z size_in_MB] [-a aggregate] -t template
1414
Notes:
1515
The default region is the region configured in the AWS CLI.
16-
The default secret key is 'password'.
16+
The default secret key is 'credentials'.
1717
The default aggregate is "aggr1".
1818
The default size is 20MB.
1919
EOF
@@ -22,7 +22,7 @@ EOF
2222
# Set the default values.
2323
linkArn=""
2424
secretArn=""
25-
secretKey="password"
25+
secretKey="credentials"
2626
fsxId=""
2727
volumeName=""
2828
svmName=""

CloudFormation/deploy-fsx-ontap/template.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Metadata:
1313
- ThroughputCapacity
1414
- PrimarySubnet
1515
- SecurityGroupIds
16+
- BackupRetentionDays
17+
- DailyAutomaticBackupStartTime
18+
- WeeklyMaintenanceStartTime
1619
- Label:
1720
default: "Scale Out Only Parameters"
1821
Parameters:
@@ -59,6 +62,21 @@ Parameters:
5962
PrimarySubnet:
6063
Description: "The primary subnet."
6164
Type: "AWS::EC2::Subnet::Id"
65+
66+
BackupRetentionDays:
67+
Description: "The number of days to retain backups for. The default is 30. If set to 0, backups are disabled."
68+
Type: Number
69+
Default: 30
70+
71+
DailyAutomaticBackupStartTime:
72+
Description: "The preferred time, in UTC, to take daily automatic backups. The default is 00:00."
73+
Type: String
74+
Default: "00:00"
75+
76+
WeeklyMaintenanceStartTime:
77+
Description: "The preferred time, in UTC, to perform weekly maintenance. The format d:hh:mm where Monday = 1 and Sunday = 7. The default is 7:00:00."
78+
Type: String
79+
Default: "7:00:00"
6280
#
6381
# Unfortunately, has to be set to type String since it is an optional parameter.
6482
SecondarySubnet:
@@ -97,6 +115,9 @@ Resources:
97115
SubnetIds: [!Ref PrimarySubnet, !If [ MultiAZ, !Ref SecondarySubnet, !Ref "AWS::NoValue" ]]
98116
SecurityGroupIds: !Ref SecurityGroupIds
99117
OntapConfiguration:
118+
AutomaticBackupRetentionDays: !Ref BackupRetentionDays
119+
DailyAutomaticBackupStartTime: !Ref DailyAutomaticBackupStartTime
120+
WeeklyMaintenanceStartTime: !Ref WeeklyMaintenanceStartTime
100121
DeploymentType: !Ref DeploymentType
101122
ThroughputCapacityPerHAPair: !Ref ThroughputCapacity
102123
HAPairs: !If [ ScaleOut, !Ref HAPairs, 1 ]

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ Have a great idea? We'd love to hear it! Please email us at [ng-fsxn-github-samp
2222
* [FSx ONTAP inventory report](/Ansible/fsx_inventory_report)
2323
* [SnapMirror report](/Ansible/snapmirror_report)
2424
* [CloudFormation](/CloudFormation)
25+
* [NetApp-FSxN-Custom-Resources-Samples](/CloudFormation/NetApp-FSxN-Custom-Resources-Samples)
2526
* [deploy-fsx-ontap](/CloudFormation/deploy-fsx-ontap)
2627
* [EKS](/EKS)
28+
* [Backup-EKS-Applications-with-Trident-Protect](/EKS/Backup-EKS-Applications-with-Trident-Protect)
2729
* [FSx for NetApp ONTAP as persistent storage for EKS](/EKS/FSxN-as-PVC-for-EKS)
30+
* [PV-Migrate-with-Trident-Protect](/EKS/PV-Migrate-with-Trident-Protect)
2831
* [Management Utilities](/Management-Utilities)
2932
* [Auto Create SnapMirror Relationships](/Management-Utilities/auto_create_sm_relationships)
3033
* [Auto Set FSxN Auto Grow](/Management-Utilities/auto_set_fsxn_auto_grow)
@@ -36,6 +39,7 @@ Have a great idea? We'd love to hear it! Please email us at [ng-fsxn-github-samp
3639
* [CloudWatch Dashboard for FSx for ONTAP](/Monitoring/CloudWatch-FSx)
3740
* [Export LUN metrics from an FSx ONTAP to Amazon CloudWatch](/Monitoring/LUN-monitoring)
3841
* [Automatically Add CloudWatch Alarms for FSx Resources](/Monitoring/auto-add-cw-alarms)
42+
* [Ingest NAS audit logs into CloudWatch](/Monitoring/ingest_nas_audit_logs_into_cloudwatch)
3943
* [Monitor ONTAP metrics from FSx ONTAP using python Lambda function](/Monitoring/monitor-ontap-services)
4044
* [Monitor FSx for ONTAP with Harvest on EKS](/Monitoring/monitor_fsxn_with_harvest_on_eks)
4145
* [Solutions](/Solutions)

0 commit comments

Comments
 (0)