Skip to content

Instantly share code, notes, and snippets.

create external schema YourInitial_bigdata from data catalog
database 'YourInitial_bigdata'
iam_role 'Role ARN Copied in Step 12'
region 'us-east-1';
select sensorname, sensorvalue, anomalyscore from YourInitial_bigdata.analytic_csv2parquet where anomalyscore > 2 limit 10;
select sensorname, sensorvalue, anomalyscore from analytic_csv2parquet where anomalyscore > 2 limit 10
CREATE OR REPLACE STREAM "TEMP_STREAM" (
"sensorName" varchar (40),
"sensorValue" integer,
"ANOMALY_SCORE" DOUBLE);
-- Creates an output stream and defines a schema
CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM" (
"sensorName" varchar(40),
"sensorValue" integer,
"ANOMALY_SCORE" DOUBLE,
"created" TimeStamp);
import json
import datetime
import random
import boto3
kinesis = boto3.client('kinesis', region_name='us-east-1') #<--- change region if not in N.Virginia
def getData(sensorType, sensorName, lowVal, highVal):
data = {}
data['sensorType'] = sensorType
@mikeapted
mikeapted / as-sqs-depth.config
Created September 26, 2018 18:25
Autoscale Elastic Beanstalk worker tier based on SQS queue depth
Resources:
ScaleUpPolicy:
Type: AWS::AutoScaling::ScalingPolicy
Properties:
AdjustmentType: ChangeInCapacity
AutoScalingGroupName:
Ref: AWSEBAutoScalingGroup
Cooldown: '1'
ScalingAdjustment: '1'
ScaleDownPolicy: