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/ec2-user-data-iscsi-create-and-mount/README.md
+53-20Lines changed: 53 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,13 @@ These sample scripts provide a way to launch an AWS EC2 instance with `user data
5
5
volume and LUN, mount it to the instance, while installing all the needed libraries and resources.
6
6
7
7
## Notes
8
-
- LUN size will be set to 90% of the volume size, the remain space is needed for the the LUN managment operation.
9
-
This means that usuable volume size is 90% of the requestd size.
10
-
- The process might take several minutes to be compleetd.
8
+
- LUN size will be set to 90% of the volume size, the remaining space is needed for the LUN management operation.
9
+
This means that usable volume size is 90% of the requested size.
10
+
- The process might take several minutes to be complete.
11
11
12
-
## Set Up
13
-
1. Create an AWS SecretsManager secret to hold the password of the account you plan to use to authenicate to the FSxN file system with.
12
+
## Preperation
13
+
14
+
1. Create an AWS SecretsManager secret to hold the password of the account you plan to use to authenticate to the FSxN file system with.
14
15
The secret should be of type `other` with value set to `Plain Text` that holds just the password.
15
16
2. Create an AWS IAM role that has EC2 as the trusted entity and has permissions to read the secret value. Here is an example policy that will do that:
16
17
```json
@@ -30,41 +31,55 @@ The secret should be of type `other` with value set to `Plain Text` that holds j
30
31
```
31
32
Replace the "Resource" ARN with the ARN of your secret.
32
33
33
-
3. Download the needed script according to the instance type you want to run (Linux or Windows).
34
+
## Deployment Options
35
+
36
+
There are two ways to deploy an EC2 instance with the needed user data script:
37
+
1. Copy the CloudFormation template found in the repo [EC2-cloud_formation.yaml](EC2-cloud_formation.yaml) to you local machine and deploy a CloudFormation stack using it. CloudFormation will prompt you for all the required parameters.
38
+
2. Follow the instruction below to deploy an EC2 instance from the AWS console.
39
+
40
+
## AWS console deployment
41
+
42
+
1. Download the needed script according to the instance type you want to run. Either [linux_userData.sh](linux_userData.sh)
43
+
for a Linux distribution or [windows_userData.ps1](windows_userData.ps1) for Windows. The Linux script has been tested
44
+
with `Amazon Linux 2023`, `Ubuntu 24.04`, `Red Hat Enterprise Linux 10` and `Debian 13` distributions,
45
+
while the Windows script is designed for `Windows Server 2025 Base`.
46
+
47
+
Note that since AWS has a 16KB limit for the user data the linux_userData.sh script is made up of the variable
48
+
assignment noted below, and a compressed, base64 encoded version of the `linux_userData_real.sh` script. When the
49
+
`linux_userData.sh` script is run, it will decode and uncompress what was the `linux_userData_real.sh` script
50
+
and run it.
51
+
52
+
Once you have downloaded the script, open it in a text editor and set the required values as noted below.
34
53
35
54
For the Linux version of the script, set the following values at the top of it:
36
-
- SECRET_NAME - Secret name has has the password for the `ONTAP-USER`.
37
-
- AWS_REGION - AWS secret manager region.
55
+
- SECRET_ARN - The ARN of the secret that has the password for the `ONTAP-USER`.
38
56
- FSXN_ADMIN_IP - IP address, or hostname, of the FSxN management endpoint.
39
57
- VOLUME_NAME - The name of the volume you want to create in your FSxN.
40
-
- VOLUME_SIZE - The size of the volume you want to create in GB e.g [100g]
58
+
- VOLUME_SIZE - The size of the volume you want to create in GB e.g [100]
41
59
- SVM_NAME - The name of the SVM where the volume is to be created.
42
-
- ONTAP_USER - The ONTAP user id you wish to authenicate with.
60
+
- ONTAP_USER - The ONTAP user id you wish to authenticate with.
43
61
44
62
For the Windows version of the script, set the following values at the top of it:
45
63
- $secretId - secret ARN that holds the password for the `$user`.
46
64
- $ip - IP address, or hostname, of the FSxN management endpoint.
47
65
- $volName - The name of the volume you want to create in your FSxN.
48
66
- $volSize - The size of the volume you want to create in GB e.g [100]
49
67
- $drive_letter - The drive letter to assign to the volume.
50
-
- $user - The ONTAP user id you wish to authenicate with.
68
+
- $user - The ONTAP user id you wish to authenticate with.
51
69
- $svm_name - The name of the SVM where the volume is to be created.
52
70
53
-
4. Save the script file.
71
+
2. Save the script file.
54
72
55
-
## On AWS console EC2
56
-
57
73
### For Linux installation:
58
74
<ol>
59
75
<li>Launch new instance
60
76
<ol>
61
77
<li>Fill in the server name.</li>
62
-
<li>Select 'Amazon Linux'.</li>
63
-
<li>Under Amazon Machine Image select 'Amazon Linux 2023 AMI'.</li>
78
+
<li>Under the Quick Start tab select the Linux distribution of your choice. The supported distributions are: `Amazon Linux 2023`, `Ubuntu 24.04`, `Red Hat Enterprise Linux 10` and `Debian 13`</li>
64
79
<li>Fill in the other settings based on your networking and business needs.</li>
65
80
<li>Under 'Advanced details':
66
81
<ol>
67
-
<li>Set the 'IAM instance profile' to the policy you created in the steps above.</li>
82
+
<li>Set the 'IAM instance profile' to the policy you created in the preperation step above.</li>
68
83
<li>At the bottom, under the 'User data' section, press 'choose file' and select the script saved above.</li>
69
84
</ol>
70
85
</li>
@@ -73,7 +88,7 @@ The secret should be of type `other` with value set to `Plain Text` that holds j
73
88
<li>Launch the instance.</li>
74
89
</ol>
75
90
76
-
The installation log file can be found at: `/home/ec2-user/install.log`.
91
+
The installation log file can be found at: `/var/log/iscsi-install.log`.
77
92
If an error occurs while the installation is running, the script will terminate and all installations and setup will roll back.
78
93
79
94
### For Windows installation:
@@ -96,6 +111,24 @@ If an error occurs while the installation is running, the script will terminate
96
111
</ol>
97
112
98
113
The installation log file can be found at: `C:\Users\Administrator\install.log`.
99
-
If an error occurs while the installation is running, a message will be inserted into the installation log file, it will attempt to roll back any work that it preformed, finally the script will terminate.
114
+
If an error occurs while the installation is running, a message will be inserted into the
115
+
installation log file, it will attempt to roll back any work that it preformed, finally the script will terminate.
116
+
117
+
**Note:** It can take 10 to 15 minutes for the script to complete. Check the installation log file to confirm it is done.
118
+
The line `Uninstall script removed` should be at the bottom of the file when the script has finished.
119
+
120
+
## Author Information
121
+
122
+
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors).
123
+
124
+
## License
125
+
126
+
Licensed under the Apache License, Version 2.0 (the "License").
127
+
128
+
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
129
+
130
+
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.
131
+
132
+
See the License for the specific language governing permissions and limitations under the License.
100
133
101
-
**Note:** It can take 20 to 30 minutes for the script to compplete. Check the installation log file to confirm it is done. The line `Uninstall script removed` should be at the bottom of the file when the script has finished.
0 commit comments