How do I get yarn installed on elastic beanstalk?

You can customize packages that are installed and commands that are run on deploy with .ebextensions

For yarn, I created a file with the following commands which install a recent node version and yarn:

# .ebextensions/yarn.config
    command: |
      sudo curl --silent --location | sudo bash -
      sudo yum -y install nodejs

    # don't run the command if yarn is already installed (file /usr/bin/yarn exists)
    test: '[ ! -f /usr/bin/yarn ] && echo "Yarn not found, installing..."'
    command: |
      sudo wget -O /etc/yum.repos.d/yarn.repo
      sudo yum -y install yarn

More Documentation: