Skip to content

Commit

Permalink
Removed kinesis basic applications. Added option for user to upload w…
Browse files Browse the repository at this point in the history
…ebsite content
  • Loading branch information
root committed Jul 16, 2019
1 parent 80f30de commit 2864f58
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 362 deletions.
197 changes: 17 additions & 180 deletions templates/quickstart-ct-clickstream-analytics-master.template
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ Metadata:
Parameters:
- QSS3BucketName
- QSS3KeyPrefix
- Label:
default: Custom website configuration
Parameters:
- WebsiteContent
ParameterLabels:
ESClusterInstanceCount:
default: Number of instances to run in cluster
Expand Down Expand Up @@ -177,6 +181,8 @@ Metadata:
default: Buffer size
S3DestinationPrefix:
default: Destination prefix
WebsiteContent:
default: Website content s3 bucket
Parameters:
ESClusterInstanceCount:
Type: String
Expand Down Expand Up @@ -671,6 +677,9 @@ Parameters:
- 'yes'
- 'no'
Default: 'no'
WebsiteContent:
Description: Provide S3 bucket name with path to deploy website in this quickstart. Leave blank if there is no site to deploy.
Type: String
Mappings:
InstanceType2Arch:
t1.micro:
Expand Down Expand Up @@ -1895,6 +1904,7 @@ Resources:
EOL'
/usr/bin/sudo /sbin/service aws-kinesis-agent start
/usr/bin/sudo /sbin/chkconfig aws-kinesis-agent on
/usr/bin/aws s3 sync s3://${WebsiteContent} /var/www/html/ || true
/usr/bin/sudo service httpd restart
Properties:
KeyName: !Ref 'AppKeyPairName'
Expand Down Expand Up @@ -2113,6 +2123,13 @@ Resources:
/usr/bin/wget https://s3-us-west-2.amazonaws.com/ctepoc-clickctream-dataset/OtherClickStreamDataSets/Schematic_Log.csv
/usr/bin/sudo /bin/mv ./GADemoData.csv ./Schematic_Log.csv /var/log/demodata
/usr/bin/aws s3 sync /var/log/demodata/ s3://${StreamingAnalyticsBucket}/demodata --acl public-read
WebsiteContentURL=${WebsiteContent}
if [ -z "$WebsiteContentURL" ]
then
echo "WebsiteContentURL Variable is empty."
else
/usr/bin/aws s3 sync s3://${WebsiteContent} /var/www/html/ && /usr/bin/sudo /sbin/service httpd restart
fi
/usr/bin/sudo /bin/chown -R aws-kinesis-agent-user:aws-kinesis-agent-user /var/log/demodata/
source <(aws sts assume-role --role-arn arn:aws:iam::${AWS::AccountId}:role/${AppRole} --role-session-name "QuickStart" --duration-seconds 1900 | jq -r '.Credentials | @sh "export AWS_SESSION_TOKEN=\(.SessionToken)\nexport AWS_ACCESS_KEY_ID=\(.AccessKeyId)\nexport AWS_SECRET_ACCESS_KEY=\(.SecretAccessKey) "')
export PGPASSWORD='${MasterUserPassword}'
Expand Down Expand Up @@ -2294,84 +2311,6 @@ Resources:
Resource: !Ref BastionNotificationTopic
Topics:
- !Ref BastionNotificationTopic
ESAnalyticsRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: kinesisanalytics.amazonaws.com
Action: "sts:AssumeRole"
Path: "/"
Policies:
- PolicyName: Open
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- "firehose:DescribeDeliveryStream"
- "firehose:Get*"
- "firehose:PutRecordBatch"
- "firehose:PutRecord"
- "firehose:DescribeDeliveryStream"
- "es:*"
- "kinesis:*"
Resource: !GetAtt FIrehoseToElasticsearch.Arn
RSAnalyticsRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: kinesisanalytics.amazonaws.com
Action: "sts:AssumeRole"
Path: "/"
Policies:
- PolicyName: Open
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- "firehose:DescribeDeliveryStream"
- "firehose:Get*"
- "firehose:PutRecordBatch"
- "firehose:PutRecord"
- "firehose:DescribeDeliveryStream"
- "redshift:*"
- "kinesis:*"
Resource: !GetAtt FIrehoseToRedshift.Arn
S3AnalyticsRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: kinesisanalytics.amazonaws.com
Action: "sts:AssumeRole"
Path: "/"
Policies:
- PolicyName: Open
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- "firehose:DescribeDeliveryStream"
- "firehose:Get*"
- "firehose:PutRecordBatch"
- "firehose:PutRecord"
- "firehose:DescribeDeliveryStream"
- "s3:*"
- "kinesis:*"
Resource: !GetAtt FIrehoseToS3.Arn
ESCloudwatchLogsGroup:
Type: AWS::Logs::LogGroup
Properties:
Expand Down Expand Up @@ -2399,102 +2338,6 @@ Resources:
Properties:
LogGroupName: !Ref S3CloudwatchLogsGroup
LogStreamName: S3
BasicApplication1:
Type: AWS::KinesisAnalytics::Application
Properties:
ApplicationDescription: "ES-SampleApp"
ApplicationCode: "Example Application Code"
Inputs:
- NamePrefix: "exampleNamePrefix"
InputSchema:
RecordColumns:
- Name: "example"
SqlType: "VARCHAR(16)"
Mapping: "$.example"
RecordFormat:
RecordFormatType: "JSON"
MappingParameters:
JSONMappingParameters:
RecordRowPath: "$"
KinesisFirehoseInput:
ResourceARN: !GetAtt FIrehoseToElasticsearch.Arn
RoleARN: !GetAtt ESAnalyticsRole.Arn
BasicApplicationOutputs:
Type: AWS::KinesisAnalytics::ApplicationOutput
DependsOn: BasicApplication1
Properties:
ApplicationName: !Ref BasicApplication1
Output:
Name: "exampleOutput"
DestinationSchema:
RecordFormatType: "CSV"
KinesisFirehoseOutput:
ResourceARN: !GetAtt FIrehoseToElasticsearch.Arn
RoleARN: !GetAtt ESAnalyticsRole.Arn
BasicApplication2:
Type: AWS::KinesisAnalytics::Application
Properties:
ApplicationDescription: "RS-SampleApp"
ApplicationCode: "Example Application Code"
Inputs:
- NamePrefix: "exampleNamePrefix"
InputSchema:
RecordColumns:
- Name: "example"
SqlType: "VARCHAR(16)"
Mapping: "$.example"
RecordFormat:
RecordFormatType: "JSON"
MappingParameters:
JSONMappingParameters:
RecordRowPath: "$"
KinesisFirehoseInput:
ResourceARN: !GetAtt FIrehoseToRedshift.Arn
RoleARN: !GetAtt RSAnalyticsRole.Arn
SecondBasicApplicationOutputs:
Type: AWS::KinesisAnalytics::ApplicationOutput
DependsOn: BasicApplication2
Properties:
ApplicationName: !Ref BasicApplication2
Output:
Name: "exampleOutput"
DestinationSchema:
RecordFormatType: "CSV"
KinesisFirehoseOutput:
ResourceARN: !GetAtt FIrehoseToRedshift.Arn
RoleARN: !GetAtt RSAnalyticsRole.Arn
BasicApplication3:
Type: AWS::KinesisAnalytics::Application
Properties:
ApplicationDescription: "S3-SampleApp"
ApplicationCode: "Example Application Code"
Inputs:
- NamePrefix: "exampleNamePrefix"
InputSchema:
RecordColumns:
- Name: "example"
SqlType: "VARCHAR(16)"
Mapping: "$.example"
RecordFormat:
RecordFormatType: "JSON"
MappingParameters:
JSONMappingParameters:
RecordRowPath: "$"
KinesisFirehoseInput:
ResourceARN: !GetAtt FIrehoseToS3.Arn
RoleARN: !GetAtt S3AnalyticsRole.Arn
ThirdBasicApplicationOutputs:
Type: AWS::KinesisAnalytics::ApplicationOutput
DependsOn: BasicApplication3
Properties:
ApplicationName: !Ref BasicApplication3
Output:
Name: "exampleOutput"
DestinationSchema:
RecordFormatType: "CSV"
KinesisFirehoseOutput:
ResourceARN: !GetAtt FIrehoseToS3.Arn
RoleARN: !GetAtt S3AnalyticsRole.Arn

Outputs:
AppSecurityGroup:
Expand Down Expand Up @@ -2523,9 +2366,3 @@ Outputs:
Value: !GetAtt PublicLoadBalancer.DNSName
LoadBalancerDNSEndpoint:
Value: !Sub 'http://${PublicLoadBalancer.DNSName}'
KinesisAnalyticsApp1:
Value: !Ref BasicApplication1
KinesisAnalyticsApp2:
Value: !Ref BasicApplication2
KinesisAnalyticsApp3:
Value: !Ref BasicApplication3
Loading

0 comments on commit 2864f58

Please sign in to comment.