-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaws.py
More file actions
72 lines (50 loc) · 1.92 KB
/
aws.py
File metadata and controls
72 lines (50 loc) · 1.92 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import os
import getpass
def main():
print("\t\t\tWelcome to the TUI to make Life Easier")
print("\t\t\t--------------------------------------")
print("\t\t\t\t\tMenu")
print("\t\t\t\t\t----")
print("""
Press 1 : To Login into AWS CLI
Press 2 : To Launch a instance
Press 3 : To Start a Instance
Press 4 : To Stop a Instance
Press 5 : To Describe All Instances
Press 6 : Exit
""")
print("Enter Your Choice : ",end="")
ch=input()
if int(ch) == 1:
os.system("aws configure")
elif int(ch) == 2:
print("""
Press 1:AWS Linux
Press 2:Redhat Linux
""")
print("Enter your Choice : ",end="")
img=input()
if int(img) ==1:
print("Enter Your Key name: ",end ="")
key = input()
os.system("aws ec2 run-instances --image-id ami-0f9fc25dd2506cf6d --subnet-id subnet-02c8d39202cd28ae7 --instance-type t2.micro --key-name {} --security-group-ids sg-0cfb581ea9318d7f3 --count 1".format(key))
elif int(img) == 2:
print("Enter Your Key name: ",end ="")
key = input()
os.system("aws ec2 run-instances --image-id ami-0b0af3577fe5e3532 --subnet-id subnet-02c8d39202cd28ae7 --instance-type t2.micro --key-name {} --security-group-ids sg-0cfb581ea9318d7f3 --count 1".format(key))
elif int(ch) == 3:
print("Enter Instance Id : ",end = "")
uid = input()
os.system(" aws ec2 start-instances --instance-id {}".format(uid))
elif int(ch) == 4:
print("Enter Instance Id : ",end = "")
uid = input()
os.system(" aws ec2 stop-instances --instance-id {}".format(uid))
elif int(ch) == 5:
os.system("aws ec2 describe-instances")
elif int(ch) == 6:
exit()
else:
print("You Entered Wrong Choice ...")
if __name__=='__main__':
main()