I am launching a pair of subnets with a VPC and a public load balancer in ECS Fargate launch mode.
I am having the issue that for some reason, ECS agent does not populate "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" environmental variable and therefore, my nodejs aws-sdk is not able to fetch credentials from the IAM role.
Trying to discard possible causes, I came across the following question:
Is is possible that I need to run an official Amazon Linux AMI in order to get ECS Agent to work? (my current app does run alpine linux in the container)
If "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" is not populated, check that you have assigned a Task role in the task definition:
{
"family": "",
"taskRoleArn": "", <============== Task role