Skip to content

Commit 402a30d

Browse files
authored
Create README.md
1 parent ecae2bf commit 402a30d

File tree

1 file changed

+71
-0
lines changed
  • Management-Utilities/ec2-user-data-iscsi-create-and-mount

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# EC2 User data scripts
2+
3+
## Introduction
4+
Those samples provides a way to launch AWS EC2 instances with user data scripts that will create FSXn volume mount it to the instance,
5+
while installing all the needed libraries and resources
6+
7+
## Set Up
8+
Create secet in AWS secret manager, secret should be saved as text.
9+
In IAM create policy that will allow to read the secret.
10+
Set the following permissions:
11+
12+
Example AWS Policy
13+
{
14+
"Version": "2012-10-17",
15+
"Statement": [
16+
{
17+
"Sid": "VisualEditor0",
18+
"Effect": "Allow",
19+
"Action": [
20+
"secretsmanager:GetSecretValue"
21+
],
22+
"Resource": "arn:aws:secretsmanager:us-west-2:847548833:secret:test/posh-75WJ57"
23+
}
24+
]
25+
}
26+
27+
1. AWS Amazon Linux
28+
First, get the needed script according to the instance type you want to run.
29+
Set the following values in the script:
30+
- SECRET_NAME - Secret name has it been saved in AWS secret manager
31+
- AWS_REGION - AWS secret manager region
32+
- FSXN_ADMIN_IP - FSXn administrator IP
33+
- VOLUME_NAME - The name of the volume you want to create in your FSXn.
34+
- VOLUME_SIZE - The size of the volume you want to create in GB e.g [100g]
35+
- SVM_NAME - The SVM name, if you have another SVM which is not the default 'fsx'.
36+
37+
Save the script file.
38+
In AWS console EC2 - Launch new instance fill server name and select 'Windows' select 'Microsoft Windows Server 2025 Base' fill any other needed data,
39+
Go to 'IAM instance profile' and create or use instance profile with the policy you have just created.
40+
Go to Advanced details and scroll down to User data, press 'choose file' select the script file you have saved.
41+
Launch the instance.
42+
The installation log file can be found at: /home/ec2-user/output.txt
43+
If an error occurs while the installation is running, the process will be terminated and all installations and setup will roll back.
44+
45+
2. AWS Microsoft Windows Server 2025
46+
Set the following values in the script:
47+
- $ip - FSXn administrator IP
48+
- $password - FSXn administrator password
49+
- $volName - The name of the volume you want to create in your FSXn.
50+
- $volSize - The size of the volume you want to create in GB e.g [100]
51+
- $drive_letter - The drive letter to assign to the volume.
52+
53+
Save the script file.
54+
55+
In AWS console EC2 -
56+
57+
For Linux installation:
58+
- Launch new instance fill in the server name and select 'Amazon Linux' then select under Amazon Machine Image select 'Amazon Linux 2023 AMI' fill in any other required data,
59+
Go to 'IAM instance profile' and create or use instance profile with the policy you have just created.
60+
Go to Advanced details and scroll down to User data, press 'choose file', and select the script file you have saved.
61+
Launch the instance.
62+
The installation log file can be found at: /home/ec2-user/install.log
63+
64+
For Windows installation:
65+
- Launch new instance fill in the server name and select 'Windows', then select under Amazon Machine Image select 'Windows Server 2025 Base', fill in any other required data,
66+
go to Advanced details and scroll down to User data, press 'choose file', and select the script file you have saved.
67+
Launch the instance.
68+
The installation log file can be found at: C:\Users\Administrator\install.log
69+
70+
71+

0 commit comments

Comments
 (0)