From cb43b16a3f6ed964acd78075973d59da774b90ff Mon Sep 17 00:00:00 2001 From: Shon Vella Date: Sat, 21 Jul 2018 08:26:34 -0600 Subject: [PATCH] fix to allow running under ECS using IAM task role ECS tasks get IAM credentials from a different endpoint than EC2 instances so rather than test the endpoint used by EC2 just test if we can get the token through AWS cli --- configs/entrypoint.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/configs/entrypoint.sh b/configs/entrypoint.sh index 6be1f40..4dd0c42 100755 --- a/configs/entrypoint.sh +++ b/configs/entrypoint.sh @@ -59,16 +59,15 @@ then aws_secret_access_key = $AWS_SECRET" >> ${AWS_FOLDER}/config fix_perm # if the key and secret are not mounted as secrets -elif test_iam -then +else echo "key and secret not available in ~/.aws/" if aws ecr get-authorization-token | grep expiresAt then echo "iam role configured to allow ecr access" + else + echo "key and secret not mounted as secret, declared as variables or available from iam role" + exit 1 fi -else - echo "key and secret not mounted as secret, declared as variables or available from iam role" - exit 1 fi # update the auth token