Installing‎ > ‎

Install on Amazon Web Services Elastic Beanstalk

You can install Live API Creator to run as a cloud-based service in an Amazon Web Services (AWS) Elastic Beanstalk environment.

Verify the Prerequisites

  • You have obtained the package containing the Live API Creator Web application ARchive (WAR) file.
  • You have an AWS account. 

Customize the WAR File

Customize the WAR file to include a file that tells Elastic Beanstalk to install JDBC drivers for all the database types you plan to access.
  1. Create a .ebextensions folder in the same directory as the WAR file.
  2. Create a file named JDBCDriver.config inside this new folder.
  3. Edit the file to include links to public maven repository.
    Note: If you need to use licensed third-party drivers, create a storage location on AWS and modify the source to point to this internal S3 location.
  4. Add at least the MySQL/MariaDB driver. The file (.ebextensions/JDBCDrivers.config) should looks like this:
    Important! Source your own files from a stable source location.
    files: 
      "/usr/share/tomcat8/lib/mariadb-java-client-1.2.2.jar": 
         mode: "000755"
         owner: tomcat
         group: tomcat
         source: http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/1.2.2/mariadb-java-client-1.2.2.jar

      "/usr/share/tomcat8/lib/postgresql-9.4-1206-jdbc42.jar": 
         mode: "000755"
         owner: tomcat
         group: tomcat
         source: http://central.maven.org/maven2/org/postgresql/postgresql/9.4-1206-jdbc42/postgresql-9.4-1206-jdbc42.jar

     "/usr/share/tomcat8/lib/derby-10.12.1.1.jar":
         mode: "000755"
         owner: tomcat
         group: tomcat
         source: http://central.maven.org/maven2/org/apache/derby/derby/10.12.1.1/derby-10.12.1.1.jar

    etc...
  5. From the command line window, add your changes to the WAR by issuing the following command:
    jar uf <war file> .ebextensions/JDBCDrivers.config
Note: The file format is YAML, and is documented in the Amazon docs.

(Optional) Customize the JVM Parameters

  1. Create a JVMoptions.config file in the .ebextensions directory with the following values:
    # Set the JVM options for e.g. heap size

    option_settings:
    - namespace: "aws:elasticbeanstalk:container:tomcat:jvmoptions"
      option_name: Xmx
      value: 1024m

    - namespace: "aws:elasticbeanstalk:container:tomcat:jvmoptions"
      option_name: Xms
      value: 256m

    - namespace: "aws:elasticbeanstalk:container:tomcat:jvmoptions"
      option_name: verbose
      value: gc
  2. From the command line window, add your changes to the WAR by issuing the following command:
    jar uf <war file> .ebextensions/JVMoptions.config

(Optional) Import Derby Database Samples

  1. Obtain a copy of the sample Derby databases and place them in your local S3 storage site.
  2. Create a DerbyExampleDatabases.config file in the .ebextensions directory with the following values:
    # modify the instance to handle a directory of derby databases
    option_settings:
    - namespace: "aws:elasticbeanstalk:application:environment"
    option_name: "derby.system.home"
    value: "/opt/derbydbs"


    sources:
    /opt/derbydbs: "https://<your S3 bucket location>/DerbyExampleDatabases.zip"


    commands:
    derbyOwnership:
    cwd: /opt
    command: "chown -R tomcat:tomcat /opt/derbydbs"
    1. From the command line window, add your changes to the WAR by issuing the following command:
      jar uf <war file> .ebextensions/DerbyExampleDatabases.config

    Create a New Elastic Beanstalk Instance

    This process can take 2-3 minutes to configure, followed by a 20-minute wait for the service to come up, mostly because of the creation of the new RDS instance. Use the WAR file that you customized in the previous step.
    1. Log in to your Amazon Console (often at https://console.aws.amazon.com but that may vary).
    2. Find Deployment & Management and Select the Elastic Beanstalk page.
    3. Click Create New Application.
    4. Enter an application name, for example "Acme's API", and click Next.
      The New Environment page opens.
    5. Click Create web server.
    6.  Select a permission profile and then click Next.
    7. In the Environment Type page, select Tomcat as the Predefined configurationselect an Environment type, and then click Next.
    8. In the Application Version page, select Upload your own and upload the customized API Creator WAR file, then click Next.

      The Environment Information page appears.
    9. Enter an Environment name and an Environment URL, which is the default address for your API service (you can always alias it later), and then click Next.
      The Additional Resources page appears.
    10. Select the Create an RDS DB Instance with this environment checkbox and then click Next. A new RDS instance to store API Server repository metadata is created.

      The Configuration Details page appears.
    11. Select the desired options. Live API Creator can run in a micro instance, but it will take full advantage of any additional CPUs you allocate. Any memory in excess of 4GB is not be used, however. Click Next.
    12. Enter the following value in the Application health check URL option:
      /rest/abl/admin/v2/@heartbeat
      The Environment Tags page appears.
    13. (Optional) Tag your new service, and then click Next.
      The 
      RDS Configuration page appears.
    14. Configure your MySQL database instance and then click Next. A micro instance should be fine for most applications. Write down your user ID and password in case you need it later.

      The Review page appears.
    15. Ensure all settings are as desired and click Launch.
    Your API Creator service is created when the Health icon turns green. You can click its URL. Elastic Beanstalk creates one (or more) EC2 instances, an RDS instance, a load balancer, an elastic IP address, and a security group.

    (Optional) Use an Existing MySQL RDS Database

    You can use an existing MySQL RDS instance rather than creating a new one.
    1. Complete the steps in "Create a New Elastic Beanstalk Instance", skipping steps 10 and 14.
      Note: The service will not start successfully because it doesn't have access to an admin database.
    2. Connect to your MySQL RDS instance, create a new database, and then create a MySQL user who has full access to that new database. Ensure that your API service is authorized to connect to that RDS instance. The RDS instance's security group should include the newly created security group for the API service.
      For more information about setting up the RDS instance, see the MySQL section on Install on Apache Tomcat
      .
    3. Open the Configuration page for your new Elastic Beanstalk application.
    4. Click the gear icon next to Software Configuration.
    5. In the Environment Properties section, define the following new environment properties, and then click Save:
       Environment Property Description
       RDS_HOSTNAME The hostname of your RDS server
       RDS_PORT The port used to access your RDS server, normally 3306
       RDS_DB_NAME The name of the database you created
       RDS_USERNAME The name of the MySQL user you created
       RDS_PASSWORD The password of the MySQL user you created

       LAC_ADMIN_MAX_CONN Optional: overrides the size of the connection pool to the admin database (default is 20)
    6. Restart the Elastic Beanstalk application.

    If you set up the configuration correctly, the application should come online after 2-3 minutes. If it does not, look at the log files to determine a solution to the problem.

    For more information about how to view the log files, see Debugging.