from prefect import flow, get_run_logger, task
from prefect.context import get_run_context
from prefect_aws import AwsCredentials
from prefect.filesystems import S3
AwsCredentials(
aws_access_key_id="XXXXX",
aws_secret_access_key="XXXXX",
aws_session_token="XXXXX",
region_name="XXXXX"
).save("aws-credentials", overwrite=True)
aws_credentials_block = AwsCredentials.load("aws-credentials")
S3 = S3(bucket_path="csx-qa-prefect",
aws_access_key_id="XXXXX",
aws_secret_access_key="XXXXX")
S3.save("s3-block-csx-qa", overwrite=True)
s3_block = S3.load("s3-block-csx-qa")
@task
def bar():
logger = get_run_logger()
task_run_name = get_run_context().task_run.name
logger.info(f"Hi from {task_run_name}")
@flow
def foo():
bar()
if __name__ == '__main__':
foo()
I’m using the above code and trying to do the deployment using the below command using a storage block
prefect deployment build example.py:foo -n process-deployment -sb s3/s3-block-csx-qa
But I’m receiving the
PermissionError: The AWS Access Key Id you provided does not exist in our records.
I’m giving the correct AWS Access Key Id. Please help on the same.