Generating sample game events

Now you are able to successfully send your own player data to S3 as you play the game. Right now, this is a small amount of data since you are only one player. You want to simulate this on a larger scale with more data so you can see useful visualizations. For the purpose of this workshop, you will use the Kinesis Data Generator to simulate data on a larger scale.

  • Click the Help button. This page will walk you through how to configure Kinesis Data Generator with your AWS account. Follow the steps to Create a Cognito User with CloudFormation.

  • This will bring you to the AWS Management Console CloudFormation dashboard. You should see the followng:

  • Hit Next.

  • Create a username and password that will be used to sign into the Kinesis Data Generator. Hit Next again.

  • Leave all other configuration default and hit Next twice more.

  • Review your configurations and check the box at the bottom that acknowledges that this CloudFormation template might create IAM sources.

  • Finally click Create stack. It will take a few minutes for the CloudFormation stack to finish creating.

  • When it is finished, on the Outputs page of the stack you will see a KinesisDataGeneratorUrl. Open this link. You will use this link to sign in to a page that looked the same before.

  • Sign in using the username and password you just configured in the CloudFormation template.

  • When the log-in is successful, you will see some fields that you can start configuring to send sample data to populate your S3 data lake.

  • Set the Region as the same one you created your Kinesis Data Streams in - this lab uses region us-east-1).

  • Set the Stream as the one you created previously - this lab uses the name Peculiar-KDS.

  • On the Record template under Schema Discovery Payload, put the following:

{
"event_id":{{random.number(10000)}},
"event_type":{{random.number(100000)}},
"event_name":"{{random.arrayElement(
        [
         "app_load",
         "login",
         "user_registration",
         "iap_transaction",
         "virtual_goods_transaction"
      ])}}",
"event_timestamp":{{random.number(10000)}},
"event_version":{{random.number(50)}},
"item_id":{{random.number(20)}},
"item_name":"{{random.weightedArrayElement({
         "weights":[
            0.05,
            0.05,
            0.05,
            0.05,
            0.10,
            0.10,
            0.05,
            0.05,
            0.20,
            0.10,
            0.05,
            0.15
         ],
         "data":[
            "Lavender Hat",
            "Lime Hat",
            "Garnet Hat",
            "Student Hat",
            "Starry Hat",
            "Lava Hat",
            "Glass Hat",
            "Poo Hat",
            "Unicorn Hat",
            "Frost Hat",
            "Rainbow Hat",
            "Love Hat"
         ]
      })}}",
"item_amount":{{random.number(10000)}},
"real_value":{{random.number(30)}},
"virtual_value":{{random.number(10000)}},
"currency_type":"USD",
"country_id":"{{random.weightedArrayElement({
         "weights":[
            0.5, 0.2, 0.1, 0.1, 0.1],
        "data":[
         "UNITED STATES",
         "FRANCE",
         "CANADA",
         "MEXICO",
         "SPAIN"]
      })}}",
"platform":"{{random.weightedArrayElement({
        "weights":[
        0.05, 0.2, 0.1, 0.1, 0.05, 0.5],
        "data":[
         "UnityEditor",
         "Xbox",
         "PlayStation",
         "Android",
         "PC",
         "iPhone"
      ]})}}",
"transaction_receipt":"e11cebee-806d-4e1d-8bd1-ceb85bda6fdf",
"application_id":"test-id-here"
}

This data represents random players playing your game. It randomly generates numbers and chooses array elements to simulate fake data that we can work with to query and create visualizations.

Your final configurations should look similar to this:

  • Hit Send data. You should see data starting to send. Let the data generator send a couple thousand records and then finally hit Stop sending data to Kinesis.

Leave the Kinesis Data Generator tab open because you will need to send more data later for the real-time portion of this lab.

  • Go back to the AWS Management Console tab with your Kinesis Data stream open. Click into the stream to view the stream details if you are not viewing them already.

  • Select the Monitoring tab to view metrics. You should see something similar to what is shown below to verify the Kinesis Data Generator is working:

  • Go back to your S3 bucket to look at the contents and verify the data has been delivered.

Now you have a lot of sample player data to work with for the rest of the lab.