I'm running ASP.NET Core 3.1 Application on Elastic Beanstalk with Amazon Linux 2 EC2 instances. I need my app to be able to generate QR codes and for this I'm using QRCoder library. It worked on my Windows machine out of the box, but to make it work on Amazon Linux 2 machine I had to run the following commands via SSH:
sudo amazon-linux-extras install epel
sudo yum install libgdiplus
After running these commands EB app servers also need to be restarted for image generation to work.
I tried to script it by creating .ebextensions/install_gdi.config file in my application repo root directory with the following contents:
commands:
00_install_extras:
command: amazon-linux-extras install -y epel
01_install_gdi:
command: yum install -y libgdiplus
I rebuilt my Beanstalk environment to have fresh EC2 instances redeployed version, and it seems that EB extensions config file isn't doing anything. Images still cannot be generated until I connect via SSH and run those command manually on EC2 instance.
I read that there are alternative ways to automate instance provisioning for Amazon Linux 2 but I wasn't able to find good examples to explore things like pre deployment hooks and Buildfile and it also seems that EB extensions is the right tool for the job in this case.
My application is deployed to Elastic Beanstalk using AWS CodePipeline, which is hooked to a GitHub repo.