So, we need to set up the AWS server for our Laravel project. Let's start with the requirements - for Laravel as a framework, and for our project specifically.
Laravel Server Requirements
According to Official Documentation we have following server requirements:
- PHP >= 8.0
- BCMath PHP Extension
- Ctype PHP Extension
- cURL PHP Extension
- DOM PHP Extension
- Fileinfo PHP Extension
- JSON PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PCRE PHP Extension
- PDO PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
Our Demo Project Requirements
These dependencies may vary depending on what your project actually needs or what organization plans to use, but for now, let's stick to the list below to save you a bit of time in the future:
- NginX HTTP Server
- Zip PHP Extension
- GD PHP Extension
- PHP CLI
- MySQL PHP Extension
- Amazon RDS as MySQL server
Setup EC2 instance
- First you need to have an AWS account, sign in or register at https://aws.amazon.com/. We won't go into the registration process itself.
- When you log in it should look something like this:
- Click on the EC2 link in the top bar.
Alternatively, you can find it in the Services menu under Compute category:
- Now you should be in your EC2 Dashboard, it looks like that:
- In the top right corner, you need to choose your region first. All the stats dashboard is displaying are for this selected region including your servers (instances). Pick the one which seems most suitable for your user base as it affects how fast it can be reached. In this example, we used Europe (Frankfurt)
- On the second row of the dashboard, there is a card named Launch instance. Your servers are called instances on EC2. Click on the Launch instance button to proceed.
- Enter a name for your server, e.g.
Demo web server
- Choose an OS image. We picked Ubuntu because it provides tools out of the box, and doesn't need any custom installation of packages.
The image was left unchanged, other images are for more specific scenarios.
- For tutorial purposes we left the
t2.microinstance type unchanged, since we do not need more power for demo purposes, also it is a free tier.
According to your project requirements, you might want to change this setting to something more powerful.
- To access created instance later you're going to need the SSH key for the server.
Press Create new key pair button:
Enter a unique key pair name and select the following options:
- Key pair type: RSA
- Private key file format: .pem
And press Create key pair on the bottom right corner of the dialog to save and download the key.
Your newly generated key will be automatically downloaded:
- In network settings choose My IP, to allow access only from your IP Address, sometimes you might want to leave it from Anywhere but it is not recommended or add your custom rules.
Check both Allow HTTPS traffic from the internet and Allow HTTP traffic from the internet, since we are setting a web server and want connections to be accepted on 80 and 443 ports by default.
- Then you might want to configure your storage to add more or bigger volumes for your data. We left that unchanged for this tutorial.
- No changes are needed in the Advanced details section. Review the summary in the right sidebar, and press the Launch Instance button in the bottom right corner.
After that you should see that launch successfully initiated:
I've always found the interface for Amazon AWS very daunting but your steps made this setup process simple thanks!
great, Thanks Povilas