Skip to content

Commit d8c08c4

Browse files
committed
Clarified some of the documentation.
1 parent e21f2e7 commit d8c08c4

File tree

1 file changed

+35
-18
lines changed
  • Management-Utilities/auto_set_fsxn_auto_grow

1 file changed

+35
-18
lines changed

Management-Utilities/auto_set_fsxn_auto_grow/README.md

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ ONTAP side, either using the ONTAP CLI, System Manager, or REST API. So, it is a
1313
if you are creating them that way, that you will set them with the auto size mode set
1414
the way you want.
1515

16-
Note that since the Lambda function has to communicate with the FSx for ONTAP management
16+
Since the Lambda function has to communicate with the FSx for ONTAP management
1717
endpoint, it has to run within a VPC that has that connectivity. Because of the way
1818
AWS allows a Lambda function to run within a VPC, it will not have access to the Internet
19-
even if normally from that subnet it is running in would. Therefore, you will have to set up
20-
VPC endpoints for the AWS services that the Lambda function will need to communicate with.
21-
This includes:
19+
even if normally it would from that subnet. Therefore, you will have to set up
20+
VPC endpoints for the AWS services that the Lambda function uses. This includes:
2221
- FSx
2322
- AWS Secrets Manager
2423
- DynamoDB if you are using it to store the secrets table
2524

26-
These endpoints are created for you if you use the CloudFormation template provided in this
27-
repository. If you are setting up the Lambda function manually, you will have to create
28-
these endpoints yourself.
25+
If you use the CloudFormation template provided in this repository to deploy the sample
26+
you will be given the option to have it create these service endpoints for you. If you are
27+
setting up the Lambda function manually, you will have to create these endpoints yourself.
28+
29+
Note that you can only have one service endpoint per service per VPC. So, don't attempt
30+
to add one if one already exists for the VPC you are going to run the Lambda function in.
2931

3032
The way this script authenticates to the FSx for ONTAP management endpoint is by using
3133
the credentials stored in AWS Secrets Manager. Since it can manage multiple FSxN file
@@ -49,6 +51,11 @@ Where the values associated with each key are as follows:
4951
| `usernameKey` | The key in the secret that contains the username. | `username` |
5052
| `passwordKey` | The key in the secret that contains the password. | `password` |
5153

54+
:bulb: **NOTE:** If you are going to maintain the `secretsTable` in the source code, and use the
55+
CloudFormation template to deploy the Lambda function, you will have to update the `secretsTable`
56+
variable in the code after the CloudFormation stack is created. Or, edit the source code within
57+
the Cloudformation template itself.
58+
5259
## Deployment
5360
There are two ways to deploy this script. The first way to is use the CloudFormation
5461
template provided in the `cloudformation.yaml` file. The second way is to follow the
@@ -72,9 +79,9 @@ so you might want to keep it short, but meaningful. After the stack name you wil
7279
| secretsManagerRegion| The region where the AWS Secrets Manager secrets are located. |
7380
| createWatchdogAlarm | If set to `true` a CloudWatch alarm will be created that will trigger if the Lambda function fails while trying to set the auto size mode on a volume. |
7481
| snsTopicArn| The ARN of the SNS topic that the CloudWatch alarm will send a message to if the Lambda function fails. |
75-
| createSecretManagerEndpoint| If set to `true` a Secrets Manager VPC endpoint will be created. |
76-
| createFSxEndpoint| If set to `true` a FSx VPC endpoint will be created. |
77-
| createDynamoDbEndpoint| If set to `true` a DynamoDB VPC endpoint will be created. |
82+
| createSecretManagerEndpoint| If set to `true` a Secrets Manager VPC endpoint will be created. Note that you can only have one VPC service endpoint per service per VPC. |
83+
| createFSxEndpoint| If set to `true` a FSx VPC endpoint will be created. Note that you can only have one VPC service endpoint per service per VPC. |
84+
| createDynamoDbEndpoint| If set to `true` a DynamoDB VPC endpoint will be created. Note that you can only have one VPC service endpoint per service per VPC. |
7885
| routeTableIds| Since the DynamoDB endpoint is a `Gateway` type, routing tables have to be updated to use it. Set this parameter to any route table IDs you want updated. |
7986
| endpointSecurityGroupIds| The security group that the VPC endpoints will use. This security group should allow access to the AWS service the endpoints from the Lambda function over port 443. Since the Lambda function will have the security group specified above assigned to it, it can be used as a network `source` for this security group. |
8087
| autoSizeMode| The auto size mode you want to set the volume to. Valid values are: `grow`, `grow_shrink`, and `off`. |
@@ -87,11 +94,18 @@ so you might want to keep it short, but meaningful. After the stack name you wil
8794
Once you have filled in these parameters, click `Next`. On the next page you must accept that this
8895
template can, and does, create roles. Click `Next`. Finally, on the last page, you can review the stack and click `Submit`.
8996

