Hello, I am trying to setup a prefect agent into A...
# prefect-community
j
Hello, I am trying to setup a prefect agent into AWS ECS task... it worked, but inside the python scripts this prefect agent is running, I am instancing a boto3 to talk to our SSM Parameters but I am getting an "AccessDenied" Error. It must be related to policies, but I have a hard time solving that issue (editing policies, editing roles... etc and still getting the same thing)
botocore.exceptions.ClientError: An error occurred (AccessDeniedException) when calling the GetParameter operation: User: arn:aws:sts::999999999999:assumed-role/MyRole-dev/12345459ba45458183ed3d1aa5112341 is not authorized to perform: ssm:GetParameter on resource: arn:aws:ssm:region:999999999999:parameter/XXX/value because no identity-based policy allows the ssm:GetParameter action
What is your suggestion here, or a possible solution for this?
k
Yeah roles is always hard man. What roles are you attaching to ECSRun?
j
what do you mean? These?
Copy code
executionRoleArn
taskRoleArn
k
Yeah do you have both specified? It should be those with the permissions
j
yes, I have them filled with roles, and both roles are configured to get SSM parameters 😕
k
I guess that means the boto client you are creating might not be using those credentials? Or does the log say it is? The log shows the right role?
j
yup, the log says it is the right role... but it is kind of attached to a ECS user, which seems to be only existing inside ecs
I was thinking maybe setup access keys for aws in SSM and pull them in container creation and then pass these to my python script and avoid the problem... but what is your opinion about it (regarding security)
k
If you mean hardcoding, we shouldn’t have to get to that. Prefect Secrets might be a lot easier to use before you have to do that
j
not hardcoded. Set them as SSM parameters and built them as secrets in the container
k
That may work yeah
j
Thanks. I think I got tired of seeing what to change in the policies 😕
k
I know. Those are always very painful