David Kimura PRO said over 2 years ago on Deploying to Amazon Linux 2 :
  jose.esmerino Here's what I use in my gitlab-ci.yml file for deploying from the gitlab runner to a production Elastic Beanstalk environment.

You'd need to set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in the runner's environment variables. Hope this helps!

stages:
  - production

production:
  image: python:latest
  variables:
    DEBIAN_FRONTEND: noninteractive
    AWS_DEFAULT_REGION: "REGION" # <= CHANGE ME
    EB_APP_NAME: "APPNAME" # <= CHANGE ME
    EB_APP_ENV: "ENVNAME" # <= CHANGE ME
  stage: production
  when: manual
  before_script:
    - apt update
    - apt install curl awscli -y
    - pip install awsebcli --upgrade --user
    - export PATH=~/.local/bin:$PATH
  script:
    - aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
    - aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
    # - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID <= if aws config set doesn't work
    # - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
    - eb deploy YOUR_APP_HERE --timeout 30  # <= CHANGE ME
  only:
    - main