11# Automatically Set Auto Size mode to Grow on FSx for NetApp ONTAP Volumes
22
33## Introduction
4- This project helps to mitigate the issue of not being able to set the auto size mode
4+ This sample shows one way to mitigate the issue of not being able to set the auto size mode
55on an FSxN volume when creating it from the AWS console or API. It does this by providing
66a Lambda function that will set the mode for you, and instructions on how to set up a
77CloudWatch event to trigger the Lambda function whenever a volume is created. With this
@@ -11,6 +11,13 @@ set up the way you want for all volumes.
1111## Set Up
1212There are just a few things you have to do to set this up:
1313
14+ ### Create secrets in AWS Secrets Manager
15+ Create a secret in Secrets Manager for each of the FSxN file systems you want to manage with
16+ this script. Each secret should have the key value pairs. One that specifies the
17+ user account to use when issuing API calls, and the other that specifies the password for
18+ that account. Note that if you use the same username and password, it is okay
19+ to use the same secret for multiple file systems.
20+
1421### Create a role for the Lambda function
1522The Lambda function doesn't leverage that many AWS services, so only a few permissions are required:
1623
@@ -37,24 +44,35 @@ FSxN file system is attached to.
3744### Create the Lambda Function
3845Create a Lambda function with the following parameters:
3946
40- - Authored from scratch
41- - Uses the Python runtime
47+ - Authored from scratch.
48+ - Uses the Python runtime.
4249- Set the permissions to the role created above.
43- - Enable VPC. Found under the Advanced Settings
44- - Attached to the VPC that contains the FSxN file system
45- - Attached to the Subnets that contain the FSxN file system.
46- - Attached a security group that allows access from any IP within the two subnets.
50+ - Enable VPC. Found under the Advanced Settings.
51+ - Attached to the VPC that contains the FSxN file system
52+ - Attached to the Subnets that contain the FSxN file system.
53+ - Attached a security group that allows access from any IP within the two subnets.
4754
4855After you create the function, you will be able to insert the code included with this
49- project into the code box. Once you have inserted the code, modify the "secretsTable"
50- array to provide the secrets name, and the keys for the username as password for each
51- of the FSxN File Systems that you want to manage with this script. Also, set the
52- secretsManagerRegion variable to the region where your secrets are stored. Finally
53- set the auto size parameters (autoSizeMode, growThresholdPercentage,
54- maxGrowSizePercentage, shrinkThresholdPercentage, minShrinkSizePercentage and
55- maxWaitTime) as you see fit. NOTE: Do note delete the variables
56- or set them to None or empty strings, as the script will fail to run appropriately
57- if done so.
56+ sample into the code box. Once you have inserted the code, modify the definitions
57+ of the following variables to suit your needs:
58+ - secretsTable - This is an array that defines the secrets created above. Each element in the array
59+ is a dictionary with the following keys:
60+ - secretName - The name of the secret in Secrets Manager.
61+ - usernameKey - The name of the key in the secret that contains the username.
62+ - passwordKey - The name of the key in the secret that contains the password.
63+ - secretsManagerRegion - Defines the region where your secrets are stored.
64+ - autoSizeMode - Defines the auto size mode you want to set the volume to. Valid values are:
65+ - grow - The volume will automatically grow when it reaches the grow threshold.
66+ - grow_shrink - The volume will automatically grow and shrink when it eachs the shrink threshold.
67+ - off - The volume will not automatically grow or shrink.
68+ - growThresholdPercentage - The percentage of the volume that must be used before the volume will grow.
69+ - maxGrowSizePercentage - The maximum size the volume can auto grow to expressed in terms of a percentage of the volume size. The default is 200%.
70+ - shrinkThresholdPercentage - The percentage of the volume that must be used before the volume will shrink.
71+ - minShrinkSizePercentage - The minimum size the volume can auto shrink to expressed in terms of a percentage of the volume size. The default is 50%.
72+ - maxWaitTime - The maximum time, in seconds, the script will wait for the volume to be created before it will give up and exit.
73+
74+ ** NOTE:** Do not delete the variables or set them to None or empty
75+ strings, as the script will not run properly if done so.
5876
5977Once you have updated the program, click on the "Deploy" button.
6078
0 commit comments