Skip to content

Commit be98f5a

Browse files
author
Jonathan Eid
committed
Added Theta Edge Node CDK
1 parent a7dd4aa commit be98f5a

26 files changed

+2224
-0
lines changed

lib/theta/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.js
2+
!jest.config.js
3+
*.d.ts
4+
node_modules
5+
*.lock
6+
7+
# CDK asset staging directory
8+
.cdk.staging
9+
cdk.out

lib/theta/README.md

Lines changed: 253 additions & 0 deletions
Large diffs are not rendered by default.

lib/theta/app.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import 'dotenv/config'
2+
import "source-map-support/register";
3+
import * as cdk from "aws-cdk-lib";
4+
import * as config from "./lib/config/edgeConfig";
5+
import * as configTypes from "./lib/config/edgeConfig.interface";
6+
import { EdgeCommonStack } from "./lib/common-stack";
7+
import { EdgeSingleNodeStack } from "./lib/single-node-stack";
8+
import * as nag from "cdk-nag";
9+
10+
const app = new cdk.App();
11+
cdk.Tags.of(app).add("Project", "AWS_THETA_EDGE");
12+
13+
new EdgeCommonStack(app, "edge-common", {
14+
stackName: `edge-nodes-common`,
15+
env: { account: config.baseConfig.accountId, region: config.baseConfig.region }
16+
});
17+
18+
new EdgeSingleNodeStack(app, "edge-single-node", {
19+
stackName: `edge-single-node-${config.baseNodeConfig.edgeNetwork}`,
20+
21+
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
22+
nodeRole: <configTypes.EdgeNodeRole> "single-node",
23+
instanceType: config.baseNodeConfig.instanceType,
24+
instanceCpuType: config.baseNodeConfig.instanceCpuType,
25+
edgeNetwork: config.baseNodeConfig.edgeNetwork,
26+
edgeNodeGpu: config.baseNodeConfig.edgeNodeGpu,
27+
edgeLauncherVersion: config.baseNodeConfig.edgeLauncherVersion,
28+
dataVolume: config.baseNodeConfig.dataVolume
29+
});
30+
31+
32+
33+
// Security Check
34+
cdk.Aspects.of(app).add(
35+
new nag.AwsSolutionsChecks({
36+
verbose: false,
37+
reports: true,
38+
logIgnores: false
39+
})
40+
);

lib/theta/cdk.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"app": "npx ts-node --prefer-ts-exts app.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-opensearchservice:enableOpensearchMultiAzWithStandby": true
56+
}
57+
}

lib/theta/doc/assets/Architecture-Theta-Edge-Single-Node.drawio

Lines changed: 330 additions & 0 deletions
Large diffs are not rendered by default.
114 KB
Loading

lib/theta/jest.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
testEnvironment: 'node',
3+
roots: ['<rootDir>/test'],
4+
testMatch: ['**/*.test.ts'],
5+
transform: {
6+
'^.+\\.tsx?$': 'ts-jest'
7+
}
8+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[cfn-auto-reloader-hook]
2+
triggers=post.update
3+
path=Resources.WebServerHost.Metadata.AWS::CloudFormation::Init
4+
action=/opt/aws/bin/cfn-init -v --stack __AWS_STACK_NAME__ --resource WebServerHost --region __AWS_REGION__
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[main]
2+
stack=__AWS_STACK_ID__
3+
region=__AWS_REGION__
4+
# The interval used to check for changes to the resource metadata in minutes. Default is 15
5+
interval=2
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Unit]
2+
Description=cfn-hup daemon
3+
[Service]
4+
Type=simple
5+
ExecStart=/usr/local/bin/cfn-hup
6+
Restart=always
7+
[Install]
8+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)