Module 9: Elastic Beanstalk Assignment
Problem Statement: You work for XYZ Corporation. Your corporation wants to launch a new web-based application and they do not want their servers to be running all the time. It should also be managed by AWS. Implement suitable solutions.
Tasks To Be Performed:
- Create an Elastic Beanstalk environment with the runtime as PHP.
- Upload a simple PHP file to the environment once created.
index.php
<?php
echo "Hello, World! Today's date is " . date('Y-m-d') . ".";
?>
Step 1: Create a New Elastic Beanstalk Environment
-
I open my browser and log into the AWS Management Console.
-
In the search bar at the top, I type “Elastic Beanstalk” and then select it from the dropdown list to access the service.
-
On the Elastic Beanstalk dashboard, I click on the “Create application” button.
-
In the “Environment tier”, I ensure “Web server environment” is selected.
-
In the “Application Information” section:
- I input my desired application name “PHP-App”.
-
Under “Environment information”:
- I name my environment, perhaps “PHP-App-env”.
- In the “Domain” section, I stick with the auto-generated option.
-
In the “Platform” section:
- I confirm “Managed platform” is chosen for “Platform type”.
- I ensure “PHP” is selected from the “Platform” dropdown.
- I choose my desired PHP version from the “Platform branch” dropdown. “PHP 8.2 running on 64bit Amazon Linux 2”.
- I leave the “Platform version” as the recommended version
-
In the “Application code” section:
- I’ll pick “Sample application”, for now and deploy my code later.
-
In the “Presets” section:
- I left it “Single instance”.
-
Once I’ve filled everything, I’ll click “Next” and “Skip to review” button and “Submit” to set up the environment.
Deploying My Code to Elastic Beanstalk:
- I clicked my environment,
PHP-App-env-env
. - I clicked on
Upload and deploy
. - I chose my file,
index.zip
, and uploaded it. - I named this upload
PHP-App-env-version-1
. - I pressed
Deploy
and waited for it to finish. - After deploying, I tested my PHP page by visiting the provided domain:
PHP-App-env-env-eba-nsk8y8bp.us-east-1.elasticbeanstalk.com
.
I’ve successfully set up an AWS Elastic Beanstalk environment running PHP and deployed my simple PHP application.