AWS Elastic Beanstalk allows you to deploy a web application that can scale to match end-user demand. This simple example will demonstrate how you can deploy AcuSensor together with your web application into AWS Elastic Beanstalk.

Step 1. Create your target in Acunetix

For this example, we will assume that the URL for your target is http://eb.acunetixexample.com. Create a target with your URL, enable AcuSensor, download the AcuSensor agent file acusensor.php, and save this file for use later on.

Step 2. Define the web application source bundle

This simple web application will be defined through the following file structure:

/.ebextensions/
/.ebextensions/acusensor.config
/acusensor/
/acusensor/acusensor.php
/public/
/public/index.php
/public/test.php
  1. Create the folders for your source bundle:
    mkdir ~/axexample
    mkdir ~/axexample/.ebextensions
    mkdir ~/axexample/acusensor
    mkdir ~/axexample/public
    
  2. Create your ~/axexample/.ebextensions/acusensor.config file to read as follows:
    files:
      "/etc/php.d/acusensor.ini" :
        mode: "000755"
        owner: root
        group: root
        content: |
          auto_prepend_file=/var/www/html/acusensor/acusensor.php
    
  3. Create your ~/axexample/public/index.php file to read as follows:
    <?php
        echo "<h1>Test PHP Site Example for AWS Elastic Beanstalk</h1>";
        echo "<br>";
        echo "Welcome to the main page.";
        echo "<br>";
        echo "<a href='test.php'>Go to the test page.</a>";
    ?>
    
  4. Create your ~/axexample/public/test.php file to read as follows:
    <?php
        echo "<h1>Test PHP Site Example for AWS Elastic Beanstalk</h1>";
        echo "<br>";
        echo "Welcome to the test page.";
        echo "<br>";
    ?>
    
  5. Copy the acusensor.php file into ~/axexample/acusensor/acusensor.php
  6. Finally, build the source bundle with:
    cd ~/axexample
    zip -rq axexample.zip .
    

Step 3. Deploy your web application to AWS Elastic Beanstalk

  1. From your AWS Dashboard, navigate to Elastic Beanstalk > Environments
  2. Click on the Create a new environment button 

  3. Set your environment tier to Web server environment 

  4. Click on the Select button
  5. On the Elastic Beanstalk > Create environment page:
    • Set the Application name field to the name for your web application; in this example, you will use the name axexample-php 

    • Set the Platform dropdown to PHP 

    • Enable the Upload your code option and click on the Choose file button 

    • Select your axexample.zip source code bundle for upload and click on the Configure more options button 

    • In the Software panel, click on the Edit button 

    • On the Modify software page, set the Document root field to /public 

    • Scroll down to the bottom of the Modify software page and click on the Save button
    • Scroll down to the bottom of the Configure environment page and click on the Create environment button
  6. AWS Elastic Beanstalk will now create your environment; this can take a few minutes 

  7. When the process is complete, you will be sent to your environment’s dashboard 

  8. Take note of your environment’s new URL, which was created automatically by AWS Elastic Beanstalk:
    • You will need this to create a CNAME to point to this URL
    • In this example, we would create a CNAME for eb.acunetixexample.com to point to axexamplephp-env.eba-uyafmbt5.us-east-1.elasticbeanstalk.com; here is an example using the Namecheap cPanel interface: 

  9. Once the CNAME record has been added (giving time for DNS records to propagate), you can see the web application you have created by browsing to your URL (in this example, http://eb.acunetixexample.com): 

Step 4. Test and scan your web application

Point your browser to your web application – in this example, http://eb.acunetixexample.com to confirm it is running as intended; you will get the following:

Finally, run a scan on your target; the Activity panel will confirm that AcuSensor was detected and used for the scan.

SHARE THIS POST
THE AUTHOR
Kevin Attard Compagno
Technical Writer
Kevin Attard Compagno is a Technical Writer working for Acunetix. A technical writer, translator, and general IT buff for over 30 years, Kevin used to run Technical Support teams and create training documents and other material for in-house technical staff.