https://prefect.io logo
Title
c

Charles Leung

03/15/2023, 10:34 PM
Hey Everyone, on Ive been trying to add upload a json file onprem to an s3 bucket, everytime i try to load the S3Bucket though, it keeps raising a ValueError, saying its unable to find the block document. Is there something that I need to load first?
async def uploadJsontoS3(path):
    s3_bucket = await S3Bucket.load("my_bucket")
    with open(r"\\filepathtoJson", "rb") as f:
        s3_bucket.upload_from_file_object(f, "aws-batch-args/testArgs.json")
z

Zanie

03/15/2023, 10:46 PM
Loading a block pulls the config from our API — if you haven’t configured a block for your bucket in the UI that’s not what you want
Instead you just want
S3Bucket(bucket_name="my_bucket")