It wasn’t that aws cli can’t find the config file it was config file itself.
[profile MYPROFILE]
role_arn = arn:aws:iam::010101010:role/xxx-jenkinsDeployment-Role
credential_source = Ec2InstanceMetadata
replace Ec2InstanceMetadata with EcsContainer worked.