Getting Started with ThingWorx > Installing and Upgrading ThingWorx > Amazon RDS Installation
  
Amazon RDS Installation
* 
Before performing this section, perform the steps in the following sections (based on your OS):
1. Follow the steps outlined in the Amazon RDS installation guide. The steps below provide supplemental guidance when you are ready to configure the Specify DB Details page in AWS.
2. On the Specify DB Details page, specify the following information:
a. In the DB Engine Version field, select the latest 9.4 PostgreSQL version available. (9.4.9 in this example).
b. In the DB Instance Class field, select the appropriate class.
* 
m3.2xlarge is recommended for production use.
c. In the Mutli-AZ Deployment field, select Yes if you have an HA environment.
d. Note the DB Instance Identifier and Master Username for later use.
3. On the RDS Dashboard, click Parameter Groups>Create DB Parameter Group.
4. In the Parameter Group Family field, create a Group Name and Description for PostgreSQL database configuration later.
5. On the RDS Dashboard, click Security Groups.
6. Create a DB security group to control the DB access later.
7. In the default DB Security Group, select the security group that the ThingWorx server will be using to allow access from the ThingWorx server to the database server.
* 
This is not the same security group that was created in the previous step. This security group must be created in the EC2 section of AWS with the appropriate inbound/outbound rules to allow the PostgreSQL port to connect to the security group. This security group should also be assigned to the ThingWorx server instance.
8. On the Configure Advanced Settings page, specify the following information:
a. In the Network & Security section, the settings should reflect the overall security configuration of the ThingWorx deployment environment (not specific to the database).
* 
The VPC and VPC Security Group(s) should be created prior to installing the RDS database.
b. In the Database Options section, type thingworx as the Database Name.
* 
thingworx is the default name that is used in the schema creation scripts.
c. In the DB Parameter Group field, select the name of the parameter group created previously.
d. In the Enable Encryption field, select Yes if necessary.
e. In the Backup, Monitoring, and Maintenance sections, select the appropriate options per your organizational needs.
Configure and Execute the Model/Data Provider Schema Script
To set up the PostgreSQL model/data provider schema, the thingworxPostgresSchemaSetup script must be configured and executed. This will set up the public schema under your database on the Amazon RDS PostgreSQL instance.
1. Obtain and open the thingworxPostgresSchemaSetup script from the ThingWorx software download package.
2. If necessary, configure the script. Reference the options in the table below.
* 
UBUNTU/RHEL only: The script can be run with the default parameters as:
$ sudo sh thingworxPostgresSchemaSetup.sh
3. Execute the script.
thingworxPostgresSchemaSetup Script Options
Option
Parameter
Default
Description
Example
-h or -H
server
rds-host
Hostname or IP of RDS PostgreSQL instance.
-h rds-host
-p or -P
port
5432
Port number of PostgreSQL.
-p 5432
-d or -D
database
thingworx
Database name to use.
-d thingworx
-s or -S
schema
public
Schema name to use.
-s mySchema
-u or -U
username
twadmin
Username to update the database schema
-u twadmin
-o or -O
option
all
There are three options:
all: Sets up the model and data provider schemas into the specified database.
model: Sets up the model provider schema into the specified database.
data: Sets up the data provider schema into the specified database.
-o data
Configure platform-settings.json
1. Create a folder named ThingworxPlatform at the root of the drive where Tomcat was installed or as a system variable.
(UBUNTU command)
$ sudo mkdir /ThingworxPlatform
* 
To specify the location where ThingWorx stores its settings, you can set the THINGWORX_PLATFORM_SETTINGS environment variable to the desired location. Ensure that the folder referenced by THINGWORX_PLATFORM_SETTINGS exists and is writable by the Tomcat user. This environment variable should be configured as part of the system environment variables. Ubuntu example: THINGWORX_PLATFORM_SETTINGS=/data/ThingworxPlatform
* 
The ThingWorx server will fail to start if it does not have read and write access to this folder.
2. Place the platform-settings.json file into the ThingworxPlatform folder. This file is available in the software download.
(UBUNTU/RHEL command)
$ sudo cp platform-settings.json /ThingworxPlatform/
3. Open platform-settings.json and configure as necessary. Refer to the configuration options in platform-settings.json Configuration Details.
* 
If your PostgreSQL server is not the same as your ThingWorx server, and you are having issues with your ThingWorx installation, review your Tomcat logs and platform-settings.json file. The default installation assumes both servers are on the same machine.
Install and Configure PostgreSQL DB Host Servers
The DB host server is the Amazon RDS instance that was created above.
1. Edit the parameter group created earlier to suit your environment. Reference the table below.
* 
The values listed in the Configuration column reflect the example deployment in the reference architecture, but can be modified for your environment. For many of the settings in the table below, links are provided to help you determine the configuration values for your environment. RDS specific information can be found at http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html
Setting
Configuration
Description
shared_buffers
1024MB
Optional performance tuning. Sets the amount of memory the database server uses for shared memory buffers. It is recommended to set this at 1/4 of the memory available on the machine. Refer to http://www.postgresql.org/docs/current/static/runtime-config-resource.html#GUC-SHARED-BUFFERS
work_mem
32MB
Optional performance tuning. Specifies the amount of memory to be used by internal sort operations and hash tables before writing to temporary disk files. Refer to http://www.postgresql.org/docs/current/static/runtime-config-resource.html#GUC-WORK-MEM
maintenance_work_mem
512MB
Optional performance tuning. Specifies the maximum amount of memory to be used by maintenance operations. Refer to http://www.postgresql.org/docs/current/static/runtime-config-resource.html#GUC-MAINTENANCE-WORK-MEM
effective_cache_size
Should be set to an estimate of how much memory is available for disk caching by the OS and within the database. It is recommended to set this to half the memory available on the machine.
checkpoint_segments
Depends on the size of the PostgreSQL box. Should set to 32/64/128/256, depending upon machine size.
checkpoint_completion_target
If the checkpoint_segments is changed from the default value of 3, change this to 0.9.
ssl_renegotiation_limit
If PostgreSQL is deployed on Ubuntu, set this value to 0 (never) or increase the default (512MB) to something larger, e.g. 2GB to avoid ssl renegotiation from happening too often between master and synchronous slave.
Install ThingWorx
Go to Install ThingWorx.