90-
After the stack has been created everything should be ready. To test, simply create a volume in the
91-
AWS console and check from the ONTAP CLI that auto size mode appropriately. If it isn't set, check the CloudWatch
92-
logs for the Lambda function to see what went wrong. You can quickly go to the correct Lambda
93-
function by clicking on the Resources tab within the CloudFormation stack and clicking on the
94-
link to the Lambda function.
97+
After the stack has been created if you plan to maintain the `secretsTable` within the source code, now would
98+
be the best time to modify it. To do so, go to the Lambda service, find the Lambda function (the name
99+
will start with "auto-set-fsxn-auto-grow" and end with the name you gave the CloudFormation stack)
100+
and use the inline editor to modify the `secretsTable` variable.
101+
102+
To test the function, simply create a volume in the AWS console and check from the ONTAP CLI
103+
that auto size mode appropriately. If it isn't set, check the CloudWatch
104+
logs for the Lambda function to see what went wrong.
105+
106+
:warning: **NOTE:** This program is expecting to be called by a CloudWatch event, if you just click
107+
on the `Test` button within the Lambda console, it will fail since the 'event' structure will not
108+
be set appropriately.
95109

96110
### Manual Setup
97111
If for some reason you can't run the CloudFormation template, here are the steps you can use to manually setup the service:
@@ -127,6 +141,9 @@ function will run in:
127141
- SecretsManager
128142
- DynamoDB - You only need this one if you are going to store your `secretsTable` in DynamoDB. It is recommended that this be a `Gateway` type endpoint. However, if you do that you will also have to update the routing tables associated with the subnets that the Lambda function is deployed on in order for the Lambda function to be able to use it.
129143

144+
:warning: Note that you can only have one service endpoint per service per VPC. So, don't attempt
145+
to add one if one already exists for the VPC you are going to run the Lambda function in.
146+
130147
#### Create the Lambda Function
131148
Create a Lambda function with the following parameters:
132149

@@ -147,8 +164,8 @@ is a dictionary with the following keys:
147164
- usernameKey - The name of the key in the secret that contains the username.
148165
- passwordKey - The name of the key in the secret that contains the password.
149166

150-
**NOTE:** Instead of defining the secretsTable in the script, you can define
151-
dynamoDbSecretsTableName and dynamoDbRegion and the script will read in the
167+
:bulb: **NOTE:** Instead of defining the secretsTable in the code, you can define
168+
dynamoDbSecretsTableName and dynamoDbRegion and the program will read in the
152169
secretsTable information from the specified DynamoDB table. The table should have
153170
the same fields as the `secretsTable` defined above.
154171

@@ -163,7 +180,7 @@ the same fields as the `secretsTable` defined above.
163180
- minShrinkSizePercentage - The minimum size the volume can auto shrink to, expressed in terms of a percentage of the initial volume size.
164181
- maxWaitTime - The maximum time, in seconds, the script will wait for the volume to be created before it will give up and exit.
165182

166-
**NOTE:** Do not delete the variables or set them to None or empty strings, as the script will not run properly if done so.
183+
:warning: **NOTE:** Do not delete the variables or set them to None or empty strings, as the script will not run properly if done so.
167184

168185
Once you have updated the program, click on the "Deploy" button.
169186

0 commit comments

Comments
 (0)