Can't fetch LFS files from AWS server

Hello everyone!

Our repository is currently using 28.2 GB on GitLab, and we are afraid to reach the maximum allowed and don’t be allowed to push anything anymore.

That’s why we decided to use a custom LFS server using AWS S3 bucket to store LFS files using this project.

We also use AWS to run custom GitLab runner.

To switch to the new LFS server, we created a .lfsconfig file with the URL of the new server.

But the runner can’t fetch the LFS files from the new server, here are the errors we get (I replaced sensitive data):

e[0KRunning with gitlab-runner 13.2.2 (a998cacd)
e[0;me[0K  on Runner for -
e[0;msection_start:1603984484:prepare_executor
e[0Ke[0Ke[36;1mPreparing the "docker+machine" executore[0;m
e[0;me[0KUsing Docker executor with image IMAGE ...
e[0;me[0KPulling docker image IMAGE ...
e[0;me[0KUsing docker image sha256 for IMAGE ...
e[0;msection_end:1603984664:prepare_executor
e[0Ksection_start:1603984664:prepare_script
e[0Ke[0Ke[36;1mPreparing environmente[0;m
e[0;mRunning on runner-aaaaaaaa-project-00000000-concurrent-0 via runner-aaaaaaaa-gitlab-docker-machine-0000000000-00000000...
section_end:1603984665:prepare_script
e[0Ksection_start:1603984665:get_sources
e[0Ke[0Ke[36;1mGetting source from Git repositorye[0;m
e[0;me[32;1mFetching changes with git depth set to 50...e[0;m
Initialized empty Git repository in /builds/Team/Project/.git/
e[32;1mCreated fresh repository.e[0;m
e[32;1mChecking out 8b62bc23 as dev...e[0;m
fatal: could not read Username for 'https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com': No such device or address
fatal: could not read Username for 'https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com': No such device or address
fatal: could not read Username for 'https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com': No such device or address
fatal: could not read Username for 'https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com': No such device or address
fatal: could not read Username for 'https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com': No such device or address
fatal: could not read Username for 'https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com': No such device or address
fatal: could not read Username for 'https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com': No such device or address
batch response: Git credentials for https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com/lfs not found.
batch response: Git credentials for https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com/lfs not found.
batch response: Git credentials for https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com/lfs not found.
batch response: Git credentials for https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com/lfs not found.
batch response: Git credentials for https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com/lfs not found.
batch response: Git credentials for https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com/lfs not found.
batch response: Git credentials for https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com/lfs not found.
error: failed to fetch some objects from 'https://aaaaaaaa.execute-api.eu-west-1.amazonaws.com/lfs'
section_end:1603984675:get_sources
e[0Ke[31;1mERROR: Job failed: exit code 1
e[0;m

With a Git client, when we try to pull the LFS file, we need to specify credentials we entered to configure our LFS server in AWS and it works. But for a runner, we don’t really know how to enter credentials specifically for LFS files fetching.

In fact, I don’t even know where is the script in a GitLab runner that clone the repo and fetch the LFS files.

Do you know how to do that?

If you are using a custom EC2 machine on AWS, why don’t you simply give to the IAM profile of EC2 permission to access S3? In this way you don’t have to manage credentials at all.

Moreover, if you create a VPC Endpoint for S3, you’ll be able to save on ingress traffic costs.