Skip to content

Commit d6dd6ec

Browse files
authored
File created
1 parent 2601b63 commit d6dd6ec

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

create_kms_keys.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Boto3 script for creating "n" number KMS keys in AWS account
2+
# Script can be executed as below,
3+
# This command creates 2 KMS keys in default aws profile
4+
# python create_kms.py default 2
5+
# This command creates 2 KMS keys in account2 aws profile
6+
# python create_kms.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+
kms = boto3.client('kms')
17+
kms_data = kms.create_key( Origin='AWS_KMS',
18+
Tags=[
19+
{
20+
'TagKey': 'SampleKmsKey',
21+
'TagValue': 'SampleKmsKeyValue'
22+
} ]
23+
)
24+
print ("S3 Bucket: ", kms_data)

0 commit comments

Comments
 (0)