Deploy Squidex to AWS Elastic Beanstalk
Modify Squidex binaries to add support for .NET 7 on Elastic Beanstalk
This article demonstrates how to run Squidex, an open-source headless CMS with an API, on AWS Elastic Beanstalk.
Squidex uses .NET framework 7 and hence the binaries released by default cannot run as it is on the Elastic Beanstalk .NET platforms. The latest .NET Core on Amazon Linux 2 version 2.5.6 supports .NET Frameworks 6.0.20 and 3.1.32.
One way to work around this is to bundle the application as a self-contained app. Another approach is to update the .NET SDK to 7. This article demonstrates the latter approach implemented using platform hooks which are used to extend Elastic Beanstalk Linux platforms. The same can also be achieved using commands which can be part of configuration files (.ebextensions) used to configure environments.
Pre-requisites
AWS Account
- An existing key-pair
A MongoDB cluster
A domain (optional)
Preparing Squidex binaries for deployment to Elastic BeanStalk
Download the binaries zip file from https://github.com/Squidex/squidex/releases
As an example, binaries.zip from the 7.5.0 release of Squidex has been used here.
https://github.com/Squidex/squidex/releases/download/7.5.0/binaries.zipExtract the zip file.
Create the following directory structure in the extracted folder:
<approot>/.platform/hooks/prebuild
Create a bash script, we will call it
01_dotnet7_install.shfor this demonstration, inside the prebuild folder and copy the following code into it. Save and exit.#!/bin/bash sudo su curl -sSLhttps://dot.net/v1/dotnet-install.sh| bash /dev/stdin --channel 7.0 --runtime aspnetcore -InstallDir /usr/local/dotnet/The final folder structure along with the file show looks something similar to the screenshot below:

Zip the folder. DO NOT zip the extracted folder, rather zip the contents of the folder and make sure to include hidden files. The deployment will fail if this step is not executed properly.
Deploy the binaries to AWS Beanstalk
The process to deploy the binaries is the same as any other Elastic Beanstalk deployment. However, pay attention to the Environment variables section and ensure they are correct, failing which the application won't launch properly.
Navigate to the AWS Beanstalk console and click Create Application from the Get Started screen.
This brings us to a Configure environment page where we can start configuring the application environment.
Select Web server environment for Environment tier

Enter an Application name under Application information.

Under Environment information, an Environment name should be autogenerated, you can leave it as it is or change it as per your preference. If you do not have a domain of your own, set a value for Domain and click Check availability to see if the name is available.
Leave it blank if you want to use your domain.
For Platform, select Managed Platform, and choose .NET Core on Linux. Leave the rest to defaults.

Next, select Upload your code, set a Version label, choose Local file and click Choose file to select the zip file created earlier.

For this demonstration, we leave the rest of the settings as it is. Only Single instance configuration is tested for Elastic Beanstalk. Click Next to move to the next screen.

In the next step, a service role must be created (or an existing one used) along with choosing an existing EC2 key pair and EC2 instance profile.
The service role can be created in this step by selecting Create and use new service role. If you need to create an EC2 instance profile, you can do so in another tab and refresh the list here. The permissions required to create the profile can be viewed by clicking View permission details.
The next step allows setting up networking, database, and tags but they are optional and can be left as it is. Beanstalk will use the default VPC. Covering this in detail here is out of the scope of this article. Click Next to move to the next step.
The following step is also optional and one can move forward by clicking Next.
In the Monitoring step, select your preference for Monitoring, Managed platform updates, Rolling updates etc. and set any environment properties.
For this demonstration, a Basic health reporting system is selected and managed platform updates are unchecked. The rest has been left to their defaults.
The following Environment properties must be set. Replace example values with actual values. Click Next when done.
Finally, review and click Submit.
Monitor the status of the Elastic Beanstalk deployment.
Access Squidex
Navigate to the URL and you should be presented with Squidex welcome screen.


