I'm having an issue with AWS credentials that I ca...
# prefect-aws
s
I'm having an issue with AWS credentials that I can't figure out. I'm just trying to upload a file to s3. I copied the instructions from https://prefecthq.github.io/prefect-aws/ for uploading a file and made some small changes.
Copy code
@flow
def upload_to_s3(dataset_file: Path):

    aws_credentials = AwsCredentials.load("my-block")
    s3_bucket = S3Bucket(
        bucket_name="my-bucket",
        aws_credentials=aws_credentials
    )

    s3_bucket_path = s3_bucket.upload_from_path(dataset_file)
    print(f"Uploaded {dataset_file} to {s3_bucket_path}")
    return True
When I run this I get a credentials not found error:
Copy code
botocore.exceptions.NoCredentialsError: Unable to locate credentials
I can see the block in the Prefect Cloud UI and as far as I can tell all the data in it looks good and all the names in the workflow and the block match. I ran
pip install -U prefect
and
pip install -U prefect_aws
just to make sure I had the latest versions of the libraries. What else could I be doing wrong?
1
k
Copy code
s3_bucket = S3Bucket(
        bucket_name="my-bucket",
        credentials=aws_credentials <--- change this
    )
there's a docstring mistake that has been fixed, but we haven't done a release yet so the docs are behind. so sorry about that!
in case it isn't obvious I changed the left side of the assignment operator from
aws_credentials
to just
credentials
🙌 1
s
Ok, that worked. Thanks for the fast resonse!
🙌 2