Skip to content

Commit 14791bf

Browse files
committed
initial commit
1 parent 7c3bd83 commit 14791bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+7649
-6
lines changed

.gitignore

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Build, dist and temp folders
2+
build/
3+
dist/
4+
tmp/
5+
temp/
6+
*/target/
7+
8+
# Compiled source
9+
*.com
10+
*.class
11+
*.dll
12+
*.exe
13+
*.o
14+
*.so
15+
*.py[cod]
16+
*$py.class
17+
18+
# npm & bower
19+
bower_components
20+
node_modules
21+
npm-debug.log
22+
.npmignore
23+
24+
# Caches #
25+
*.sass-cache
26+
27+
# Logs and databases
28+
*.log
29+
*.sql
30+
*.sqlite
31+
32+
# OS generated files
33+
.DS_Store
34+
Desktop.ini
35+
36+
# Thumbnails
37+
._*
38+
ehthumbs.db
39+
*[Tt]humbs.db
40+
41+
# Files that might appear on external disks
42+
.Spotlight-V100
43+
.Trashes
44+
45+
# Packages #
46+
# It's better to unpack these files and commit the raw source because
47+
# git has its own built in compression methods.
48+
*.7z
49+
*.jar
50+
*.rar
51+
*.zip
52+
*.gz
53+
*.bzip
54+
*.xz
55+
*.lzma
56+
57+
#packing-only formats
58+
*.iso
59+
*.tar
60+
61+
# IDEs stuff
62+
.idea
63+
64+
#package management formats
65+
*.dmg
66+
*.xpi
67+
*.gem
68+
*.egg
69+
*.deb
70+
*.rpm
71+
72+
# python
73+
__pycache__/
74+
75+
# python environments
76+
.env
77+
.venv
78+
env/
79+
venv/
80+
81+
# cdk
82+
cdk.out
83+
*.csv
84+
deploy/node_modules/.bin/cdk
85+
86+
*.lst
87+

README.md

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,65 @@
1-
## My Project
1+
# Dynamic Rules Engine
22

3-
TODO: Fill this README out!
3+
## Project Description
44

5-
Be sure to:
5+
The Dynamic Rules Engine is a serverless application that enables real-time evaluation of rules against incoming sensor data. It leverages AWS Kinesis Data Streams for ingesting sensor data and rule definitions, Amazon Managed Service for Apache Flink for processing the data and evaluating rules, and AWS Lambda functions for handling ingestion and processing operations.
66

7-
* Change the title in this README
8-
* Edit your repository description on GitHub
7+
The key components include:
8+
- Amazon Managed Service for Apache Flink
9+
- Amazon Kinesis Data Streams
10+
- AWS Lambda (for testing)
11+
12+
## Creating Rules Engine Jar
13+
14+
Use Maven to build jar.
15+
16+
```bash
17+
mvn package -f rules-engine/pom.xml
18+
```
19+
20+
## Deploy CDK Stack
21+
22+
```bash
23+
npm install ## Install required dependencies for CDK deployment
24+
cdk deploy RulesEngineCdkStack ## Deploy stack
25+
```
26+
27+
## Example Rule
28+
```json
29+
{
30+
"id": "cda160c0-c790-47da-bd65-4abae838af3a", // Some UUID
31+
"name": "RuleTest1",
32+
"status": "ACTIVE", // ACTIVE or INACTIVE
33+
"equipmentName": "THERMOSTAT_1",
34+
"ruleExpression": "(SENSOR_cebb1baf_2df0_4267_b489_28be562fccea.hasChanged(5))",
35+
"sensorWindowMap": {
36+
"SENSOR_cebb1baf_2df0_4267_b489_28be562fccea": 5 // Map of how long the sensor value should be persisted
37+
}
38+
}
39+
```
40+
41+
## Example Sensor Value
42+
```json
43+
{
44+
"equipment": {
45+
"id": "THERMOSTAT_1"
46+
},
47+
"id": "SENSOR_cebb1baf_2df0_4267_b489_28be562fccea", // UUID of sensor
48+
"measureValue": 10,
49+
"eventTimestamp": 1721666423000
50+
}
51+
```
52+
53+
## Contributing
54+
55+
Pull requests are welcome.
956

1057
## Security
1158

1259
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
1360

1461
## License
15-
1662
This library is licensed under the MIT-0 License. See the LICENSE file.
63+
[MIT](https://choosealicense.com/licenses/mit/)
64+
1765

bin/rules-engine-cdk.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env node
2+
import "source-map-support/register";
3+
import * as cdk from "aws-cdk-lib";
4+
import { RulesEngineCdkStack } from "../lib/rules-engine-cdk-stack";
5+
import { AwsSolutionsChecks } from "cdk-nag";
6+
7+
const app = new cdk.App();
8+
new RulesEngineCdkStack(app, "RulesEngineCdkStack", {});
9+
10+
cdk.Aspects.of(app).add(new AwsSolutionsChecks({ logIgnores: true }));

cdk.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"app": "npx ts-node --prefer-ts-exts bin/rules-engine-cdk.ts",
3+
"watch": {
4+
"include": [
5+
"**"
6+
],
7+
"exclude": [
8+
"README.md",
9+
"cdk*.json",
10+
"**/*.d.ts",
11+
"**/*.js",
12+
"tsconfig.json",
13+
"package*.json",
14+
"yarn.lock",
15+
"node_modules",
16+
"test"
17+
]
18+
},
19+
"context": {
20+
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
21+
"@aws-cdk/core:checkSecretUsage": true,
22+
"@aws-cdk/core:target-partitions": [
23+
"aws",
24+
"aws-cn"
25+
],
26+
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
27+
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
28+
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
29+
"@aws-cdk/aws-iam:minimizePolicies": true,
30+
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
31+
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
32+
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
33+
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
34+
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
35+
"@aws-cdk/core:enablePartitionLiterals": true,
36+
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true,
37+
"@aws-cdk/aws-iam:standardizedServicePrincipals": true,
38+
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true,
39+
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true,
40+
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true,
41+
"@aws-cdk/aws-route53-patters:useCertificate": true,
42+
"@aws-cdk/customresources:installLatestAwsSdkDefault": false,
43+
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true,
44+
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true,
45+
"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true,
46+
"@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true,
47+
"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true,
48+
"@aws-cdk/aws-redshift:columnId": true,
49+
"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true,
50+
"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true,
51+
"@aws-cdk/aws-apigateway:requestValidatorUniqueId": true,
52+
"@aws-cdk/aws-kms:aliasNameRef": true,
53+
"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true,
54+
"@aws-cdk/core:includePrefixInUniqueNameGeneration": true,
55+
"@aws-cdk/aws-efs:denyAnonymousAccess": true,
56+
"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true,
57+
"@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": true,
58+
"@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": true,
59+
"@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": true,
60+
"@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": true,
61+
"@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": true,
62+
"@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": true,
63+
"@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": true,
64+
"@aws-cdk/aws-codepipeline:crossAccountKeysDefaultValueToFalse": true
65+
}
66+
}

0 commit comments

Comments
 (0)