Prashob Nair
11/09/2021, 6:42 PMKevin Kho
Storage(secrets=["AWS_CREDENTIALS"])Prashob Nair
11/09/2021, 7:59 PMbotocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the PutObject operation: Access DeniedKevin Kho
Kevin Kho
Unable to locate credentialsKevin Kho
~./awsPrashob Nair
11/09/2021, 8:17 PMPrashob Nair
11/09/2021, 8:19 PMKevin Kho
Kevin Kho
Prashob Nair
11/09/2021, 8:26 PMSTORAGE = S3(bucket="bucket-name", secrets=["AWS_CREDENTIALS"])botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the PutObject operation: Access DeniedKevin Kho
Kevin Kho
botocore.exceptions.NoCredentialsError: Unable to locate credentialsPrashob Nair
11/09/2021, 8:39 PMPrashob Nair
11/09/2021, 8:49 PMbotocore.exceptions.NoCredentialsError: Unable to locate credentialsKevin Kho
flow.run()Prashob Nair
11/09/2021, 8:54 PMKevin Kho
Kevin Kho
export PREFECT___CLOUD____USE__LOCAL_SECRETS=FalseKevin Kho
from prefect import Flow, task
from prefect.tasks.secrets import PrefectSecret
import prefect
@task
def my_task(credentials):
    <http://prefect.context.logger.info|prefect.context.logger.info>(credentials)
with Flow("example") as flow:
    my_secret = PrefectSecret("AWS_CREDENTIALS")
    res = my_task(credentials=my_secret)
flow.run()Kevin Kho
[2021-11-09 16:06:54-0500] INFO - prefect.my_task | {'ACCESS_KEY': 'AKI......IL4U', 'SECRET_ACCESS_KEY': 'Sz5..........r08'}Kevin Kho
Kevin Kho
from prefect import Flow, task
from prefect.engine.results import S3Result
from prefect.storage import Local
@task(result=S3Result(bucket="coiled-prefect"), checkpoint=True)
def abc():
    return 1
with Flow("s3_test") as flow:
    abc()
flow.storage = Local(secrets=["AWS_CREDENTIALS"])
flow.register("bristech")Prashob Nair
11/09/2021, 9:17 PMValueError: Local Secret "AWS_CREDENTIALS" was not found.Kevin Kho
config.toml[cloud]
use_local_secrets = falsePrashob Nair
11/09/2021, 9:38 PMKevin Kho
Prashob Nair
11/09/2021, 10:00 PMbotocore.exceptions.NoCredentialsError: Unable to locate credentialsfrom prefect import Flow, task
from prefect.engine.results import S3Result
from prefect.storage import S3
@task(result=S3Result(bucket="coiled-prefect"), checkpoint=True)
def abc():
    return 1
with Flow("s3_test") as flow:
    abc()
flow.storage = S3(bucket="coiled-prefect", secrets=["AWS_CREDENTIALS"])
flow.register("bristech")Kevin Kho
Prashob Nair
11/09/2021, 10:04 PMKevin Kho
