-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_s3.py
More file actions
33 lines (25 loc) · 826 Bytes
/
setup_s3.py
File metadata and controls
33 lines (25 loc) · 826 Bytes
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
import boto3
import os
# AWS credentials and region
AWS_ACCESS_KEY_ID = "AWS_ACCESS_KEY_ID"
AWS_SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY"
AWS_REGION = 'us-east-1'
# Initialize S3 client
s3 = boto3.client('s3',
aws_access_key_id=AWS_ACCESS_KEY_ID,
aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
region_name=AWS_REGION)
def create_bucket(bucket_name):
response = s3.create_bucket(
Bucket=bucket_name
)
print(f"Created bucket: {bucket_name}")
if __name__ == "__main__":
# Define input, stage-1 and output bucket names
input_bucket_name = 'input'
stage_1_bucket = 'stage-1'
output_bucket = 'output'
# Create S3 buckets
create_bucket(input_bucket_name)
create_bucket(stage_1_bucket)
create_bucket(output_bucket)