This step-by-step guide will help you get a sample PHP application up and running with AWS Elastic Beanstalk (EB). EB supports other languages besides PHP, such as Java, .NET, Node.JS, Python, Ruby, Docker, and Go, but the focus of this tutorial will be on PHP (other languages will follow the same process). You will first configure your EB application, then setup your EB environment where your application will be launched into.
Sign Up Now
Create a Free AccountIn this tutorial, we will be using a pre-built sample PHP application. To download this sample PHP application file, please click here.
When you click here, the AWS management console will open in a new browser window, so you can keep this step-by-step guide open. When this screen loads, enter your user name and password to get started. Then find Elastic Beanstalk under Compute, and click to open the Elastic Beanstalk dashboard.
b. Click on Select a platform next to Predefined configuration, then select PHP. Next, click on the drop-down menu next to Environment type, then select Single instance.
Note: an “instance” is referring to Amazon’s Elastic Compute Cloud (EC2) compute service. A “single instance” means we will be using one virtual server to deploy our application into.
We will discuss how to scale and load balance your application in a separate tutorial. Click Next to continue.
c. Under Source, select the Upload your own option, then click Choose File to select the sample php-v1.zip file we downloaded earlier. Before moving on, double click on the php-v1.zip file that you downloaded to your local machine to view the contents within. This will help you better understand what your zip file should look like when working with your own PHP application.
Note: PHP does not enforce a strict file structure for applications; flat file structure will work fine.
Click Next to continue.
d. Fill in the values for Environment name with phpSampleApp-env. For Environment URL, fill in a globally unique value since this will be your public-facing URL; we will use phpsampleapp-env in this tutorial, so please choose something different from this one. Lastly, fill Description with Sample PHP App. For the Environment URL, make sure to click Check availability to make sure that the URL is not taken. Click Next to continue.
f. Here, leave all fields with their default values. Click on Next to continue and then click Next again on the next screen dealing with Environment Tags. On the next screen, Select the first availability zone listed by checking the box under the EC2 column. Your screen may look different than the one shown, but this is okay as long as you select one subnet.
Note: An availability zone (AZ) is a cluster of data centers that are isolated from other AZs in a geographic region. This is used when you want to increase to a highly available architecture. For this tutorial, we will be using a single AZ.
Leave everything else to their default values, then click Next to continue.
g. At the Permissions step, leave everything to their default values, then click Next to continue. Then review your environment configuration on the next screen and then click Launch to deploy your application.
Note: Launching your application may take a few minutes.
Now that you have an Elastic Beanstalk application up and running, the next tutorial will walk you through updating your application.