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:

  1. Create an Elastic Beanstalk environment with the runtime as PHP.
  2. 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

  1. I open my browser and log into the AWS Management Console.

  2. In the search bar at the top, I type “Elastic Beanstalk” and then select it from the dropdown list to access the service.

  3. On the Elastic Beanstalk dashboard, I click on the “Create application” button.

  4. In the “Environment tier”, I ensure “Web server environment” is selected.

  5. In the “Application Information” section:

    • I input my desired application name “PHP-App”.
  6. Under “Environment information”:

    • I name my environment, perhaps “PHP-App-env”.
    • In the “Domain” section, I stick with the auto-generated option.
  7. 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
  8. In the “Application code” section:

    • I’ll pick “Sample application”, for now and deploy my code later.
  9. In the “Presets” section:

    • I left it “Single instance”.
  10. 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:

  1. I clicked my environment, PHP-App-env-env.
  2. I clicked on Upload and deploy.
  3. I chose my file, index.zip, and uploaded it.
  4. I named this upload PHP-App-env-version-1.
  5. I pressed Deploy and waited for it to finish.
  6. 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.