How to setup your AWS and LAMP to run your First PHP App?

Cloud is amazing and it's way more diverse and huge collection of services that it provides. This Article is for those PHP developers who want to set up their PHP Application on AWS without losing themselves much into Dept of AWS. Sharing this article will make you smart as well. Like and Share it now.
Get started with Amazon web services to install LAMP and PHP app : Intelligent computing

Hey Hi
Only few of you lazy programmer going to read my few opening paragraph as you are already trying hard to learn how to get into installing LAMP and running your PHP app on AWS server ASAP.
I won’t eat up your much time and i’ll get started right on point.

Before you and i proceed, i believe you have fully setup AWS account and you can login to your console and see these bunch of options which hardly resembles anything from cPanel world.
I myself stuck for days to find out final solution where to start and how to deploy my app finally.
So i am here to help you out.
Let's start.
We’ll proceed as follows.
  1. Setting up AWS virtual server
  2. Setting up connection to the server
  3. Installing LAMP and phpmyadmin
  4. Uploading your first PHP app.

Easy right?

How to Setup up AWS virtual server machine?

AWS console : Intelligent computing

Do as follow
  1. Navigate to Compute section
  2. Choose ec2 under computer section : Intelligent computing
    Select EC2.
  3. On next page, you may and may not have already setup EC2 instance, in that case i am going to tell you how to setup new instance.
  4. Click on Blue button “Launch Instance” and get you are ready to launch instance on EC2.
Launch instance in ec2 AWS console : Intelligent computing


Instance of EC2 is kind of virtual system that we are going to install where you can choose any configuration/security and access based on your need.
Except few thing, you can Change these configuration after launch as well. But be careful for now.
There are various steps involved in this process, let's proceed one by one.
  1. Choose OS

Choose OS type for your EC2 machine in AWS console : Intelligent computing
Add caption

You can choose any OS based on your requirement, but since we have planned for LAMP installation, we’ll go for Linux distribution only.
For demonstration purpose, i am choosing free tier as shown in image, in that case only OS option having free tier eligibility will be available to choose.
Selecting linux server OS for ec2 machine in aws console : Intelligent computing

You can select latest Ubuntu server and mostly 64 bit will be recommended for from IC.

2. Choose Instance type

Instance type selection for your EC2 machine in AWS console : Intelligent computing

On next screen, you can choose system based on your budget, you can also have free tier instance having 1 Processor and 1Gb of memory. I am choosing this for demonstration purpose only, you can choose whatever you want and after selection, Click on Next : Configure instance detail to proceed.

3. Configure Instance Details

EC2 machine configuration in AWS console : Intelligent computing

You can leave this settings as it is but you can change if you need to change on anything. Or simply proceed to next step for adding storage.

4. Add Storage


You can add Free space up to 30Gig(at the time of writing this post) you may see change in this setting according to their own plan. You can proceed next step of adding tags.

5. Add Tags

I haven’t seen any significant use of this yet, still you can add some tags and value to make this instance easy to search in console, if you don’t want to, just proceed to next step.

6. Configure Security Group

Adding security group and inbound and outbound rules for your ec2 machine in aws ec2 console : Intelligent computing

Security group are set of rules for inbound and outbound connection for the system that you can define, you can create multiple security group and add different permissions based on that and you can change security group when required.

For our use, we can proceed by creating one security group having following rule as shown in image.
  1. SSH for accessing our site from SSH console.
  2. HTTP for accessing general web pages
  3. HTTPS for accessing secured web pages

7. Review and Launch


You can have look on each of these settings and change anything if you want. If not you are good to go.
Click Launch but
On popup, Make sure to create a new key-pair file if you don’t have any existing key pair file already.
Create or add new keypair for your Ec2 machine in AWS console : Intelligent computing

Name new file
And download this file, a pem file will be downloaded. Keep this file safe as without this file you will not be able to access your instance and all is useless.
Once file is downloaded, you can click on launch instance.

This might take few minutes based on your configuration.
You can visit Services > EC2 Dashboard to see list of EC2 instances.
You can select and see details of EC2 instance as shown below.
EC2 dashboard and details of EC2 : Intelligent computing


2. Setting up connection to the server

Once your instance is launched, you can connect your instance using putty like application on windows or simply using terminal on your Linux machine.
  1. Select the instance you want to connect.
  2. Click on the connect button and see instructions.
  3. Open your terminal or putty and based on the location of key files you saved on last step of EC2 configuration setting, you can fire up command


ssh -i "path/to/keyfilename.pem" ubuntu@ec2url.com

This should log you into the ec2 instance from your local machine.
On next post i’ll be telling you how you can install LAMP server and upload your first PHP application along with installing phpmyadmin, enabling htaccess and connecting your server with SFTP using filezilla.
For now, please share this post, help any of your friend who might need this to know and on all of your social media platform.

Dheeraj Thedijje

Dheeraj Thedijje

Powered by Blogger.