Skip to content

Commit 3e7da62

Browse files
authored
Merge pull request #60 from aws-samples/bsc
Bsc
2 parents 026c9b9 + 0d1128e commit 3e7da62

37 files changed

+2399
-10
lines changed

docs/pre-merge-tools.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ npm run install-pre-commit-mac
4141
# Run
4242
npm run run-pre-commit
4343
```
44+
45+
4. Optionally, run [shellcheck](https://github.com/koalaman/shellcheck) to check for common problems in your shell scripts.

lib/bsc/.gitignore

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

lib/bsc/README.md

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

lib/bsc/app.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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/bscConfig";
5+
import * as configTypes from "./lib/config/bscConfig.interface";
6+
import { BscCommonStack } from "./lib/common-stack";
7+
import { BscSingleNodeStack } from "./lib/single-node-stack";
8+
import { BscHANodesStack } from "./lib/ha-nodes-stack";
9+
import * as nag from "cdk-nag";
10+
11+
const app = new cdk.App();
12+
cdk.Tags.of(app).add("Project", "AWS_BSC");
13+
14+
new BscCommonStack(app, "bsc-common", {
15+
stackName: `bsc-nodes-common`,
16+
env: { account: config.baseConfig.accountId, region: config.baseConfig.region }
17+
});
18+
19+
new BscSingleNodeStack(app, "bsc-single-node", {
20+
stackName: `bsc-single-node-${config.baseNodeConfig.nodeConfiguration}-${config.baseNodeConfig.bscNetwork}`,
21+
22+
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
23+
nodeRole: <configTypes.BscNodeRole> "single-node",
24+
instanceType: config.baseNodeConfig.instanceType,
25+
instanceCpuType: config.baseNodeConfig.instanceCpuType,
26+
bscNetwork: config.baseNodeConfig.bscNetwork,
27+
nodeConfiguration: config.baseNodeConfig.nodeConfiguration,
28+
snapshotsUrl:config.baseNodeConfig.snapshotsUrl,
29+
dataVolume: config.baseNodeConfig.dataVolume,
30+
});
31+
32+
new BscHANodesStack(app, "bsc-ha-nodes", {
33+
stackName: `bsc-ha-nodes-${config.baseNodeConfig.nodeConfiguration}-${config.baseNodeConfig.bscNetwork}`,
34+
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
35+
nodeRole: <configTypes.BscNodeRole> "rpc-node",
36+
instanceType: config.baseNodeConfig.instanceType,
37+
instanceCpuType: config.baseNodeConfig.instanceCpuType,
38+
bscNetwork: config.baseNodeConfig.bscNetwork,
39+
nodeConfiguration: config.baseNodeConfig.nodeConfiguration,
40+
snapshotsUrl:config.baseNodeConfig.snapshotsUrl,
41+
dataVolume: config.baseNodeConfig.dataVolume,
42+
43+
albHealthCheckGracePeriodMin: config.haNodeConfig.albHealthCheckGracePeriodMin,
44+
heartBeatDelayMin: config.haNodeConfig.heartBeatDelayMin,
45+
numberOfNodes: config.haNodeConfig.numberOfNodes
46+
});
47+
48+
// Security Check
49+
cdk.Aspects.of(app).add(
50+
new nag.AwsSolutionsChecks({
51+
verbose: false,
52+
reports: true,
53+
logIgnores: false
54+
})
55+
);

lib/bsc/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+
}

0 commit comments

Comments
 (0)