Hello, Deployed and built using ECS agents and now...
# best-practices
j
Hello, Deployed and built using ECS agents and now I'm getting below error. ECS block got access to aws credentials, taskdefinition, roleARN and ..etc. any guess what this is about?
raise ProfileNotFound(profile=profile_name)
botocore.exceptions.ProfileNotFound: The config profile (prefect) could not be found
z
Do you have an environment variable set changing the current profile?
i.e.
PREFECT_PROFILE=prefect
?
j
no there is nothing changing profile. I ran this as docker with ecr and worked perfectly fine. as soon as created ib (ECS block ) I got this error. here what I always see when run `prefect config view`:
PREFECT_PROFILE='extra-profile'
z
Do you have the full traceback?
j
17:51:06.257 | INFO    | prefect.agent - Submitting flow run '91a4cf5a-9161-4ede-ad66-a2088f628914'
17:51:07.159 | ERROR   | prefect.agent - Failed to submit flow run '91a4cf5a-9161-4ede-ad66-a2088f628914' to infrastructure.
Traceback (most recent call last):
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/prefect/agent.py", line 484, in _submit_run_and_capture_errors
result = await infrastructure.run(task_status=task_status)
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/prefect_aws/ecs.py", line 604, in run
boto_session, ecs_client = await run_sync_in_worker_thread(
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 91, in run_sync_in_worker_thread
return await <http://anyio.to|anyio.to>_thread.run_sync(
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/prefect_aws/ecs.py", line 717, in _get_session_and_client
boto_session = self.aws_credentials.get_boto3_session()
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/prefect_aws/credentials.py", line 95, in get_boto3_session
return boto3.Session(
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/boto3/session.py", line 90, in __init__
self._setup_loader()
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/boto3/session.py", line 131, in _setup_loader
self._loader = self._session.get_component('data_loader')
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/botocore/session.py", line 796, in get_component
return self._components.get_component(name)
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/botocore/session.py", line 1108, in get_component
self._components[name] = factory()
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/botocore/session.py", line 193, in <lambda>
lambda: create_loader(self.get_config_variable('data_path')),
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/botocore/session.py", line 317, in get_config_variable
return self.get_component('config_store').get_config_variable(
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/botocore/configprovider.py", line 426, in get_config_variable
return provider.provide()
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/botocore/configprovider.py", line 628, in provide
value = provider.provide()
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/botocore/configprovider.py", line 718, in provide
scoped_config = self._session.get_scoped_config()
File "/Users/jafaramin_1/env/lib/python3.10/site-packages/botocore/session.py", line 416, in get_scoped_config
raise ProfileNotFound(profile=profile_name)
botocore.exceptions.ProfileNotFound: The config profile (prefect) could not be found
prefect deployment build flows/python/build_file.py:load_credit_sf \
-n prefect-docker-creditfurnishing-ecs \
-q ecs \
-sb s3/prefect-s3/credit-furnishing/docker-ecs \
-ib ecs-task/ecs \
--apply
z
Ah I see this is a botocore profile error
How did you configure the AWSCredentials for your ECS block?
j
Using a python script and ran it! I see awscred block referenced in ecs block
z
It sounds like it’s trying to look up an AWS profile on the agent and it’s not available
j
ok ecs cluster and ecs task is fine except for this error when I'm clicking on Task execution role: do think this is causing it? everything I'm running is dockered so i don't think aws cli is pulling any accounts from
~/.aws/credentials/