-
Notifications
You must be signed in to change notification settings - Fork 213
Expand file tree
/
Copy pathmain.py
More file actions
21 lines (17 loc) · 834 Bytes
/
main.py
File metadata and controls
21 lines (17 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/python3
import boto3
from botocore.exceptions import ClientError
from defaults import AMAZON_SECRETS
client = boto3.client(AMAZON_SECRETS.get('service'),
aws_access_key_id=AMAZON_SECRETS.get('aws_access_key_id_value'),
aws_secret_access_key=AMAZON_SECRETS.get('aws_secret_access_key_value'))
try:
bucket = client.create_bucket(Bucket=AMAZON_SECRETS.get('bucket_value'),
CreateBucketConfiguration={
'LocationConstraint': AMAZON_SECRETS.get('location_constraint_value')
})
except ClientError as error:
print(f'[-] Error: {error}')
else:
print(f'[+] {AMAZON_SECRETS.get("bucket_value")} successfully created!')
print(f'[+] Location: {bucket.get("Location")}')