@composurecdk/neptune 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -0
- package/dist/commonjs/cluster-alarm-config.d.ts +77 -0
- package/dist/commonjs/cluster-alarm-config.d.ts.map +1 -0
- package/dist/commonjs/cluster-alarm-config.js +3 -0
- package/dist/commonjs/cluster-alarm-config.js.map +1 -0
- package/dist/commonjs/cluster-alarm-defaults.d.ts +20 -0
- package/dist/commonjs/cluster-alarm-defaults.d.ts.map +1 -0
- package/dist/commonjs/cluster-alarm-defaults.js +52 -0
- package/dist/commonjs/cluster-alarm-defaults.js.map +1 -0
- package/dist/commonjs/cluster-alarms.d.ts +25 -0
- package/dist/commonjs/cluster-alarms.d.ts.map +1 -0
- package/dist/commonjs/cluster-alarms.js +133 -0
- package/dist/commonjs/cluster-alarms.js.map +1 -0
- package/dist/commonjs/cluster-builder.d.ts +194 -0
- package/dist/commonjs/cluster-builder.d.ts.map +1 -0
- package/dist/commonjs/cluster-builder.js +140 -0
- package/dist/commonjs/cluster-builder.js.map +1 -0
- package/dist/commonjs/cluster-defaults.d.ts +19 -0
- package/dist/commonjs/cluster-defaults.d.ts.map +1 -0
- package/dist/commonjs/cluster-defaults.js +87 -0
- package/dist/commonjs/cluster-defaults.js.map +1 -0
- package/dist/commonjs/cluster-parameter-group-defaults.d.ts +30 -0
- package/dist/commonjs/cluster-parameter-group-defaults.d.ts.map +1 -0
- package/dist/commonjs/cluster-parameter-group-defaults.js +53 -0
- package/dist/commonjs/cluster-parameter-group-defaults.js.map +1 -0
- package/dist/commonjs/index.d.ts +6 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +13 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/esm/cluster-alarm-config.d.ts +77 -0
- package/dist/esm/cluster-alarm-config.d.ts.map +1 -0
- package/dist/esm/cluster-alarm-config.js +2 -0
- package/dist/esm/cluster-alarm-config.js.map +1 -0
- package/dist/esm/cluster-alarm-defaults.d.ts +20 -0
- package/dist/esm/cluster-alarm-defaults.d.ts.map +1 -0
- package/dist/esm/cluster-alarm-defaults.js +49 -0
- package/dist/esm/cluster-alarm-defaults.js.map +1 -0
- package/dist/esm/cluster-alarms.d.ts +25 -0
- package/dist/esm/cluster-alarms.d.ts.map +1 -0
- package/dist/esm/cluster-alarms.js +129 -0
- package/dist/esm/cluster-alarms.js.map +1 -0
- package/dist/esm/cluster-builder.d.ts +194 -0
- package/dist/esm/cluster-builder.d.ts.map +1 -0
- package/dist/esm/cluster-builder.js +137 -0
- package/dist/esm/cluster-builder.js.map +1 -0
- package/dist/esm/cluster-defaults.d.ts +19 -0
- package/dist/esm/cluster-defaults.d.ts.map +1 -0
- package/dist/esm/cluster-defaults.js +84 -0
- package/dist/esm/cluster-defaults.js.map +1 -0
- package/dist/esm/cluster-parameter-group-defaults.d.ts +30 -0
- package/dist/esm/cluster-parameter-group-defaults.d.ts.map +1 -0
- package/dist/esm/cluster-parameter-group-defaults.js +49 -0
- package/dist/esm/cluster-parameter-group-defaults.js.map +1 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/package.json +71 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { ClusterParameterGroup, DatabaseCluster, } from "@aws-cdk/aws-neptune-alpha";
|
|
2
|
+
import { COPY_STATE, resolve } from "@composurecdk/core";
|
|
3
|
+
import { taggedBuilder } from "@composurecdk/cloudformation";
|
|
4
|
+
import { AlarmDefinitionBuilder } from "@composurecdk/cloudwatch";
|
|
5
|
+
import { CLUSTER_DEFAULTS } from "./cluster-defaults.js";
|
|
6
|
+
import { CLUSTER_PARAMETER_GROUP_DEFAULTS, clusterParameterGroupFamily, } from "./cluster-parameter-group-defaults.js";
|
|
7
|
+
import { createClusterAlarms } from "./cluster-alarms.js";
|
|
8
|
+
class ClusterBuilder {
|
|
9
|
+
props = {};
|
|
10
|
+
#customAlarms = [];
|
|
11
|
+
#accessors = [];
|
|
12
|
+
#vpc;
|
|
13
|
+
/**
|
|
14
|
+
* Sets the VPC the cluster runs in. Required. Accepts a concrete
|
|
15
|
+
* {@link IVpc} or a {@link Ref} that resolves to one at build time — the
|
|
16
|
+
* standard cross-component wiring path (e.g. to a sibling `VpcBuilder`).
|
|
17
|
+
*
|
|
18
|
+
* @param vpc - The VPC or a Ref to one.
|
|
19
|
+
* @returns This builder for chaining.
|
|
20
|
+
*/
|
|
21
|
+
vpc(vpc) {
|
|
22
|
+
this.#vpc = vpc;
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Grants a principal both network and IAM access to the cluster in a single
|
|
27
|
+
* declaration. At build time this applies
|
|
28
|
+
* `cluster.connections.allowDefaultPortFrom(peer)` (opening the cluster's
|
|
29
|
+
* port to the peer's security group) and `cluster.grantConnect(peer)`
|
|
30
|
+
* (granting the IAM `connect` action required by the cluster's
|
|
31
|
+
* IAM-authentication default).
|
|
32
|
+
*
|
|
33
|
+
* Accepts a concrete {@link ClusterAccessor} or a {@link Ref} to one, so the
|
|
34
|
+
* grant can be declared inside `compose()` rather than wired up in an
|
|
35
|
+
* `afterBuild` hook.
|
|
36
|
+
*
|
|
37
|
+
* @param peer - The principal to grant access to, or a Ref to one.
|
|
38
|
+
* @returns This builder for chaining.
|
|
39
|
+
*/
|
|
40
|
+
allowAccessFrom(peer) {
|
|
41
|
+
this.#accessors.push(peer);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Adds a custom CloudWatch alarm to be created alongside the recommended
|
|
46
|
+
* alarms. The callback receives an {@link AlarmDefinitionBuilder} scoped to
|
|
47
|
+
* the built cluster; configure it fluently and return it.
|
|
48
|
+
*
|
|
49
|
+
* @param key - A unique key for the alarm (used to generate the alarm id).
|
|
50
|
+
* @param configure - Callback that configures the alarm definition.
|
|
51
|
+
* @returns This builder for chaining.
|
|
52
|
+
*/
|
|
53
|
+
addAlarm(key, configure) {
|
|
54
|
+
this.#customAlarms.push(configure(new AlarmDefinitionBuilder(key)));
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
/** @internal — see ADR-0005. */
|
|
58
|
+
[COPY_STATE](target) {
|
|
59
|
+
target.#vpc = this.#vpc;
|
|
60
|
+
target.#customAlarms.push(...this.#customAlarms);
|
|
61
|
+
target.#accessors.push(...this.#accessors);
|
|
62
|
+
}
|
|
63
|
+
build(scope, id, context) {
|
|
64
|
+
const resolvedVpc = this.#vpc ? resolve(this.#vpc, context) : undefined;
|
|
65
|
+
if (!resolvedVpc) {
|
|
66
|
+
throw new Error(`ClusterBuilder "${id}" requires a VPC. Call .vpc() with an IVpc or a Ref to one.`);
|
|
67
|
+
}
|
|
68
|
+
const { recommendedAlarms: alarmConfig, securityGroups: resolvableSgs, clusterParameters, clusterParameterGroup: userParameterGroup, ...clusterProps } = this.props;
|
|
69
|
+
if (clusterProps.instanceType === undefined) {
|
|
70
|
+
throw new Error(`ClusterBuilder "${id}" requires an instance type. Call .instanceType() with a ` +
|
|
71
|
+
`provisioned class (e.g. InstanceType.R6G_LARGE) or InstanceType.SERVERLESS ` +
|
|
72
|
+
`paired with .serverlessScalingConfiguration().`);
|
|
73
|
+
}
|
|
74
|
+
if (userParameterGroup !== undefined && clusterParameters !== undefined) {
|
|
75
|
+
throw new Error(`ClusterBuilder "${id}": .clusterParameters() cannot be combined with a ` +
|
|
76
|
+
`user-managed .clusterParameterGroup() — the supplied group is not mutated by ` +
|
|
77
|
+
`this builder. Set the parameters on your own group instead.`);
|
|
78
|
+
}
|
|
79
|
+
const clusterParameterGroup = userParameterGroup ??
|
|
80
|
+
new ClusterParameterGroup(scope, `${id}ParameterGroup`, {
|
|
81
|
+
family: clusterParameterGroupFamily(clusterProps.engineVersion),
|
|
82
|
+
parameters: { ...CLUSTER_PARAMETER_GROUP_DEFAULTS, ...clusterParameters },
|
|
83
|
+
});
|
|
84
|
+
const securityGroups = resolvableSgs?.map((sg) => resolve(sg, context));
|
|
85
|
+
const mergedProps = {
|
|
86
|
+
...CLUSTER_DEFAULTS,
|
|
87
|
+
...clusterProps,
|
|
88
|
+
vpc: resolvedVpc,
|
|
89
|
+
clusterParameterGroup,
|
|
90
|
+
...(securityGroups ? { securityGroups } : {}),
|
|
91
|
+
};
|
|
92
|
+
const cluster = new DatabaseCluster(scope, id, mergedProps);
|
|
93
|
+
for (const resolvable of this.#accessors) {
|
|
94
|
+
const peer = resolve(resolvable, context);
|
|
95
|
+
cluster.connections.allowDefaultPortFrom(peer);
|
|
96
|
+
// The IAM `connect` grant is only meaningful when IAM authentication is
|
|
97
|
+
// enabled (the default). If a user has turned it off, opening the
|
|
98
|
+
// network path is the whole grant — a grantConnect policy would be inert.
|
|
99
|
+
if (mergedProps.iamAuthentication !== false) {
|
|
100
|
+
cluster.grantConnect(peer);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const alarms = createClusterAlarms(scope, id, cluster, alarmConfig, mergedProps.serverlessScalingConfiguration, this.#customAlarms);
|
|
104
|
+
return { cluster, subnetGroup: cluster.subnetGroup, clusterParameterGroup, alarms };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Creates a new {@link IClusterBuilder} for configuring an Amazon Neptune
|
|
109
|
+
* cluster.
|
|
110
|
+
*
|
|
111
|
+
* This is the entry point for defining a Neptune component. The returned
|
|
112
|
+
* builder exposes every {@link ClusterBuilderProps} property as a fluent
|
|
113
|
+
* setter/getter, plus {@link IClusterBuilder.vpc | .vpc()} and
|
|
114
|
+
* {@link IClusterBuilder.allowAccessFrom | .allowAccessFrom()} for
|
|
115
|
+
* cross-component wiring with Ref support. It implements {@link Lifecycle}
|
|
116
|
+
* for use with {@link compose}.
|
|
117
|
+
*
|
|
118
|
+
* @returns A fluent builder for an Amazon Neptune cluster.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* const system = compose(
|
|
123
|
+
* {
|
|
124
|
+
* network: createVpcBuilder().maxAzs(2),
|
|
125
|
+
* graph: createClusterBuilder()
|
|
126
|
+
* .vpc(ref<VpcBuilderResult>("network").get("vpc"))
|
|
127
|
+
* .instanceType(InstanceType.SERVERLESS)
|
|
128
|
+
* .serverlessScalingConfiguration({ minCapacity: 1, maxCapacity: 8 }),
|
|
129
|
+
* },
|
|
130
|
+
* { network: [], graph: ["network"] },
|
|
131
|
+
* );
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
export function createClusterBuilder() {
|
|
135
|
+
return taggedBuilder(ClusterBuilder);
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=cluster-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-builder.js","sourceRoot":"","sources":["../../src/cluster-builder.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,qBAAqB,EACrB,eAAe,GAKhB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAkB,OAAO,EAAmB,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAuB,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA4H1D,MAAM,cAAc;IAClB,KAAK,GAAiC,EAAE,CAAC;IAChC,aAAa,GAA+C,EAAE,CAAC;IAC/D,UAAU,GAAkC,EAAE,CAAC;IACxD,IAAI,CAAoB;IAExB;;;;;;;OAOG;IACH,GAAG,CAAC,GAAqB;QACvB,IAAI,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CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,mBAAmB,CAChC,KAAK,EACL,EAAE,EACF,OAAO,EACP,WAAW,EACX,WAAW,CAAC,8BAA8B,EAC1C,IAAI,CAAC,aAAa,CACnB,CAAC;QAEF,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC;IACtF,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,aAAa,CAAsC,cAAc,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type DatabaseClusterProps } from "@aws-cdk/aws-neptune-alpha";
|
|
2
|
+
/**
|
|
3
|
+
* Secure, AWS-recommended defaults applied to every Neptune cluster built
|
|
4
|
+
* with {@link createClusterBuilder}. Each property can be individually
|
|
5
|
+
* overridden via the builder's fluent API.
|
|
6
|
+
*
|
|
7
|
+
* Every default is anchored first to the AWS Well-Architected Framework
|
|
8
|
+
* (the _why_) and then to the Neptune User Guide (the _how_), matching the
|
|
9
|
+
* citation convention used across the other builder packages.
|
|
10
|
+
*
|
|
11
|
+
* Notably absent: `instanceType`. Defaulting an instance type would create
|
|
12
|
+
* surprise cost, so the builder requires the caller to pick one explicitly
|
|
13
|
+
* (a provisioned class such as `InstanceType.R6G_LARGE`, or
|
|
14
|
+
* `InstanceType.SERVERLESS` paired with `serverlessScalingConfiguration`).
|
|
15
|
+
*
|
|
16
|
+
* @see https://docs.aws.amazon.com/prescriptive-guidance/latest/neptune-well-architected-framework/introduction.html
|
|
17
|
+
*/
|
|
18
|
+
export declare const CLUSTER_DEFAULTS: Partial<DatabaseClusterProps>;
|
|
19
|
+
//# sourceMappingURL=cluster-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-defaults.d.ts","sourceRoot":"","sources":["../../src/cluster-defaults.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEhF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,CAAC,oBAAoB,CAuE1D,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { RemovalPolicy, Duration } from "aws-cdk-lib";
|
|
2
|
+
import { RetentionDays } from "aws-cdk-lib/aws-logs";
|
|
3
|
+
import { LogType } from "@aws-cdk/aws-neptune-alpha";
|
|
4
|
+
/**
|
|
5
|
+
* Secure, AWS-recommended defaults applied to every Neptune cluster built
|
|
6
|
+
* with {@link createClusterBuilder}. Each property can be individually
|
|
7
|
+
* overridden via the builder's fluent API.
|
|
8
|
+
*
|
|
9
|
+
* Every default is anchored first to the AWS Well-Architected Framework
|
|
10
|
+
* (the _why_) and then to the Neptune User Guide (the _how_), matching the
|
|
11
|
+
* citation convention used across the other builder packages.
|
|
12
|
+
*
|
|
13
|
+
* Notably absent: `instanceType`. Defaulting an instance type would create
|
|
14
|
+
* surprise cost, so the builder requires the caller to pick one explicitly
|
|
15
|
+
* (a provisioned class such as `InstanceType.R6G_LARGE`, or
|
|
16
|
+
* `InstanceType.SERVERLESS` paired with `serverlessScalingConfiguration`).
|
|
17
|
+
*
|
|
18
|
+
* @see https://docs.aws.amazon.com/prescriptive-guidance/latest/neptune-well-architected-framework/introduction.html
|
|
19
|
+
*/
|
|
20
|
+
export const CLUSTER_DEFAULTS = {
|
|
21
|
+
/**
|
|
22
|
+
* Encrypt the cluster volume at rest. Uses the AWS-managed Neptune key
|
|
23
|
+
* unless a customer-managed key is supplied via `.kmsKey()`.
|
|
24
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_protect_data_rest_encrypt.html
|
|
25
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/encrypt.html
|
|
26
|
+
*/
|
|
27
|
+
storageEncrypted: true,
|
|
28
|
+
/**
|
|
29
|
+
* Require IAM authentication for data-plane connections, removing the
|
|
30
|
+
* need for long-lived static credentials. Pair with `.allowAccessFrom()`
|
|
31
|
+
* (or `cluster.grantConnect()`) to authorise principals.
|
|
32
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/framework/sec-03.html
|
|
33
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/iam-auth.html
|
|
34
|
+
*/
|
|
35
|
+
iamAuthentication: true,
|
|
36
|
+
/**
|
|
37
|
+
* Retain the cluster on stack deletion/replacement so graph data is not
|
|
38
|
+
* destroyed by an errant `cdk destroy`. Ephemeral/dev stacks override to
|
|
39
|
+
* `RemovalPolicy.DESTROY`.
|
|
40
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/rel_backing_up_data_identified_backups_data.html
|
|
41
|
+
*/
|
|
42
|
+
removalPolicy: RemovalPolicy.RETAIN,
|
|
43
|
+
/**
|
|
44
|
+
* Block accidental deletion of the cluster itself. The CDK L2 would infer
|
|
45
|
+
* this from `RemovalPolicy.RETAIN`; setting it explicitly keeps the
|
|
46
|
+
* security posture auditable rather than implicit.
|
|
47
|
+
* @see https://docs.aws.amazon.com/securityhub/latest/userguide/neptune-controls.html
|
|
48
|
+
*/
|
|
49
|
+
deletionProtection: true,
|
|
50
|
+
/**
|
|
51
|
+
* Retain automated backups for 7 days. The CDK default is 1 day; AWS
|
|
52
|
+
* Well-Architected recommends a longer window for production data.
|
|
53
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/rel_backing_up_data_automated_backups_data.html
|
|
54
|
+
*/
|
|
55
|
+
backupRetention: Duration.days(7),
|
|
56
|
+
/**
|
|
57
|
+
* Export audit logs to CloudWatch Logs. Audit logging is the only log
|
|
58
|
+
* type Neptune exports to CloudWatch, and it only emits once
|
|
59
|
+
* `neptune_enable_audit_log` is set on the cluster parameter group — which
|
|
60
|
+
* the builder's auto-created parameter group does by default.
|
|
61
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_detect_investigate_events_app_service_logging.html
|
|
62
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/auditing.html
|
|
63
|
+
*/
|
|
64
|
+
cloudwatchLogsExports: [LogType.AUDIT],
|
|
65
|
+
/**
|
|
66
|
+
* Expire exported audit logs after one month, matching the
|
|
67
|
+
* `@composurecdk/logs` retention default rather than keeping them forever.
|
|
68
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/framework/cost-05.html
|
|
69
|
+
*/
|
|
70
|
+
cloudwatchLogsRetention: RetentionDays.ONE_MONTH,
|
|
71
|
+
/**
|
|
72
|
+
* Copy cluster tags onto automated snapshots so cost-allocation and
|
|
73
|
+
* ownership tags survive into backups.
|
|
74
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/framework/ops-04.html
|
|
75
|
+
*/
|
|
76
|
+
copyTagsToSnapshot: true,
|
|
77
|
+
/**
|
|
78
|
+
* Apply patched minor engine versions automatically during the
|
|
79
|
+
* maintenance window.
|
|
80
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_protect_compute_validate_software_integrity.html
|
|
81
|
+
*/
|
|
82
|
+
autoMinorVersionUpgrade: true,
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=cluster-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-defaults.js","sourceRoot":"","sources":["../../src/cluster-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,OAAO,EAA6B,MAAM,4BAA4B,CAAC;AAEhF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkC;IAC7D;;;;;OAKG;IACH,gBAAgB,EAAE,IAAI;IAEtB;;;;;;OAMG;IACH,iBAAiB,EAAE,IAAI;IAEvB;;;;;OAKG;IACH,aAAa,EAAE,aAAa,CAAC,MAAM;IAEnC;;;;;OAKG;IACH,kBAAkB,EAAE,IAAI;IAExB;;;;OAIG;IACH,eAAe,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,qBAAqB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAEtC;;;;OAIG;IACH,uBAAuB,EAAE,aAAa,CAAC,SAAS;IAEhD;;;;OAIG;IACH,kBAAkB,EAAE,IAAI;IAExB;;;;OAIG;IACH,uBAAuB,EAAE,IAAI;CAC9B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EngineVersion, ParameterGroupFamily } from "@aws-cdk/aws-neptune-alpha";
|
|
2
|
+
/**
|
|
3
|
+
* Default parameters applied to the cluster parameter group the builder
|
|
4
|
+
* auto-creates when the caller does not supply their own. These change
|
|
5
|
+
* engine behaviour (not just observability), so each is documented and
|
|
6
|
+
* individually overridable via `.clusterParameters({...})`.
|
|
7
|
+
*
|
|
8
|
+
* `neptune_enable_audit_log` is what actually turns audit logging on inside
|
|
9
|
+
* the engine — without it, the `cloudwatchLogsExports: [AUDIT]` cluster
|
|
10
|
+
* default creates an empty log stream. The two defaults are deliberately
|
|
11
|
+
* paired so audit logging works end-to-end out of the box.
|
|
12
|
+
*
|
|
13
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_detect_investigate_events_app_service_logging.html
|
|
14
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/auditing.html#auditing-enable
|
|
15
|
+
*/
|
|
16
|
+
export declare const CLUSTER_PARAMETER_GROUP_DEFAULTS: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Derives the cluster parameter group family from a Neptune engine version.
|
|
19
|
+
*
|
|
20
|
+
* A cluster parameter group must declare a family compatible with the
|
|
21
|
+
* cluster's engine version, or the deploy fails. Rather than make the caller
|
|
22
|
+
* keep the two in sync by hand, the builder derives the family from the
|
|
23
|
+
* `engineVersion` (when set) so the auto-created parameter group is always
|
|
24
|
+
* compatible. When no engine version is pinned, Neptune uses a current
|
|
25
|
+
* 1.4.x engine, so the family defaults to {@link ParameterGroupFamily.NEPTUNE_1_4}.
|
|
26
|
+
*
|
|
27
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/parameters.html
|
|
28
|
+
*/
|
|
29
|
+
export declare function clusterParameterGroupFamily(engineVersion?: EngineVersion): ParameterGroupFamily;
|
|
30
|
+
//# sourceMappingURL=cluster-parameter-group-defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-parameter-group-defaults.d.ts","sourceRoot":"","sources":["../../src/cluster-parameter-group-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEjF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGnE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,oBAAoB,CAgB/F"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ParameterGroupFamily } from "@aws-cdk/aws-neptune-alpha";
|
|
2
|
+
/**
|
|
3
|
+
* Default parameters applied to the cluster parameter group the builder
|
|
4
|
+
* auto-creates when the caller does not supply their own. These change
|
|
5
|
+
* engine behaviour (not just observability), so each is documented and
|
|
6
|
+
* individually overridable via `.clusterParameters({...})`.
|
|
7
|
+
*
|
|
8
|
+
* `neptune_enable_audit_log` is what actually turns audit logging on inside
|
|
9
|
+
* the engine — without it, the `cloudwatchLogsExports: [AUDIT]` cluster
|
|
10
|
+
* default creates an empty log stream. The two defaults are deliberately
|
|
11
|
+
* paired so audit logging works end-to-end out of the box.
|
|
12
|
+
*
|
|
13
|
+
* @see https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/sec_detect_investigate_events_app_service_logging.html
|
|
14
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/auditing.html#auditing-enable
|
|
15
|
+
*/
|
|
16
|
+
export const CLUSTER_PARAMETER_GROUP_DEFAULTS = {
|
|
17
|
+
/** Enable engine audit logging so the audit log export carries data. */
|
|
18
|
+
neptune_enable_audit_log: "1",
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Derives the cluster parameter group family from a Neptune engine version.
|
|
22
|
+
*
|
|
23
|
+
* A cluster parameter group must declare a family compatible with the
|
|
24
|
+
* cluster's engine version, or the deploy fails. Rather than make the caller
|
|
25
|
+
* keep the two in sync by hand, the builder derives the family from the
|
|
26
|
+
* `engineVersion` (when set) so the auto-created parameter group is always
|
|
27
|
+
* compatible. When no engine version is pinned, Neptune uses a current
|
|
28
|
+
* 1.4.x engine, so the family defaults to {@link ParameterGroupFamily.NEPTUNE_1_4}.
|
|
29
|
+
*
|
|
30
|
+
* @see https://docs.aws.amazon.com/neptune/latest/userguide/parameters.html
|
|
31
|
+
*/
|
|
32
|
+
export function clusterParameterGroupFamily(engineVersion) {
|
|
33
|
+
// version strings are "major.minor.patch.build", e.g. "1.4.5.1".
|
|
34
|
+
const [major, minor] = (engineVersion?.version ?? "1.4").split(".");
|
|
35
|
+
const majorMinor = `${major}.${minor}`;
|
|
36
|
+
switch (majorMinor) {
|
|
37
|
+
case "1.0":
|
|
38
|
+
case "1.1":
|
|
39
|
+
return ParameterGroupFamily.NEPTUNE_1;
|
|
40
|
+
case "1.2":
|
|
41
|
+
return ParameterGroupFamily.NEPTUNE_1_2;
|
|
42
|
+
case "1.3":
|
|
43
|
+
return ParameterGroupFamily.NEPTUNE_1_3;
|
|
44
|
+
default:
|
|
45
|
+
// 1.4 and anything newer the builder has not been taught about yet.
|
|
46
|
+
return ParameterGroupFamily.NEPTUNE_1_4;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=cluster-parameter-group-defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-parameter-group-defaults.js","sourceRoot":"","sources":["../../src/cluster-parameter-group-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEjF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAA2B;IACtE,wEAAwE;IACxE,wBAAwB,EAAE,GAAG;CAC9B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,2BAA2B,CAAC,aAA6B;IACvE,iEAAiE;IACjE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpE,MAAM,UAAU,GAAG,GAAG,KAAK,IAAI,KAAK,EAAE,CAAC;IACvC,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,OAAO,oBAAoB,CAAC,SAAS,CAAC;QACxC,KAAK,KAAK;YACR,OAAO,oBAAoB,CAAC,WAAW,CAAC;QAC1C,KAAK,KAAK;YACR,OAAO,oBAAoB,CAAC,WAAW,CAAC;QAC1C;YACE,oEAAoE;YACpE,OAAO,oBAAoB,CAAC,WAAW,CAAC;IAC5C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createClusterBuilder, type ClusterAccessor, type ClusterBuilderProps, type ClusterBuilderResult, type IClusterBuilder, } from "./cluster-builder.js";
|
|
2
|
+
export { CLUSTER_DEFAULTS } from "./cluster-defaults.js";
|
|
3
|
+
export { CLUSTER_PARAMETER_GROUP_DEFAULTS, clusterParameterGroupFamily, } from "./cluster-parameter-group-defaults.js";
|
|
4
|
+
export { type NeptuneClusterAlarmConfig } from "./cluster-alarm-config.js";
|
|
5
|
+
export { CLUSTER_ALARM_DEFAULTS } from "./cluster-alarm-defaults.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createClusterBuilder, } from "./cluster-builder.js";
|
|
2
|
+
export { CLUSTER_DEFAULTS } from "./cluster-defaults.js";
|
|
3
|
+
export { CLUSTER_PARAMETER_GROUP_DEFAULTS, clusterParameterGroupFamily, } from "./cluster-parameter-group-defaults.js";
|
|
4
|
+
export { CLUSTER_ALARM_DEFAULTS } from "./cluster-alarm-defaults.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAKrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@composurecdk/neptune",
|
|
3
|
+
"version": "0.8.3",
|
|
4
|
+
"description": "Composable Amazon Neptune cluster builder with well-architected defaults",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/laazyj/composureCDK",
|
|
8
|
+
"directory": "packages/neptune"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"clean": "rm -rf dist .tshy .tshy-build",
|
|
17
|
+
"build": "tshy",
|
|
18
|
+
"typecheck": "tsc --noEmit",
|
|
19
|
+
"check:exports": "attw --pack . --profile node16 && publint",
|
|
20
|
+
"test": "vitest run --passWithNoTests",
|
|
21
|
+
"test:watch": "vitest"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [],
|
|
24
|
+
"author": "Jason Duffett (https://github.com/laazyj)",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"type": "module",
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=20"
|
|
32
|
+
},
|
|
33
|
+
"tshy": {
|
|
34
|
+
"exports": {
|
|
35
|
+
"./package.json": "./package.json",
|
|
36
|
+
".": "./src/index.ts"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@aws-cdk/aws-neptune-alpha": "^2.257.0-alpha.0",
|
|
41
|
+
"@composurecdk/cloudformation": "^0.8.0",
|
|
42
|
+
"@composurecdk/cloudwatch": "^0.8.0",
|
|
43
|
+
"@composurecdk/core": "^0.8.0",
|
|
44
|
+
"aws-cdk-lib": "^2.257.0",
|
|
45
|
+
"constructs": "^10.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@aws-cdk/aws-neptune-alpha": "2.257.0-alpha.0",
|
|
49
|
+
"@types/node": "^25.9.1",
|
|
50
|
+
"aws-cdk-lib": "^2.257.0",
|
|
51
|
+
"constructs": "^10.6.0",
|
|
52
|
+
"typescript": "^6.0.3",
|
|
53
|
+
"vitest": "^4.1.7"
|
|
54
|
+
},
|
|
55
|
+
"exports": {
|
|
56
|
+
"./package.json": "./package.json",
|
|
57
|
+
".": {
|
|
58
|
+
"import": {
|
|
59
|
+
"types": "./dist/esm/index.d.ts",
|
|
60
|
+
"default": "./dist/esm/index.js"
|
|
61
|
+
},
|
|
62
|
+
"require": {
|
|
63
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
64
|
+
"default": "./dist/commonjs/index.js"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"main": "./dist/commonjs/index.js",
|
|
69
|
+
"types": "./dist/commonjs/index.d.ts",
|
|
70
|
+
"module": "./dist/esm/index.js"
|
|
71
|
+
}
|