This is my setup:
- I use AWS Batch that is running a custom Docker image
- The startup.sh file is an entrypoint script that is reading the nth line of a text file and copying it from s3 into the docker.
- For example, if the first line of the .txt file is 'Startup_00001/ Startup_000018 Startup_000019', the bash script reads this line, and uses a for loop to copy them over.
- This is part of my bash script:
STARTUP_FILE_S3_URL=s3://cmtestbucke/Config/ Startup_FileNames=$(sed -n ${LINE}p file.txt) for i in ${Startup_FileNames} do Startup_FileURL=${STARTUP_FILE_S3_URL}$i echo $Startup_FileURL aws s3 cp ${Startup_FileURL} /home/CM_Projects/ & done
- Here is the log output from aws:
s3://cmtestbucke/Config/Startup_000017
s3://cmtestbucke/Config/Startup_000018
s3://cmtestbucke/Config/Startup_000019
Completed 727 Bytes/727 Bytes (7.1 KiB/s) with 1 file(s) remaining download: s3://cmtestbucke/Config/Startup_000018 to Data/Config/Startup_000018
Completed 731 Bytes/731 Bytes (10.1 KiB/s) with 1 file(s) remaining download: s3://cmtestbucke/Config/Startup_000017 to Data/Config/Startup_000017
fatal error: *An error occurred (404) when calling the HeadObject operation: Key "Config/Startup_000019 " does not exist.*
- My s3 bucket certainly contains the object s3://cmtestbucke/Config/Startup_000019
- I noticed this happens regardless of filenames. The last iteration always gives this error.
- I tested this bash logic locally with the same aws commands. It copies all 3 files.
Can someone please help me figure out what is wrong here?