From f7685e191b9062a34e3616049aa68c009d8f9afc Mon Sep 17 00:00:00 2001 From: ErinWeisbart <54687786+ErinWeisbart@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:12:15 -0800 Subject: [PATCH] bypass S3FS if downloading --- worker/run-worker.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/worker/run-worker.sh b/worker/run-worker.sh index 11fd08b..fb0deee 100644 --- a/worker/run-worker.sh +++ b/worker/run-worker.sh @@ -23,15 +23,17 @@ VOL_1_ID=$(aws ec2 describe-instance-attribute --instance-id $MY_INSTANCE_ID --a aws ec2 create-tags --resources $VOL_1_ID --tags Key=Name,Value=${APP_NAME}Worker # 2. MOUNT S3 -echo "Mounting S3 using S3FS" -if [[ -z "$AWS_ACCESS_KEY_ID" ]]; then - echo "Using role credentials to mount S3" - s3fs $SOURCE_BUCKET /home/ubuntu/bucket -o iam_role -else - echo "Using user credentials to mount S3" - echo $AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY > /credentials.txt - chmod 600 /credentials.txt - s3fs $SOURCE_BUCKET /home/ubuntu/bucket -o passwd_file=/credentials.txt +if [[ ${DOWNLOAD_FILES} == 'False' ]]; then + echo "Mounting S3 using S3FS" + if [[ -z "$AWS_ACCESS_KEY_ID" ]]; then + echo "Using role credentials to mount S3" + s3fs $SOURCE_BUCKET /home/ubuntu/bucket -o iam_role + else + echo "Using user credentials to mount S3" + echo $AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY > /credentials.txt + chmod 600 /credentials.txt + s3fs $SOURCE_BUCKET /home/ubuntu/bucket -o passwd_file=/credentials.txt + fi fi # 3. SET UP ALARMS