-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.py
601 lines (583 loc) · 21.7 KB
/
server.py
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
import subprocess as sp
import os
def program():
os.system("export TERM=xterm;clear")
print("\t\t\t\t\tWELCOME TO SERVER-WORLD")
print("\t\t\t\t\t-----------------------")
print("""
1) Press 1 For BASIC LINUX COMMANDS
2) Press 2 For HADOOP SERVICES with LVM SERVICE
3) Press 3 For WEB SERVICES
4) Press 4 DOCKER WORLD
5) Press 5 LVM SERVICES
6) Press 6 AWS SEVICES
7) Press 7 Exit""")
x = int(input("ENTER YOUR CHOICE:"))
if x==1:
def linux_commands():
os.system("export TERM=xterm;clear")
print("\t\t\t\tWELCOME TO WORLD OF LINUX")
print("""
A) Press 1 For Calender
B) Press 2 For Date
C) Press 3 For Calculator
D) Press 4 For Creating a New User
E) Press 5 For Deleting User
F) Press 6 To login in another user
D) Press 7 For For Checking System IP
E) Press 8 For Ping
F) Press 9 For Deleting Directory
G) Press 10 For Making Directory
H) Press 11 For reading a file content
I) Press 12 For creating a file
J) Press 13 For View all Disk Partitions in Linux
K) Press 14 For View Specific Disk Partition in Linux
L) Press 15 For Checking File System Disk Space Usage
M) Press 16 For Installing Software Using yum
N) Press 17 For Uninstalling Software Using yum
O) Press 18 For Finding Path Of Software Installed In Linux
P) Press 19 For Running Python Live Interpreter
Q) Press 20 To Run Browser
R) Press 21 For Back""")
print()
y=int(input("ENTER YOUR CHOICE : "))
if y==1:
print()
os.system("cal")
elif y==2:
print()
os.system("date")
elif y==3:
print()
os.system("bc")
elif y==4:
print()
user_name=input("ENTER THE USER NAME : ")
os.system(f"useradd {user_name};id {user_name}")
elif y==5:
print()
user_name=input("ENTER THE USER NAME To DELETE : ")
os.system(f"userdel {user_name}")
elif y==6:
print()
user_name=input("ENTER THE USER NAME To LOGIN : ")
os.system(f"passwd {user_name}")
elif y==7:
print()
os.system("ifconfig")
elif y==8:
print()
pong = input("ENTER THE IP OR HOSTNAME YOU WANT TO PING : ")
print()
os.system(f"ping {pong}")
elif y==9:
print()
dir1 = input("ENTER YOUR DIRECTORY NAME TO DELETE : ")
os.system(f"rm -rf {dir1}")
elif y==10:
dir1 = input(" GIVE NAME OF YOUR DIRECTORY WITH PATH : ")
os.system(f"mkdir {dir1}")
elif y==11:
print()
filename = input("ENTER THE FILE PATH YOU WANT TO READ : ")
print()
os.system(f"cat {filename}")
elif y==12:
print()
filename = input("ENTER THE FILE PATH YOU WANT TO CREATE : ")
os.system(f"vi {filename}")
elif y==13:
print()
os.system("fdisk -l")
elif y==14:
print()
diskName = input("ENTER DISK NAME LIKE '/dev/sdb' : ")
print()
os.system(f"fdisk -l {diskName}")
elif y==15:
print()
os.system("df -h")
elif y==16:
print()
software_name = input("ENTER THE SOFTWARE NAME U WANT TO INSTALL : ")
print()
os.system(f"yum install {software_name}")
elif y==17:
print()
software_name = input("ENTER THE SOFTWARE NAME U WANT TO UNISTALL : ")
print()
os.system(f"yum remove {software_name}")
elif y==18:
print()
software_name = input("ENTER THE SOFTWARE NAME : ")
print()
os.system(f"rpm -q {software_name}")
elif y==19:
os.system("python3")
elif y==20:
os.system("firefox")
elif y==21:
program()
else:
print("\nYou Entered Wrong Choice ...")
linux_commands()
elif x==2:
def hadoop():
os.system("export TERM=xterm;clear")
print("\t\t\t\tWELCOME TO HADOOP WORLD")
print("""
A) Press 1 For Starting Datanode Services
B) Press 2 For Starting Namenode Services
C) Press 3 For Client Services
D) Press 4 To Check Cluster Report
E) Press 5 To Stop Datanode
F) Press 6 To Stop Namenode
G) Press 7 Back""")
print()
y=int(input("ENTER YOUR CHOICE : "))
if y==1:
jdk = sp.getstatusoutput("jps")
if jdk[0]==127:
print("jdk installing")
sp.getoutput("rpm -ivh jdk-8u171-linux-x64.rpm")
else:
pass
hadoop = sp.getstatusoutput("hadoop version")
if hadoop[0]==127:
sp.getoutput("rpm -ivh hadoop-1.2.1-1.x86_64.rpm --force;rm /etc/hadoop/hdfs-site.xml;rm /etc/hadoop/core-site.xml")
else:
pass
print()
disk_name=input("ENTER THE DEVICE NAME FOR SHARING STORAGE : ")
print()
storage_size=int(input("ENTER THE STORAGE SIZE YOU WANT TO SHARE : "))
print()
os.system(f"pvcreate {disk_name};vgcreate user_vg {disk_name};lvcreate --size +{storage_size}G ---name user_LVM user_vg;mkfs.ext4 /dev/user_vg/user_LVM")
print()
dataip=input("ENTER THE IP ADDRESS OF NAMENODE : ")
print()
dataport=int(input("ENTER THE PORT NO :"))
print()
datadir=input("ENTER THE DIRECTORY NAME YOU WANT : ")
print("\n\n...........WAIT YOUR DATA NODE IS STARTING................")
sp.getoutput(f"rm -rf /{datadir};mkdir /{datadir};mount /dev/user_vg/user_LVM /{datadir};df -h;echo 3 >/proc/sys/vm/drop_caches")
datafile=open("/etc/hadoop/hdfs-site.xml", 'w')
datafile.write(f'''<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.data.dir</name>
<value>/{datadir}</value>
</property>
</configuration>''')
datafile.close()
datafile1=open("/etc/hadoop/core-site.xml", 'w')
datafile1.write(f'''<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://{dataip}:{dataport}</value>
</property>
</configuration>''')
datafile1.close()
sp.getoutput("hadoop-daemon.sh start datanode;hadoop-daemon.sh stop datanode;hadoop-daemon.sh start datanode;systemctl stop firewalld;setenforce 0")
os.system("jps")
print("\n\n------------------Datanode Is Started--------------")
elif y==2:
jdk = sp.getstatusoutput("jps")
if jdk[0]==127:
print("jdk installing")
sp.getoutput("rpm -ivh jdk-8u171-linux-x64.rpm")
else:
pass
hadoop = sp.getstatusoutput("hadoop version")
if hadoop[0]==127:
sp.getoutput("rpm -ivh hadoop-1.2.1-1.x86_64.rpm --force;rm /etc/hadoop/hdfs-site.xml;rm /etc/hadoop/core-site.xml")
else:
pass
print()
nameip=input("\nENTER THE IP ADDRESS TO GIVE MASTER : ")
print()
nameport=int(input("\nENTER THE PORT NO :"))
print()
namedir=input("\nENTER THE DIRECTORY NAME YOU WANT : ")
sp.getoutput(f"rm -rf /{namedir};mkdir /{namedir}")
datafile=open("/etc/hadoop/hdfs-site.xml", 'w')
datafile.write(f'''<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.name.dir</name>
<value>/{namedir}</value>
</property>
</configuration>''')
datafile.close()
datafile1=open("/etc/hadoop/core-site.xml", 'w')
datafile1.write(f'''<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://{nameip}:{nameport}</value>
</property>
</configuration>''')
datafile1.close()
sp.getoutput("echo Y |hadoop namenode -format;echo 3>/proc/sys/vm/drop_caches;systemctl stop firewalld;setenforce 0;hadoop-daemon.sh start namenode")
print()
os.system("jps")
print("\n\n--------------Namenode Is Started----------")
elif y==3:
jdk = sp.getstatusoutput("jps")
if jdk[0]==127:
print("jdk installing")
sp.getoutput("rpm -ivh jdk-8u171-linux-x64.rpm")
else:
pass
hadoop = sp.getstatusoutput("hadoop version")
if hadoop[0]==127:
sp.getoutput("rpm -ivh hadoop-1.2.1-1.x86_64.rpm --force;rm /etc/hadoop/hdfs-site.xml;rm /etc/hadoop/core-site.xml")
else:
pass
print()
dataip=input("ENTER THE IP ADDRESS OF NAMENODE : ")
print()
dataport=int(input("ENTER THE PORT NO :"))
print("\n\n.................WAIT....................")
datafile1=open("/etc/hadoop/core-site.xml", 'w')
datafile1.write(f'''<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://{dataip}:{dataport}</value>
</property>
</configuration>''')
datafile1.close()
os.system("systemctl stop firewalld;setenforce 0")
print("\n\n--------------Client Service Started----------")
elif y==4:
os.system("hadoop dfsadmin -report")
elif y==5:
os.system("hadoop-daemon.sh stop datanode;jps")
elif y==6:
os.system("hadoop-daemon.sh stop namenode;jps")
elif y==7:
program()
else:
print("\nYou Entered Wrong Choice ...")
hadoop()
elif x==3:
print("\n\n.........INSTALLING NECCESSARY FILES...........")
sp.getoutput("rm -rf /etc/yum.repos.d/;mkdir /etc/yum.repos.d/;cd /etc/yum.repos.d/;wget https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm;wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm;wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm;wget https://www.elrepo.org/RPM-GPG-KEY-elrepo.org;wget http://repo.webtatic.com/yum/el7/webtatic-release.rpm")
file1=open("/etc/yum.repos.d/soft.repo", 'w')
file1.write("""[DVD1]
baseurl=file:///run/media/root/RHEL-8-1-0-BaseOS-x86_64/AppStream
gpgcheck=0
[DVD2]
baseurl=file:///run/media/root/RHEL-8-1-0-BaseOS-x86_64/BaseOS
gpgcheck=0""")
file1.close()
print("\n---------------INSTALLING HTTPD----------------------------------------------")
os.system("yum install httpd")
os.system("systemctl start httpd;systemctl stop firewalld;setenforce 0")
print("------------------------------YOUR WEB SERVICE HAS STARTED----------------------")
elif x==4:
def docker():
os.system("export TERM=xterm;clear")
print("\t\t\t\tWELCOME TO WORLD OF DOCKER")
print("""
A) Press 1 For Installing Docker
B) Press 2 For Start docker service
C) Press 3 For Launch Container
D) Press 4 For Start Container
E) Press 5 For Stop Container
F) Press 6 For Status Of Containers
G) Press 7 FOR Delete Containers
H) Press 8 For Delete Image
I) Press 9 For Stop docker service
J) Press 10 For Status docker service
K) Press 11 Back""")
y=int(input("ENTER YOUR CHOICE : "))
if y==1:
os.system("cd /etc/yum.repos.d/;wget https://download.docker.com/linux/centos/docker-ce.repo;yum install docker-ce --nobest")
print("\n\-------------------docker has been installed---------------")
elif y==3:
image = input("\nGIVE THE IMAGE NAME : ")
version = input("\nENTER VERSION : ")
os_name = input("\nENTER YOUR OS NAME : ")
os.system(f"docker pull {image}:{version};clear;docker run -it --name {os_name} {image}:{version} ")
elif y==4:
os_name = input("\nENTER YOUR OS NAME TO START: ")
os.system(f"docker start {os_name}")
elif y==5:
os_name = input("\nENTER YOUR OS NAME TO STOP: ")
os.system(f"docker stop {os_name}")
elif y==6:
os.system("docker ps -a")
elif y==7:
os_name = input("\nENTER YOUR OS NAME TO DELETE: ")
os.system(f"docker rm {os_name}")
elif y==8:
image_name = input("\nENTER YOUR IMAGE NAME TO DELETE: ")
version = int(input("\nENTER VERSION : "))
os.system(f"docker rmi {image_name}:{version}")
elif y==9:
os.system("systemctl stop docker;tput setaf 3;echo '---------------YOUR DOCKER SERVICE STOPPED ---------'")
elif y==10:
os.system("systemctl status docker")
elif y==2:
os.system("systemctl start docker;tput setaf 3;echo '---------------YOUR DOCKER SERVICE STARTED --------'")
elif y==11:
program()
else:
print("\nYou Entered Wrong Choice ...")
docker()
elif x==5:
def lvm():
os.system("export TERM=xterm;clear")
print("\t\t\t\tWELCOME FOR LVM SERVICES")
print("""
A) Press 1 For Static To Dynamic
B) Press 2 For Extend Your LVM Size
C) Press 3 For Reduce Your LVM Size
D) Press 4 FOr Extend Your Volume Group Size
E) Press 5 For Remove LVM
F) Press 6 For Remove Volume Group
G) Press 7 For Remove Physical Volume
H) Press 8 Back""")
y=int(input("ENTER YOUR CHOICE : "))
print()
if y==1:
static_volume=input("GIVE THE PATH OF YOUR STATIC VOLUME: ")
print()
dynamic_size =int(input("ENTER THE SIZE YOU WANT TO CREATE: "))
print()
user_vg=input("ENTER THE VOLUME GROUP NAME : ")
print()
user_lv=input("ENTER THE LOGICAL VOLUME NAME : ")
print()
os.system(f"pvcreate {static_volume};vgcreate {user_vg} {static_volume};lvcreate --size +{dynamic_size}G --name {user_lv} {user_vg};mkfs.ext4 /dev/{user_vg}/{user_lv};mkdir /user_dir;mount /dev/{user_vg}/{user_lv} /user_dir;df -h")
print("\n\n------------------YOUR STATIC VOLUME CONVERTED TO DYNAMIC ---------------")
elif y==2:
lv_name=input("Give Your LV Path : ")
print()
lv_extend_size=int(input("How much You Want To Extend In GB : "))
print()
os.system(f"e2fsck -ff {lv_name};lvextend --size +{lv_extend_size}G {lv_name};fsadm resize {lv_name}")
elif y==3:
mounting_point=input("Give Your LVM Mount Point: ")
print()
lv_name=input("Give Your LV Path : ")
print()
lv_reduce_size=int(input("How much You Want To Reduce In GB : "))
print()
final_size=int(input("How Much Size DO You Want After Reducing :"))
print()
os.system(f"umount {lv_name} {mounting_point};e2fsck -ff {lv_name};resize2fs {lv_name} {final_size}G;lvreduce --size -{lv_reduce_size}G {lv_name};resize2fs {lv_name};mount {lv_name} {mounting_point}")
elif y==4:
device_name=input("Give Your Deivce Name : ")
print()
vg_name=input("Give Your Volume Group Name : ")
print()
os.system(f"pvcreate {device_name};vgextend {vg_name} {device_name}")
elif y==5:
mounting_point=input("Give Your LVM Mount Point: ")
print()
lv_name=input("Give Your LV Path : ")
print()
os.system(f"umount -v {mounting_point};lvremove {lv_name}")
elif y==6:
mounting_point=input("Give Your LVM Mount Point: ")
print()
lv_name=input("Give Your LV Path : ")
print()
vg_name=input("Give Your VG Name : ")
print()
os.system(f"umount -v {mounting_point};lvremove {lv_name};vgremove {vg_name}")
elif y==7:
mounting_point=input("Give Your LVM Mount Point: ")
print()
lv_name=input("Give Your LV Path : ")
print()
vg_name=input("Give Your VG Name : ")
print()
pv_name=input("Give Your PV Name : ")
print()
os.system(f"umount -v {mounting_point};lvremove {lv_name};vgremove {vg_name};pvremove {pv_name}")
elif y==8:
program()
else:
print("\nYou Entered Wrong Choice ...")
lvm()
elif x==6:
def aws():
os.system("export TERM=xterm;clear")
print("\t\t\t\t\tWELCOME the WORLD OF AWS ")
print("\t\t\t\t\t--------------------------")
print("""
Press 1 : To Install AWS CLI
Press 2 : To Login into AWS CLI
Press 3 : To Create Key Pair
Press 4 : To Create Security Group
Press 5 : To Launch a instance
Press 6 : To Start a Instance
Press 7 : To Stop a Instance
Press 8 : To Describe All Instances
Press 9 : To Create a Volume
Press 10 : To Attach volume with instance
Press 11 : For Partitioning the attached volume
Press 12 :To configure Web Server
Press 13 :To Format Partition
Press 14 :To Mount the Web Server to Volume
Press 15 :To Detach Volume
Press 16 :To Launch S3 Services
Press 17 :To create Snapshot
Press 18 :To create Cloud Front Distributions
Press 19 :Back""")
print("Enter Your Choice : ",end="")
ch=input()
if int(ch) == 1:
os.system("curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip;unzip awscliv2.zip;sudo ./aws/install")
elif int(ch) == 2:
os.system("aws configure")
elif int(ch) == 3:
print("\nEnter Your Key name: ",end ="")
key = input()
os.system(f"aws ec2 create-key-pair --key-name {key} --query 'KeyMaterial' --output text > {key}.pem ")
elif int(ch) == 4:
print("\nEnter Your group name: ",end ="")
key = input()
os.system(f"aws ec2 create-security-group --group-name {key}")
elif int(ch) == 5:
print("""
Press 1:AWS Linux
Press 2:Redhat Linux""")
print("\nEnter your Choice : ",end="")
img=input()
if int(img) ==1:
print("\nEnter Your Key name: ",end ="")
key = input()
print("\nEnter Your Security Group name: ",end ="")
key1 = input()
os.system("aws ec2 run-instances --image-id ami-0e306788ff2473ccb --instance-type t2.micro --key-name {} --security-group-ids {} --count 1".format(key))
elif int(img) == 2:
print("\nEnter Your Key name: ",end ="")
key = input()
print("\nEnter Your Security Group name: ",end ="")
key1 = input()
os.system("aws ec2 run-instances --image-id ami-052c08d70def0ac62 --instance-type t2.micro --key-name {} --security-group-ids {} --count 1".format(key))
elif int(ch) == 6:
print("\nEnter Instance Id : ",end = "")
uid = input()
os.system(" aws ec2 start-instances --instance-id {}".format(uid))
elif int(ch) == 7:
print("\nEnter Instance Id : ",end = "")
uid = input()
os.system(" aws ec2 stop-instances --instance-id {}".format(uid))
elif int(ch) == 8:
os.system("aws ec2 describe-instances")
elif int(ch) == 9:
print("\nEnter Size : ",end = "")
size = input()
print("\nEnter availability zone : ",end = "")
zone = input()
print("\nEnter volume type : ",end= "")
vtype = input()
os.system(" aws ec2 create-volume --availability-zone {} --size {} --volume-type {}".format(zone,size,vtype))
elif int(ch) == 10:
print("\t\t\t\nVolume Zone & Instance Zone Must be same !!!")
print("\t\t\t--------------------------------------------")
print("\nEnter volume-id : ",end = "")
vid = input()
print("\nEnter instance-id : ",end = "")
iid = input()
print("\nEnter device : /dev/",end= "")
device = input()
os.system(" aws ec2 attach-volume --volume-id {} --instance-id {} --device /dev/{} ".format(vid,iid,device))
elif int(ch) == 11:
print("\nEnter IP : ",end = "")
ip = input()
print("\nEnter key : ",end = "")
key = input()
print("\nEnter device : /dev/",end= "")
device = input()
os.system(" ssh -l ec2-user {} -i {}.pem sudo fdisk /dev/{} ".format(ip,key,device))
elif int(ch) == 12:
print("\t\t\tHTTPD must be installed...")
print("\t\t\t--------------------------")
print("\nEnter IP : ",end = "")
ip = input()
print("\nEnter key : ",end = "")
key = input()
os.system(" ssh -l ec2-user {} -i {}.pem sudo systemctl start httpd ".format(ip,key))
elif int(ch) == 13:
print("\nEnter IP : ",end = "")
ip = input()
print("\nEnter key : ",end = "")
key = input()
print("\nEnter Device : /dev/",end="")
device = input()
os.system(" ssh -l ec2-user {} -i {}.pem sudo mkfs.ext4 /dev/{} ".format(ip,key,device))
elif int(ch) == 14:
print("\nEnter IP : ",end = "")
ip = input()
print("\nEnter key : ",end = "")
key = input()
print("\nEnter Device : /dev/",end="")
device = input()
os.system(" ssh -l ec2-user {} -i {}.pem sudo mount /dev/{} /var/www/html/ ".format(ip,key,device))
elif int(ch)==15:
Voulme_id=input("\n Enter Volume id: ")
os.system(f"aws ec2 detach-voulme --voulme-id {Voulme_id} ")
elif int(ch) == 16:
print("""
A)Make Bucket Press 1
B)Upload File Press 2
C)Delete Bucket press 3""")
print("Enter your Choice : ",end="")
img=int(input())
if img==1:
print()
mb=input("ENTER THE BUCKET NAME : ")
print()
region=input("ENTER THE REGION NAME WHERE U WANT TO CREATE")
os.system(f"aws s3 mb s3://{mb} --region {region}")
elif img==2:
print()
file1=input("ENTER THE FILE PATH : ")
print()
mb=input("ENTER THE BUCKET NAME : ")
os.system(f"aws s3 cp {file1} s3://{mb}")
elif img==3:
print()
mb=input("ENTER THE BUCKET NAME : ")
os.system(f"aws s3 rb s3://{mb} --force")
elif int(ch) == 17:
origin_domain_name =input("Give Your S3 Bucket Name : ")
os.system(f"aws cloudfront create-distribution --origin-domain-name {origin_domain_name}.s3.amazonaws.com")
elif int(ch) == 18:
Voulme_id=input("\n Enter Volume id: ")
Description=input("\n Enter Description")
os.system(f"aws ec2 ceate-snapshot --voulme-id {Voulme_id} --description {' Description '} ")
elif int(ch) == 19:
program()
else:
print("\nsYou Entered Wrong Choice ...")
aws()
elif x==7:
os.system("export TERM=xterm;clear")
exit()
print()
xit = input("WANT TO CONTINUE FROM SERVER SIDE[Y/N] : ").upper()
if xit =="Y":
program()
else:
os.system("export TERM=xterm;clear")
exit()
program()