Skip to main content
This document is for:
Invicti Enterprise on-demand, Invicti Enterprise on-premises

Deploy Invicti Shark for PHP - AWS Elastic Beanstalk

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

Step 1: Create your target in Invicti Enterprise

For this example, assume that the URL for your target is http://eb.acunetixexample.com/.

  1. Create a target with your URL.
  2. Select Scans > New Scan from the left-side menu and choose this URL for the scan.
  3. Enable Invicti Shark.
  4. Download the Shark agent file acusensor.php, and save this file for use later on.

Step 2: define the web application source bundle

This simple web application is 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
  1. Create your ~/axexample/.ebextensions/shark.config file to read as follows:
files:
"/etc/php.d/shark.ini" :
mode: "000755"
owner: root
group: root
content: |
auto_prepend_file=/var/www/html/acusensor/acusensor.php
  1. 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>";
?>
  1. 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>";
?>
  1. Copy the shark.php file and build the source bundle:

  2. Copy the shark.php file into ~/axexample/acusensor/acusensor.php.

  3. Build the source bundle with the following:

cd ~/axexample
zip -rq axexample.zip .

Step 3: deploy your web application to Beanstalk

  1. From your AWS Dashboard, navigate to Elastic Beanstalk > Environments.
  2. Click Create a new environment.
Create new environment in AWS Elastic Beanstalk.
  1. Set your environment tier to the Web server environment.
  2. Click Select.
  3. On the Elastic Beanstalk > Create environment page:
    • Enter a friendly name for your app. (For this illustration, use axexample-php.)
    • From the Platform drop-down, choose PHP.
PHP settings for the new environment in AWS Elastic Beanstalk.
  • Enable Upload your code
  • Click Choose file.
  • Choose your axexample.zip source code bundle for upload.
  • Click Configure more options.
  • On the Software panel page, click Edit.
Edit the software in AWS Elastic Beanstalk for the new environment.
  • On the Modify software page, set the Document root field to /public.
Set document root to /public
  • On the Modify software page, select Save.
  • On the Configure environment page, select Create environment.
  1. AWS Elastic Beanstalk creates your environment; this can take a few minutes.
AWS creating environment.
  1. When the process is complete, you are redirected to your environment's dashboard.
Environment dashboard.
  1. Take note of your environment's new URL created by AWS Elastic Beanstalk:
    • You need this to create a CNAME to point to this URL
    • In this example, 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:
Create CNAME record.
  1. 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's running as intended.
  • You can run a scan on your target.

Need help?

Invicti Support team is ready to provide you with technical help. Go to Help Center

Was this page useful?