<@ULVA73B9P> Does the AwsCredentials in prefect-aw...
# marvin-in-the-wild
j
@Marvin Does the AwsCredentials in prefect-aws block support reading credentials from the credentials file on your local system? Or must you specify the access and secret keys?
m
It appears that the
AwsCredentials
block in the
prefect-aws
collection does support reading credentials from your local AWS credentials file. It does not require you to explicitly specify the access and secret keys, provided you configure it correctly. Here's a brief code example:
Copy code
python
from prefect_aws import AwsCredentials

aws_credentials = AwsCredentials.load("BLOCK_NAME")
Additional resources: - API documentation: Prefect AWS API Documentation - Guideline for using secrets: Moving Data with Prefect Furthermore, a related GitHub issue discusses how the AWS client parameters should be correctly assigned to an S3 bucket block, providing insight into integrating the credentials without directly specifying them in your code. If there's any finer detail you'd like me to check or another aspect you'd like to dive into, feel free to ask!
k
it does, if you leave those fields empty it'll follow the standard AWS creds search sequence
j
@Kevin Grismore Okay interesting. I'm not seeing that on my end, but assuming it's something with how I'm saving the block. I have this code in `blocks.py`:
Copy code
AwsCredentials().save("aws-credentials", overwrite=True)
and I'm running
Copy code
prefect block register --file blocks.py
I have my credentials in my shared .aws credentials file (and this works fine interacting with general boto3 and aioboto3 python code).
Viewing the block in the UI, I don't see any details of the secrets, region, etc. configured.
k
if there isn't anything that needs to be saved to the block, creating an instance of it in your script and just calling its methods should be enough
it'll try to create an authed client in the background using the locally available creds