AWS Prerequisites and Setup

DynamoDB

Note, there seem to be some slight differences in method of access in older vs newer version of the DynamoDB API. The below instructions work correctly for version 3.3.0.0 of the 'AWSSDK - Amazon DynamoDB' package available from NuGet.

  1. Within your AWS account, create an Identity and Access Management (IAM) user which has access to DynamoDB. You will use the credentials of this user to log into and use DynamoDB.
  2. On the disk of the host machine, create a 'credentials' text file (i.e. named 'credentials' with no extension). The file should contain you IAM user details in the following format...
    [profile name] aws_access_key_id = IAM access key id aws_secret_access_key = IAM secret access key
  3. In the OraclePermissionGeneratorWebServiceAPI app.config file create the following 'configSections' section within the 'configuration' tag. Note that the 'profileName' attribute value should match the profile name in your credentials file...
    <configuration> <configSections> <section name="aws" type="Amazon.AWSSection, AWSSDK.Core"/> </configSections> <aws profileName="profile name" profilesLocation="full path to your 'credentials' file" region="us-east-1" /> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration>
  4. Download and install the AWS Command Line Interface (CLI). This is required to run scripts to create the required tables in DynamoDB.
  5. Run the following command at the command line to create the DynamoDB table., potentially setting the 'region' parameter to the AWS region you want to use...
    aws --region us-east-1 dynamodb create-table --table-name TrackingData --attribute-definitions AttributeName=UserIdentifier,AttributeType=S AttributeName=TimeStamp,AttributeType=S --key-schema AttributeName=UserIdentifier,KeyType=HASH AttributeName=TimeStamp,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1

    The following statement can be used to subsequently delete the table if required...
    aws --region us-east-1 dynamodb delete-table --table-name TrackingData

The AwsDynamoDbTrackingDataLogger class can be made to work with the local version of DynamoDB, by adding the 'serviceUrl' parameter to its constructor, and setting appropriately (e.g. the default endpoint for local DynamoDB is "http://localhost:8000").

Redshift

  1. Create a Redshift cluster and node through the AWS console. I use the 'dc1.large' node type for testing. Note that as of November 2016, Amazon offer a free trial of Redshift, whereby you can run a 1-node cluster for 750 hours for free (a separate offer to the general AWS free tier).
  2. By default the Redshift server will be setup to accept any incoming network traffic, so make sure you assign it to a security group and allow only traffic from you client machine(s) on the Redshift port (5439 by default).
  3. A SQL client application is required to create the table to store the tracking data. Amazon suggest using SQL Workbench, which is lightweight and simple to install (it's a Java application, so on Windows PCs installation is not required... provided the Java runtime is installed, just unzip the SQL Workbench package and execute). Connect to the Redshift instance, and run the following statement to create the required table...
    CREATE TABLE tracking_data ( time_stamp TIMESTAMP NOT NULL, user_id VARCHAR(256) NOT NULL, method_name VARCHAR(4096) ENCODE BYTEDICT NOT NULL, latitude DOUBLE PRECISION NULL, longitude DOUBLE PRECISION NULL, seconds_since_update INTEGER NULL, ip_addess_octet_1 SMALLINT NULL, ip_addess_octet_2 SMALLINT NULL, ip_addess_octet_3 SMALLINT NULL, ip_addess_octet_4 SMALLINT NULL );
  4. Install the PostgreSQL ODBC driver to allow .NET code to connect to Redshift. This is available from the PostgreSQL website (for development and testing I used the '09_05_0400' version).

Note - As the rental costs for Redshift nodes can be high, ensure the Redshift instance is shutdown when not used, or at the end of testing.


Return to the main page.