Skip to content

Commit 8976aeb

Browse files
authored
Merge pull request #65 from aws-samples/base
Base
2 parents 289d558 + 69c8344 commit 8976aeb

40 files changed

+2750
-2
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ repos:
1111
- id: detect-aws-credentials
1212
args: ['--allow-missing-credentials']
1313
- id: forbid-submodules
14+
- repo: https://github.com/iamthefij/docker-pre-commit
15+
rev: master
16+
hooks:
17+
- id: docker-compose-check

lib/base/.gitignore

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

lib/base/.npmignore

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

lib/base/README.md

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

lib/base/app.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env node
2+
import 'dotenv/config'
3+
import 'source-map-support/register';
4+
import * as cdk from 'aws-cdk-lib';
5+
import * as nag from "cdk-nag";
6+
import * as config from "./lib/config/baseConfig";
7+
import {BaseCommonStack} from "./lib/common-stack";
8+
import {BaseSingleNodeStack} from "./lib/single-node-stack";
9+
import {BaseHANodesStack} from "./lib/ha-nodes-stack";
10+
11+
const app = new cdk.App();
12+
cdk.Tags.of(app).add("Project", "AWSBase");
13+
14+
new BaseCommonStack(app, "base-common", {
15+
stackName: `base-nodes-common`,
16+
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
17+
});
18+
19+
new BaseSingleNodeStack(app, "base-single-node", {
20+
stackName: `base-single-node-${config.baseNodeConfig.baseNodeConfiguration}-${config.baseNodeConfig.baseNetworkId}`,
21+
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
22+
23+
instanceType: config.baseNodeConfig.instanceType,
24+
instanceCpuType: config.baseNodeConfig.instanceCpuType,
25+
baseNetworkId: config.baseNodeConfig.baseNetworkId,
26+
baseNodeConfiguration: config.baseNodeConfig.baseNodeConfiguration,
27+
restoreFromSnapshot: config.baseNodeConfig.restoreFromSnapshot,
28+
l1ExecutionEndpoint: config.baseNodeConfig.l1ExecutionEndpoint,
29+
l1ConsensusEndpoint: config.baseNodeConfig.l1ConsensusEndpoint,
30+
snapshotUrl: config.baseNodeConfig.snapshotUrl,
31+
dataVolume: config.baseNodeConfig.dataVolume,
32+
});
33+
34+
new BaseHANodesStack(app, "base-ha-nodes", {
35+
stackName: `base-ha-nodes-${config.baseNodeConfig.baseNodeConfiguration}-${config.baseNodeConfig.baseNetworkId}`,
36+
env: { account: config.baseConfig.accountId, region: config.baseConfig.region },
37+
38+
instanceType: config.baseNodeConfig.instanceType,
39+
instanceCpuType: config.baseNodeConfig.instanceCpuType,
40+
baseNetworkId: config.baseNodeConfig.baseNetworkId,
41+
baseNodeConfiguration: config.baseNodeConfig.baseNodeConfiguration,
42+
restoreFromSnapshot: config.baseNodeConfig.restoreFromSnapshot,
43+
l1ExecutionEndpoint: config.baseNodeConfig.l1ExecutionEndpoint,
44+
l1ConsensusEndpoint: config.baseNodeConfig.l1ConsensusEndpoint,
45+
snapshotUrl: config.baseNodeConfig.snapshotUrl,
46+
dataVolume: config.baseNodeConfig.dataVolume,
47+
48+
albHealthCheckGracePeriodMin: config.haNodeConfig.albHealthCheckGracePeriodMin,
49+
heartBeatDelayMin: config.haNodeConfig.heartBeatDelayMin,
50+
numberOfNodes: config.haNodeConfig.numberOfNodes
51+
});
52+
53+
// Security Check
54+
cdk.Aspects.of(app).add(
55+
new nag.AwsSolutionsChecks({
56+
verbose: false,
57+
reports: true,
58+
logIgnores: false,
59+
})
60+
);

lib/base/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+
}
148 KB
Loading
66.1 KB
Loading

0 commit comments

Comments
 (0)