-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyesnov2.sh
More file actions
executable file
·47 lines (43 loc) · 1.05 KB
/
yesnov2.sh
File metadata and controls
executable file
·47 lines (43 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
echo "create new pem file (Yes/no)"
read x
function f1()
{
read y
if [[ $y =~ ^[Yy][eE][sS]$ ]]
then
echo "Please enter the name of key-pair to be created:"
read kp
aws ec2 create-key-pair --key-name $kp --query 'KeyMaterial' --output text > $kp.pem
echo -e "\n\n\n"
echo "Key-pair Created SuccessFully.\n "
chmod 400 $kp.pem
mv $kp.pem ~/
elif [[ $y =~ ^[nN][oO] ]]
then
echo "enter name of pem file | Just name - don't include .pem extension"
read kp
echo $kp.pem
else
echo "Please type yes or no"
f1
fi
}
echo # (optional) move to a new line
if [[ $x =~ ^[Yy][eE][sS]$ ]]
then
echo "Please enter the name of key-pair to be created:"
read kp
aws ec2 create-key-pair --key-name $kp --query 'KeyMaterial' --output text > $kp.pem
echo "\n\n\n"
echo "Key-pair Created SuccessFully.\n "
chmod 400 $kp.pem
mv $kp.pem ~/
elif [[ $x =~ ^[nN][oO] ]]
then
echo "enter name of pem file | Just name - don't include .pem extension"
read kp
echo $kp.pem
else
echo "Please type yes or no"
f1
fi