Gitlab backup to S3

I have tried setting up backup to S3 but it fails. I think my problem is with IAM setup, I have created a policy using the JSON provided in: https://docs.gitlab.com/ee/raketasks/backup_restore.html

and setup the following in gitlab.rb:

gitlab_rails['backup_upload_connection'] = {
  'provider' => 'AWS',
  'region' => 'eu-central-1',
  'use_iam_profile' => true
}
gitlab_rails['backup_upload_remote_directory'] = 'gitlab.linki.tools-backup'

Initially I had setup aws_access_key_id & aws_secret_access_key but the docs say that these shouldn’t be setup when using IAM profile:

If using an IAM Profile, don’t configure aws_access_key_id & aws_secret_access_key
‘use_iam_profile’ => true

However, when I run backup it fails because it’s missing aws_access_key_id & aws_secret_access_key. I decided to avoid using these as Amazon recommends using IAM policies instead. Any suggestions?

This reference helped me getting it to work: