From 6d6f5ad6262cbfd712e3dae7277c42e6c3380b99 Mon Sep 17 00:00:00 2001 From: alok Date: Mon, 16 Jul 2018 16:40:45 -0700 Subject: [PATCH] s3 upload scripts --- .../new-pipeline/upload_binaries.py | 15 +++++++++++++++ .../new-pipeline/upload_config.py | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 aws-experiment-launch/new-pipeline/upload_binaries.py create mode 100644 aws-experiment-launch/new-pipeline/upload_config.py diff --git a/aws-experiment-launch/new-pipeline/upload_binaries.py b/aws-experiment-launch/new-pipeline/upload_binaries.py new file mode 100644 index 000000000..2a5986f0e --- /dev/null +++ b/aws-experiment-launch/new-pipeline/upload_binaries.py @@ -0,0 +1,15 @@ +import boto3 +import os +GOHOME ='/Users/alok/Documents/goworkspace/' +s3 = boto3.client('s3') +bucket_name = 'unique-bucket-bin' +#response = s3.create_bucket(Bucket=bucket_name,ACL='public-read-write', CreateBucketConfiguration={'LocationConstraint': 'us-west-2'}) +response = s3.list_buckets() +buckets = [bucket['Name'] for bucket in response['Buckets']] +print("Bucket List: %s" % buckets) +dirname = GOHOME + 'src/harmony-benchmark/bin/' +for myfile in os.listdir(dirname): + with open('distribution_config.txt','r') as f: + f = open(os.path.join(dirname,myfile)) + response = s3.put_object(ACL='public-read-write',Body=f.read(),Bucket=bucket_name,Key=myfile) + print(response) diff --git a/aws-experiment-launch/new-pipeline/upload_config.py b/aws-experiment-launch/new-pipeline/upload_config.py new file mode 100644 index 000000000..2d2b6f379 --- /dev/null +++ b/aws-experiment-launch/new-pipeline/upload_config.py @@ -0,0 +1,12 @@ +import boto3 +import os +GOHOME ='/Users/alok/Documents/goworkspace/' +#from boto3.session import Session +s3 = boto3.client('s3') +bucket_name = 'unique-bucket-bin' +#response = s3.create_bucket(Bucket=bucket_name,ACL='public-read-write', CreateBucketConfiguration={'LocationConstraint': 'us-west-2'}) +dirname = GOHOME + 'src/harmony-benchmark/bin/' +myfile = 'distribution_config.txt' +with open('distribution_config.txt','r') as f: + response = s3.put_object(ACL='public-read-write',Body=f.read(),Bucket=bucket_name,Key=myfile) + print(response)