Step 2: Create the Kinesis Data Analytics Application - Amazon Kinesis Data Analytics for SQL Applications Developer Guide

For new projects, we recommend that you use the new Managed Service for Apache Flink Studio over Kinesis Data Analytics for SQL Applications. Managed Service for Apache Flink Studio combines ease of use with advanced analytical capabilities, enabling you to build sophisticated stream processing applications in minutes.

Step 2: Create the Kinesis Data Analytics Application

In this section of the Hotspots example, you create an Kinesis Data Analytics application as follows:

  • Configure the application input to use the Kinesis data stream you created as the streaming source in Step 1.

  • Use the provided application code in the AWS Management Console.

To create an application
  1. Create a Kinesis Data Analytics application by following steps 1, 2, and 3 in the Getting Started exercise (see Step 3.1: Create an Application).

    In the source configuration, do the following:

    • Specify the streaming source you created in Step 1: Create the Input and Output Streams.

    • After the console infers the schema, edit the schema. Ensure that the x and y column types are set to DOUBLE and that the IS_HOT column type is set to VARCHAR.

  2. Use the following application code (you can paste this code into the SQL editor):

    CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM" ( "x" DOUBLE, "y" DOUBLE, "is_hot" VARCHAR(4), HOTSPOTS_RESULT VARCHAR(10000) ); CREATE OR REPLACE PUMP "STREAM_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM" SELECT "x", "y", "is_hot", "HOTSPOTS_RESULT" FROM TABLE ( HOTSPOTS( CURSOR(SELECT STREAM "x", "y", "is_hot" FROM "SOURCE_SQL_STREAM_001"), 1000, 0.2, 17) );

  3. Run the SQL code and review the results.

    
                            Results of SQL code showing rowtime, hotspot, and
                                hotspot_heat.

Next Step

Step 3: Configure the Application Output