Docs‎ > ‎Install Live API Creator‎ > ‎

Install on AWS Elastic Beanstalk

You can install CA Live API Creator (LAC) to run as a cloud-based service on Amazon Web Services (AWS) Elastic Beanstalk.

Verify the Prerequisite

  • You have obtained the package containing the APICreator.war file and uploaded it to your site.

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 folder named .ebextensions.
  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. From the command line window, add your changes to the WAR by issuing the following command:
    $jar uf <war file> .ebextensions/JDBCDrivers.config
  5. 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...

(Optional) Customize JVM configurations

To configure your JVM options, create a file JVMoptions.config 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

(Optional) Import Derby Database Samples

To configure Derby, create the DerbyExampleDatabases.config file. Note: Obtain a copy of the sample Derby databases and place them in our local S3 storage site.
# 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://s3-us-west-1.amazonaws.com/caliveapicreator-builds/2016/02/2272/DerbyExampleDatabases.zip"


commands:
derbyOwnership:
cwd: /opt
command: "chown -R tomcat:tomcat /opt/derbydbs"

The file format is YAML, and is documented in the Amazon docs. To add your custom changes to a WAR file, issue the following command from a command window:

$jar uf <war file> .ebextensions/JDBCDrivers.config

$jar uf <war file> .ebextensions/JVMoptions.config

$jar uf <war file> .ebextensions/DerbyExampleDatabases.config

Create a New MySQL RDS Instance

You can create a new MySQL RDS Instance (recommended) or use an existing MySQL RDS instance. This process can take 2-3 minutes to configure, followed by a 15-minute wait for the service to come up. 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 configuration, select 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.
  9. In the Environment Information page, 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.
  10. In the Additional Resources page, 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.
  11. In the Configuration Details page, 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. If, in step 8, you selected Load balancing, auto scaling as the environment type, the Application health check URL option is enabled. Enter the following value:
    /rest/abl/admin/v2/@heartbeat

  13. (Optional) In the Environment Tags page, tag your new service, and then click Next.
  14. In the RDS Configuration page, configure your MySQL database instance and then click Next. A micro instances should be fine for most applications. Write down your user ID and password in case you need it later.
  15. In the Review page, ensure all settings are as desired and click Launch.
    The service can take up to 20 minutes to create, mostly because of the creation of the new RDS instance. 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. You can modify any of these, but if you make changes to the EC2 instance(s), your changes may be lost if you use auto-scaling.

(OPTIONAL) Use an Existing MySQL RDS Database

You can use an existing MySQL RDS instance rather than creating a new one.
  1. If you want to use MySQL Workbench or any tool on your local desktop, add your IP address to the security group of the RDS MySQL instance.
  2. Complete the steps in "Create a New RDS Instance", skipping steps 11 and 14.
    Note: The service will not start successfully because it doesn't have access to an admin database.
  3. 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. See the MySQL section of this page.
  4. Open the Configuration page for your new application.
  5. Click the gear icon next to Software Configuration.
  6. In the Environment Properties section, define 5 new environment properties, and then click Save.
     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

  7. If required, restart the 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.