with AWS Elastic Beanstalk

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.

Did you know? AWS made it even easier to launch a web application. Jumpstart your application with Amazon Lightsail >>

Launching an Application with AWS Requires an Account

Create a Free Account in Minutes

Receive twelve months of access to the AWS Free Usage Tier and enjoy AWS Basic Support features including, 24x7x365 customer service, support forums, and more.

 


In 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.

AWS Console Image

(click to expand)

Getting-Started-Launch-an-app-0. MC

Now that you’re in the AWS Elastic Beanstalk dashboard, click on Create New Application to create and configure your application.

Amazon Elastic Beanstalk Start Screen

(click to expand)

Getting-Started-Launch-an-app-1

Fill out the Application name with php-sample-app and Description field with Sample PHP App. Click Next to continue.

Getting-Started-Launch-an-app-2

(click to expand)

Getting-Started-Launch-an-app-2

a. For this tutorial, we will be creating a web server environment for our sample PHP application. Click on Create web server.

Getting-Started-Launch-an-app-3a

(click to enlarge)

Getting-Started-Launch-an-app-3a

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.

Getting-Started-Launch-an-app-3b

(click to enlarge)

Getting-Started-Launch-an-app-3b

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.

Getting-Started-Launch-an-app-3c

(click to enlarge)

Getting-Started-Launch-an-app-3c

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.

Getting-Started-Launch-an-app-3d

(click to enlarge)

Getting-Started-Launch-an-app-3d

e. Check the box next to Create this environment inside a VPC. Click Next to continue.

Getting-Started-Launch-an-app-3e

(click to enlarge)

Getting-Started-Launch-an-app-3e

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.

Getting-Started-Launch-an-app-3g

(click to enlarge)

Getting-Started-Launch-an-app-3g

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.


a. Go back to the main Elastic Beanstalk dashboard page by clicking on Elastic Beanstalk. When your application successfully launched, your application’s environment, phpSampleApp-env, will show up as a green box. Click on phpSample-App-env, which is the green box.

Getting-Started-Launch-an-app-4a

(click to enlarge)

Getting-Started-Launch-an-app-4a

b. At the top of the page, you should see a URL field, with a value that contains the Environment URL you specified in step 3 part d. Click on this URL field, and you should see a Congratulations page.

Getting-Started-Launch-an-app-4b

(click to enlarge)

Getting-Started-Launch-an-app-4b

Congratulations! You have successfully launched a sample PHP application using AWS Elastic Beanstalk.

Getting-Started-Launch-an-app-congratulations

(click to enlarge)

Getting-Started-Launch-an-app-congratulations

Now that you have an Elastic Beanstalk application up and running, the next tutorial will walk you through updating your application.

Update Your Application »


Yes
No