Skip to content

Commit 5981725

Browse files
authored
Added ecs creation
1 parent d6dd6ec commit 5981725

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

create_ecs_cluster.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Boto3 script for creating "n" number ECS clusters in AWS account
2+
# Script can be executed as below,
3+
# This command creates 2 ECS in default aws profile
4+
# python create_ecs.py default 2
5+
# This command creates 2 ECS keys in account2 aws profile
6+
# python create_ecs.py account2 2
7+
8+
import boto3
9+
import random
10+
import sys
11+
12+
boto3.setup_default_session(profile_name=sys.argv[1])
13+
count = int(sys.argv[2])
14+
15+
for i in range(0, count):
16+
ecs = boto3.client('ecs')
17+
random_num = random.randint(0,2002)
18+
ecs_data = ecs.create_cluster(
19+
clusterName='prfecs' + str(random_num)
20+
#,
21+
#tags= [{ "key": "prfecskey", "value": "prfecsvalue" }]
22+
)
23+
print ("ECS: ", ecs_data)

0 commit comments

Comments
 (0)