Skip to content

Commit 0c78c68

Browse files
committed
Update volume_Limit_calculator.sh
Adding gp3 volume type section.
1 parent 5c65e42 commit 0c78c68

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

EBS/VolumeLimitCalculator/volume_Limit_calculator.sh

+68-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ verify_input_as_integers () {
4141
if ! [[ "$1" =~ ^[0-9]+$ ]]
4242
then
4343
echo -e "+----------------------------------------------------+\n"
44-
echo "> Sorry, volume Size and provisioned IOPS needs to be an interger value."
44+
echo "> Sorry, volume Size, provisioned IOPS and provisioned throughput needs to be an interger value."
4545
echo -e "\n+----------------------------------------------------+"
4646
exit 1
4747
fi
@@ -104,6 +104,63 @@ fi
104104

105105
############################################################
106106

107+
calculate_gp3_limits () { # Calculating limits for Gp3 volume type
108+
109+
if [[ $volumeSize -lt 1 || $volumeSize -gt 16384 ]]
110+
then
111+
echo -e "+----------------------------------------------------+\n"
112+
echo -e "> Volume size for $volumeType can not be less than 1GiB or greater than 16384GiB"
113+
echo -e "\n+----------------------------------------------------+"
114+
exit 1
115+
fi
116+
117+
if [[ -z $volumeIOPS ]]
118+
then
119+
volumeIOPS=3000 # Set IOPS as Baseline(3000) for gp3 volume if it was created using CLI without provisioned IOPS .
120+
else
121+
verify_input_as_integers $volumeIOPS
122+
if [[ $volumeIOPS -lt 3000 || $volumeIOPS -gt 64000 ]]
123+
then
124+
echo -e "+----------------------------------------------------+\n"
125+
echo -e "> Provisioned IOPS can not be less than 3000 or greater than 16000 for Gp3 volume type.."
126+
echo -e "\n+----------------------------------------------------+"
127+
exit 1
128+
elif [[ $((volumeIOPS / volumeSize)) -gt 500 ]]
129+
then
130+
echo -e "+----------------------------------------------------+\n"
131+
echo -e "> Maximum ratio of 500:1 is permitted between IOPS and volume size for Gp3 volume type."
132+
echo -e "\n+----------------------------------------------------+"
133+
exit 1
134+
fi
135+
fi
136+
137+
if [[ -z $volumeThroughput ]]
138+
then
139+
volumeThroughput=125 # Set Throughput as Baseline(125MiB/s) for gp3 volume if it was created using CLI without provisioned Throughput .
140+
else
141+
verify_input_as_integers $volumeThroughput
142+
if [[ $volumeThroughput -lt 125 || $volumeThroughput -gt 1000 ]]
143+
then
144+
echo -e "+----------------------------------------------------+\n"
145+
echo -e "> Provisioned throughput can not be less than 125MiB/s or greater than 1000MiB/s for Gp3 volume type.."
146+
echo -e "\n+----------------------------------------------------+"
147+
exit 1
148+
elif [[ $((volumeIOPS / volumeThroughput)) -lt 4 ]]
149+
then
150+
echo -e "+----------------------------------------------------+\n"
151+
echo -e "> Maximum ratio of 0.25:1 is permitted between Throughput (MiBps) and IOPS for Gp3 volume type."
152+
echo -e "\n+----------------------------------------------------+"
153+
exit 1
154+
fi
155+
fi
156+
157+
echo -e "+----------------------------------------------------+\n"
158+
echo -e "> Maximum available IOPS for your volume are $volumeIOPS"
159+
echo -e "> Maximum Available throughput is $volumeThroughput MiB/s"
160+
echo -e "\n+----------------------------------------------------+"
161+
}
162+
############################################################
163+
107164
calculate_io_limits () {
108165

109166
if [[ $volumeIOPS -lt 100 || $volumeIOPS -gt 64000 ]]
@@ -219,6 +276,16 @@ case "$volumeType" in
219276
verify_input_as_integers $volumeSize
220277
calculate_gp2_limits # Calling gp2 function to calculate maximum limits.
221278
;;
279+
[gG][pP][3]) # If answer is gp2
280+
echo -e "Enter Volume Size in GiB:"
281+
read volumeSize
282+
verify_input_as_integers $volumeSize
283+
echo -e "Enter Provisioned IOPS, if volume was created via CLI without provisioned IOPS please press Enter:"
284+
read volumeIOPS
285+
echo -e "Enter Provisioned Throughput, if volume was created via CLI without provisioned Throughput please press Enter:"
286+
read volumeThroughput
287+
calculate_gp3_limits # Calling gp2 function to calculate maximum limits.
288+
;;
222289
[iI][oO][12]) # If answer is io1
223290
echo -e "Enter Provisioned IOPS:"
224291
read volumeIOPS

0 commit comments

Comments
 (0)