IAM role is not attached to windows containers launched in AWS ECS Optimized EC2 instance

Trying to dockerize windows application on aws cloud using windows docker container and ECS optimized EC2 instance as host.
after running the container, and trying to run aws cli commands, it’s asking for configure the aws credentials.
So, host system IAM role is not applied to container. Any thoughts on how to fix this?