I have recently upgraded a GHA runner EC2 instance to use IMDSv2, after the upgrade my build pipeline is failing with error – “fatal error: Unable to locate credentials” at Docker build step while executing ‘aws s3 cp <> <>‘ from Docker file. If I switch the GHA runner instance to use IMDSv1 the Docker build goes successfully.
I found out from aws docs that AWS CLI – 1.16.289 is the minimum version that supports IMDSv2. From my Docker file ‘awscli noarch 1.18.147-1.amzn2.0.2‘ is getting installed using ‘yum install awscli -y‘ command but still it looks like that the aws cli-1.18 is working with IMDSv1 only.
What is it that I am missing here? Can aws cli be forced/configured to use IMDSv2 only? Thanks in advance.