@fjall/components-infrastructure 0.96.0 → 0.99.1
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/dist/lib/app.d.ts +68 -1
- package/dist/lib/app.js +113 -4
- package/dist/lib/config/aws/__t17fixture.d.ts +1 -0
- package/dist/lib/config/aws/__t17fixture.js +3 -0
- package/dist/lib/config/aws/__t17fixtureType.d.ts +2 -0
- package/dist/lib/config/aws/__t17fixtureType.js +1 -0
- package/dist/lib/config/aws/alarmTopic.js +8 -4
- package/dist/lib/config/aws/cloudTrail.js +1 -1
- package/dist/lib/config/aws/disasterRecovery.js +11 -16
- package/dist/lib/config/aws/ecrDefaultImage.d.ts +0 -1
- package/dist/lib/config/aws/ecrDefaultImage.js +13 -23
- package/dist/lib/config/aws/identityCenter.d.ts +10 -3
- package/dist/lib/config/aws/identityCenter.js +101 -37
- package/dist/lib/config/aws/identityCenterGroupMembership.js +8 -2
- package/dist/lib/config/aws/identityCenterMembership.d.ts +11 -0
- package/dist/lib/config/aws/identityCenterMembership.js +61 -0
- package/dist/lib/config/aws/index.d.ts +1 -1
- package/dist/lib/config/aws/index.js +1 -1
- package/dist/lib/config/aws/ipam.js +6 -11
- package/dist/lib/config/aws/oidcConnector.js +5 -1
- package/dist/lib/config/aws/scpPreset.js +4 -1
- package/dist/lib/patterns/aws/_eslint_test_tmp/leak.d.ts +1 -0
- package/dist/lib/patterns/aws/_eslint_test_tmp/leak.js +4 -0
- package/dist/lib/patterns/aws/account.js +2 -4
- package/dist/lib/patterns/aws/apexDomainPattern.js +10 -10
- package/dist/lib/patterns/aws/bastionFactory.d.ts +10 -0
- package/dist/lib/patterns/aws/bastionFactory.js +29 -0
- package/dist/lib/patterns/aws/buildkite.d.ts +2 -2
- package/dist/lib/patterns/aws/buildkite.js +51 -97
- package/dist/lib/patterns/aws/cdn.js +1 -1
- package/dist/lib/patterns/aws/clickhouseDatabase.d.ts +172 -0
- package/dist/lib/patterns/aws/clickhouseDatabase.js +600 -0
- package/dist/lib/patterns/aws/compute.d.ts +4 -6
- package/dist/lib/patterns/aws/compute.js +7 -13
- package/dist/lib/patterns/aws/computeEcs.d.ts +93 -5
- package/dist/lib/patterns/aws/computeEcs.js +867 -37
- package/dist/lib/patterns/aws/computeEcsTypes.d.ts +528 -25
- package/dist/lib/patterns/aws/computeEcsTypes.js +10 -0
- package/dist/lib/patterns/aws/computeLambda.d.ts +0 -5
- package/dist/lib/patterns/aws/computeLambda.js +1 -2
- package/dist/lib/patterns/aws/database.d.ts +50 -8
- package/dist/lib/patterns/aws/database.js +183 -27
- package/dist/lib/patterns/aws/domain.js +6 -4
- package/dist/lib/patterns/aws/index.d.ts +1 -0
- package/dist/lib/patterns/aws/index.js +1 -0
- package/dist/lib/patterns/aws/interfaces/compute.d.ts +7 -1
- package/dist/lib/patterns/aws/interfaces/database.d.ts +187 -8
- package/dist/lib/patterns/aws/interfaces/database.js +17 -3
- package/dist/lib/patterns/aws/interfaces/index.d.ts +2 -1
- package/dist/lib/patterns/aws/interfaces/index.js +3 -1
- package/dist/lib/patterns/aws/interfaces/messaging.d.ts +7 -0
- package/dist/lib/patterns/aws/interfaces/migrationContributor.d.ts +47 -0
- package/dist/lib/patterns/aws/interfaces/migrationContributor.js +9 -0
- package/dist/lib/patterns/aws/messaging.d.ts +66 -10
- package/dist/lib/patterns/aws/messaging.js +115 -20
- package/dist/lib/patterns/aws/network.js +16 -7
- package/dist/lib/patterns/aws/organisation.d.ts +4 -0
- package/dist/lib/patterns/aws/organisation.js +22 -4
- package/dist/lib/patterns/aws/storage.d.ts +1 -2
- package/dist/lib/patterns/aws/storage.js +3 -2
- package/dist/lib/patterns/aws/vpcPeer.js +3 -1
- package/dist/lib/resources/aws/analytics/clickhouse.js +18 -9
- package/dist/lib/resources/aws/analytics/clickhouseAlarms.d.ts +24 -9
- package/dist/lib/resources/aws/analytics/clickhouseAlarms.js +61 -10
- package/dist/lib/resources/aws/analytics/clickhouseConstants.d.ts +3 -3
- package/dist/lib/resources/aws/analytics/clickhouseConstants.js +3 -3
- package/dist/lib/resources/aws/analytics/clickhouseTypes.d.ts +7 -1
- package/dist/lib/resources/aws/analytics/clickhouseUserData.d.ts +1 -1
- package/dist/lib/resources/aws/analytics/clickhouseUserData.js +53 -3
- package/dist/lib/resources/aws/base/awsStack.js +4 -2
- package/dist/lib/resources/aws/compute/__tmp__/regression-shape.d.ts +2 -0
- package/dist/lib/resources/aws/compute/__tmp__/regression-shape.js +11 -0
- package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.d.ts +52 -0
- package/dist/lib/resources/aws/compute/asgInlineLifecycleHook.js +60 -0
- package/dist/lib/resources/aws/compute/blockDeviceVolume.d.ts +8 -0
- package/dist/lib/resources/aws/compute/blockDeviceVolume.js +10 -0
- package/dist/lib/resources/aws/compute/ec2.d.ts +132 -12
- package/dist/lib/resources/aws/compute/ec2.js +163 -23
- package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.d.ts +41 -0
- package/dist/lib/resources/aws/compute/ec2GracefulTerminationHandler.js +194 -0
- package/dist/lib/resources/aws/compute/ec2GracefulTerminationLambda.source.cjs +458 -0
- package/dist/lib/resources/aws/compute/ecs.d.ts +27 -1
- package/dist/lib/resources/aws/compute/ecs.js +42 -2
- package/dist/lib/resources/aws/compute/ecsConstants.d.ts +9 -0
- package/dist/lib/resources/aws/compute/ecsConstants.js +16 -0
- package/dist/lib/resources/aws/compute/ecsImages.js +32 -20
- package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.d.ts +96 -0
- package/dist/lib/resources/aws/compute/ecsLifecycleHookMigration.js +113 -0
- package/dist/lib/resources/aws/compute/ecsNetworking.d.ts +2 -1
- package/dist/lib/resources/aws/compute/ecsNetworking.js +18 -6
- package/dist/lib/resources/aws/compute/ecsServiceFactory.d.ts +13 -4
- package/dist/lib/resources/aws/compute/ecsServiceFactory.js +155 -33
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.d.ts +31 -1
- package/dist/lib/resources/aws/compute/ecsTaskDefinition.js +102 -6
- package/dist/lib/resources/aws/compute/ecsTypes.d.ts +173 -13
- package/dist/lib/resources/aws/compute/ecsValidation.d.ts +9 -0
- package/dist/lib/resources/aws/compute/ecsValidation.js +63 -0
- package/dist/lib/resources/aws/compute/index.d.ts +2 -0
- package/dist/lib/resources/aws/compute/index.js +2 -0
- package/dist/lib/resources/aws/compute/lambda.d.ts +7 -13
- package/dist/lib/resources/aws/compute/lambda.js +30 -38
- package/dist/lib/resources/aws/compute/lifecycleHookLambda.source.cjs +192 -0
- package/dist/lib/resources/aws/compute/persistentDataVolume.d.ts +104 -0
- package/dist/lib/resources/aws/compute/persistentDataVolume.js +245 -0
- package/dist/lib/resources/aws/compute/persistentDataVolumeLambda.source.cjs +398 -0
- package/dist/lib/resources/aws/compute/samApplication.d.ts +15 -0
- package/dist/lib/resources/aws/compute/samApplication.js +27 -0
- package/dist/lib/resources/aws/database/clickhouseConstants.d.ts +159 -0
- package/dist/lib/resources/aws/database/clickhouseConstants.js +181 -0
- package/dist/lib/resources/aws/database/clickhouseSchemas.d.ts +71 -0
- package/dist/lib/resources/aws/database/clickhouseSchemas.js +157 -0
- package/dist/lib/resources/aws/database/clickhouseSecurityGroup.d.ts +14 -0
- package/dist/lib/resources/aws/database/clickhouseSecurityGroup.js +23 -0
- package/dist/lib/resources/aws/database/clickhouseUserData.d.ts +69 -0
- package/dist/lib/resources/aws/database/clickhouseUserData.js +371 -0
- package/dist/lib/resources/aws/database/clickhouseXmlRenderer.d.ts +56 -0
- package/dist/lib/resources/aws/database/clickhouseXmlRenderer.js +112 -0
- package/dist/lib/resources/aws/database/rdsAurora.d.ts +8 -1
- package/dist/lib/resources/aws/database/rdsAurora.js +42 -32
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.d.ts +15 -2
- package/dist/lib/resources/aws/database/rdsAuroraGlobal.js +39 -43
- package/dist/lib/resources/aws/database/rdsDefaults.d.ts +6 -0
- package/dist/lib/resources/aws/database/rdsDefaults.js +7 -1
- package/dist/lib/resources/aws/database/rdsHelpers.d.ts +3 -3
- package/dist/lib/resources/aws/database/rdsHelpers.js +1 -0
- package/dist/lib/resources/aws/database/rdsInstance.d.ts +8 -1
- package/dist/lib/resources/aws/database/rdsInstance.js +51 -34
- package/dist/lib/resources/aws/database/rdsProxyOutput.d.ts +1 -1
- package/dist/lib/resources/aws/database/rdsProxyOutput.js +1 -1
- package/dist/lib/resources/aws/iam/delegationRole.js +1 -1
- package/dist/lib/resources/aws/iam/identityCenter/groupMembership.d.ts +9 -0
- package/dist/lib/resources/aws/iam/identityCenter/groupMembership.js +12 -0
- package/dist/lib/resources/aws/iam/identityCenter/index.d.ts +1 -0
- package/dist/lib/resources/aws/iam/identityCenter/index.js +1 -0
- package/dist/lib/resources/aws/iam/identityCenter/permissionSet.d.ts +1 -0
- package/dist/lib/resources/aws/iam/identityCenter/permissionSet.js +1 -0
- package/dist/lib/resources/aws/logging/logGroup.d.ts +0 -8
- package/dist/lib/resources/aws/logging/logGroup.js +0 -11
- package/dist/lib/resources/aws/messaging/defaultEventBus.d.ts +7 -0
- package/dist/lib/resources/aws/messaging/defaultEventBus.js +21 -0
- package/dist/lib/resources/aws/messaging/eventBridgeRule.d.ts +96 -0
- package/dist/lib/resources/aws/messaging/eventBridgeRule.js +110 -0
- package/dist/lib/resources/aws/messaging/eventTargets.d.ts +84 -0
- package/dist/lib/resources/aws/messaging/eventTargets.js +152 -0
- package/dist/lib/resources/aws/messaging/eventbridge.d.ts +25 -2
- package/dist/lib/resources/aws/messaging/eventbridge.js +22 -10
- package/dist/lib/resources/aws/messaging/index.d.ts +5 -0
- package/dist/lib/resources/aws/messaging/index.js +2 -0
- package/dist/lib/resources/aws/messaging/schedule.d.ts +118 -0
- package/dist/lib/resources/aws/messaging/schedule.js +64 -0
- package/dist/lib/resources/aws/messaging/sns.d.ts +2 -1
- package/dist/lib/resources/aws/messaging/sqs.d.ts +2 -1
- package/dist/lib/resources/aws/messaging/subscription.d.ts +112 -0
- package/dist/lib/resources/aws/messaging/subscription.js +67 -0
- package/dist/lib/resources/aws/messaging/utils.d.ts +6 -0
- package/dist/lib/resources/aws/messaging/utils.js +10 -0
- package/dist/lib/resources/aws/monitoring/clickhouseAlarms.d.ts +60 -0
- package/dist/lib/resources/aws/monitoring/clickhouseAlarms.js +139 -0
- package/dist/lib/resources/aws/monitoring/index.d.ts +2 -0
- package/dist/lib/resources/aws/monitoring/index.js +2 -0
- package/dist/lib/resources/aws/monitoring/scheduleAlarms.d.ts +47 -0
- package/dist/lib/resources/aws/monitoring/scheduleAlarms.js +106 -0
- package/dist/lib/resources/aws/networking/crossAccountDelegationRecord.js +6 -4
- package/dist/lib/resources/aws/networking/crossAccountReturnRoutes.js +17 -13
- package/dist/lib/resources/aws/networking/dnsRecord/dnsRecordBase.js +7 -5
- package/dist/lib/resources/aws/networking/domainCertificate.d.ts +2 -2
- package/dist/lib/resources/aws/networking/domainCertificate.js +6 -4
- package/dist/lib/resources/aws/networking/hostedZone.js +6 -5
- package/dist/lib/resources/aws/networking/serviceDiscovery.d.ts +96 -0
- package/dist/lib/resources/aws/networking/serviceDiscovery.js +96 -0
- package/dist/lib/resources/aws/networking/vpc.d.ts +4 -1
- package/dist/lib/resources/aws/networking/vpc.js +4 -1
- package/dist/lib/resources/aws/networking/vpcPeeringConnection.js +21 -3
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.d.ts +16 -5
- package/dist/lib/resources/aws/organisation/costAllocationTagActivator.js +17 -3
- package/dist/lib/resources/aws/organisation/index.d.ts +1 -1
- package/dist/lib/resources/aws/organisation/organisationPolicy.d.ts +2 -0
- package/dist/lib/resources/aws/organisation/organisationPolicy.js +3 -2
- package/dist/lib/resources/aws/secrets/secret.d.ts +7 -0
- package/dist/lib/resources/aws/secrets/secret.js +4 -3
- package/dist/lib/resources/aws/storage/bucketDeployment.d.ts +16 -0
- package/dist/lib/resources/aws/storage/bucketDeployment.js +17 -0
- package/dist/lib/resources/aws/storage/ecr.js +5 -5
- package/dist/lib/resources/aws/storage/index.d.ts +1 -0
- package/dist/lib/resources/aws/storage/index.js +1 -0
- package/dist/lib/resources/aws/storage/s3.js +10 -3
- package/dist/lib/resources/aws/utilities/customResource.js +18 -9
- package/dist/lib/synth_dump.d.ts +1 -0
- package/dist/lib/synth_dump.js +42 -0
- package/dist/lib/utils/cdkContext.d.ts +2 -0
- package/dist/lib/utils/cdkContext.js +4 -2
- package/dist/lib/utils/connections.js +6 -0
- package/dist/lib/utils/connector.d.ts +12 -0
- package/dist/lib/utils/costAllocationTags.d.ts +9 -0
- package/dist/lib/utils/costAllocationTags.js +11 -1
- package/dist/lib/utils/databaseTypes.d.ts +14 -0
- package/dist/lib/utils/getConfig.d.ts +2 -0
- package/dist/lib/utils/getConfig.js +2 -0
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.js +1 -0
- package/dist/lib/utils/manifestWriter.d.ts +6 -89
- package/dist/lib/utils/manifestWriter.js +36 -23
- package/dist/lib/utils/migrationVersionResolvers.d.ts +2 -0
- package/dist/lib/utils/migrationVersionResolvers.js +2 -0
- package/dist/lib/utils/orgConfigParser.js +2 -1
- package/dist/lib/utils/resolveAlertsTopic.d.ts +14 -0
- package/dist/lib/utils/resolveAlertsTopic.js +30 -0
- package/dist/lib/utils/validationLogger.js +6 -3
- package/package.json +22 -19
|
@@ -2,5 +2,5 @@ export interface ClickHouseUserDataOptions {
|
|
|
2
2
|
/** Cloudflare account ID for R2 cold storage. If omitted, local-only storage is used. */
|
|
3
3
|
cfAccountId?: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const USERS_CONFIG_XML = "<clickhouse>\n <users>\n <default>\n <networks>\n <ip>127.0.0.1</ip>\n <ip>::1</ip>\n </networks>\n </default>\n </users>\n <profiles>\n <default>\n <optimize_move_to_prewhere>1</optimize_move_to_prewhere>\n </default>\n <app_writer>\n <max_threads>2</max_threads>\n <max_insert_threads>1</max_insert_threads>\n <max_concurrent_queries_for_user>4</max_concurrent_queries_for_user>\n <log_queries_min_query_duration_ms>100</log_queries_min_query_duration_ms>\n <optimize_move_to_prewhere>1</optimize_move_to_prewhere>\n <use_query_condition_cache>1</use_query_condition_cache>\n <!-- Re-enable skip indexes under FINAL (tenantQuery auto-FINALs RMT tables;\n default disables idx_aws_account, idx_application, idx_dedup, idx_fingerprint). -->\n <use_skip_indexes_if_final>1</use_skip_indexes_if_final>\n <async_insert>1</async_insert>\n <wait_for_async_insert>1</wait_for_async_insert>\n <async_insert_max_data_size>10000000</async_insert_max_data_size>\n <!-- Adaptive batching: tune flush window between 50 ms (low-latency rare inserts)\n and 2 s (absorbs bursts). A single fixed value is silently overridden by the\n adaptive algorithm. -->\n <async_insert_busy_timeout_min_ms>50</async_insert_busy_timeout_min_ms>\n <async_insert_busy_timeout_max_ms>2000</async_insert_busy_timeout_max_ms>\n <async_insert_use_adaptive_busy_timeout>1</async_insert_use_adaptive_busy_timeout>\n <input_format_parallel_parsing>0</input_format_parallel_parsing>\n <output_format_parallel_formatting>0</output_format_parallel_formatting>\n <max_memory_usage_for_user>2684354560</max_memory_usage_for_user>\n <max_bytes_before_external_sort>536870912</max_bytes_before_external_sort>\n <max_bytes_before_external_group_by>536870912</max_bytes_before_external_group_by>\n </app_writer>\n <
|
|
5
|
+
export declare const USERS_CONFIG_XML = "<clickhouse>\n <users>\n <default>\n <networks>\n <ip>127.0.0.1</ip>\n <ip>::1</ip>\n </networks>\n </default>\n </users>\n <profiles>\n <default>\n <optimize_move_to_prewhere>1</optimize_move_to_prewhere>\n <!-- ALTER TABLE ... MODIFY TTL on a 30-day-partitioned table would otherwise\n trigger an immediate full-table rewrite (default = 1). On the t4g.medium\n box that's a merge-pool starvation event. Keep TTL changes lazy: parts\n re-evaluate TTL on their next natural merge, no forced rewrite. -->\n <materialize_ttl_after_modify>0</materialize_ttl_after_modify>\n </default>\n <app_writer>\n <max_threads>2</max_threads>\n <max_insert_threads>1</max_insert_threads>\n <max_concurrent_queries_for_user>4</max_concurrent_queries_for_user>\n <log_queries_min_query_duration_ms>100</log_queries_min_query_duration_ms>\n <optimize_move_to_prewhere>1</optimize_move_to_prewhere>\n <use_query_condition_cache>1</use_query_condition_cache>\n <!-- Re-enable skip indexes under FINAL (tenantQuery auto-FINALs RMT tables;\n default disables idx_aws_account, idx_application, idx_dedup, idx_fingerprint). -->\n <use_skip_indexes_if_final>1</use_skip_indexes_if_final>\n <!-- Tenant-isolation guards (ClickHouse PR #91065 fix). Belt-and-braces with the\n per-user SQL SETTINGS in 002-users.sql \u2014 keep both so `CREATE OR REPLACE USER`\n cannot regress this. Without these flags, FINAL queries on un-merged\n ReplacingMergeTree parts can leak across tenants. -->\n <apply_row_policy_after_final>1</apply_row_policy_after_final>\n <apply_prewhere_after_final>1</apply_prewhere_after_final>\n <do_not_merge_across_partitions_select_final>1</do_not_merge_across_partitions_select_final>\n <async_insert>1</async_insert>\n <wait_for_async_insert>1</wait_for_async_insert>\n <async_insert_max_data_size>10000000</async_insert_max_data_size>\n <!-- Adaptive batching: tune flush window between 50 ms (low-latency rare inserts)\n and 2 s (absorbs bursts). A single fixed value is silently overridden by the\n adaptive algorithm. -->\n <async_insert_busy_timeout_min_ms>50</async_insert_busy_timeout_min_ms>\n <async_insert_busy_timeout_max_ms>2000</async_insert_busy_timeout_max_ms>\n <async_insert_use_adaptive_busy_timeout>1</async_insert_use_adaptive_busy_timeout>\n <!-- Server-side deduplication of async inserts. Latent retry safety net:\n if a producer retries the same insert window (network hiccup, lambda re-run,\n SQS redelivery), the second attempt collapses against the first. As of CH 26.1\n this also propagates end-to-end through dependent materialised views \u2014 without\n it, a retried insert could double-count in metrics_hourly_mv / log_severity_hourly_mv\n even if the base table dedups. CH pin is 26.3 so the propagation fix is in. -->\n <async_insert_deduplicate>1</async_insert_deduplicate>\n <input_format_parallel_parsing>0</input_format_parallel_parsing>\n <output_format_parallel_formatting>0</output_format_parallel_formatting>\n <!-- Lazy materialisation (CH 25.4+): for `SELECT * ... LIMIT N` shapes the planner\n reads only the columns needed to evaluate ORDER BY / WHERE, then fetches the\n remaining columns for the surviving N rows. Order-of-magnitude I/O reduction\n on dashboard queries (e.g. getLatestMetrics LIMIT 1 BY application_id). -->\n <query_plan_optimize_lazy_materialization>1</query_plan_optimize_lazy_materialization>\n <!-- Per-query memory cap (overrides server-wide max_memory_usage of 1 GB\n to give app_writer 2 GB headroom). Belt-and-braces with the inline\n SETTINGS in 002-users.sql so neither layer can drift alone. -->\n <max_memory_usage>2000000000</max_memory_usage>\n <max_memory_usage_for_user>2684354560</max_memory_usage_for_user>\n <max_bytes_before_external_sort>536870912</max_bytes_before_external_sort>\n <max_bytes_before_external_group_by>536870912</max_bytes_before_external_group_by>\n <!-- Per-query caps. Belt-and-braces with the inline SETTINGS in\n 002-users.sql so `CREATE OR REPLACE USER` cannot regress the bound. -->\n <max_execution_time>30</max_execution_time>\n <max_rows_to_read>10000000</max_rows_to_read>\n </app_writer>\n <audit_writer>\n <max_threads>1</max_threads>\n <max_insert_threads>1</max_insert_threads>\n <max_concurrent_queries_for_user>2</max_concurrent_queries_for_user>\n <max_memory_usage>500000000</max_memory_usage>\n <max_execution_time>10</max_execution_time>\n <async_insert>1</async_insert>\n <wait_for_async_insert>1</wait_for_async_insert>\n </audit_writer>\n <backup_reader>\n <max_threads>2</max_threads>\n <max_concurrent_queries_for_user>1</max_concurrent_queries_for_user>\n <max_memory_usage>1000000000</max_memory_usage>\n <max_execution_time>3600</max_execution_time>\n </backup_reader>\n <schema_admin>\n <max_threads>2</max_threads>\n <max_concurrent_queries_for_user>1</max_concurrent_queries_for_user>\n <max_memory_usage>1000000000</max_memory_usage>\n <max_execution_time>1800</max_execution_time>\n </schema_admin>\n </profiles>\n <quotas>\n <tenant_default>\n <interval>\n <duration>3600</duration>\n <queries>1000</queries>\n <result_rows>10000000</result_rows>\n </interval>\n </tenant_default>\n </quotas>\n</clickhouse>";
|
|
6
6
|
export declare function generateClickHouseUserData(options?: ClickHouseUserDataOptions): string;
|
|
@@ -156,6 +156,11 @@ export const USERS_CONFIG_XML = `<clickhouse>
|
|
|
156
156
|
<profiles>
|
|
157
157
|
<default>
|
|
158
158
|
<optimize_move_to_prewhere>1</optimize_move_to_prewhere>
|
|
159
|
+
<!-- ALTER TABLE ... MODIFY TTL on a 30-day-partitioned table would otherwise
|
|
160
|
+
trigger an immediate full-table rewrite (default = 1). On the t4g.medium
|
|
161
|
+
box that's a merge-pool starvation event. Keep TTL changes lazy: parts
|
|
162
|
+
re-evaluate TTL on their next natural merge, no forced rewrite. -->
|
|
163
|
+
<materialize_ttl_after_modify>0</materialize_ttl_after_modify>
|
|
159
164
|
</default>
|
|
160
165
|
<app_writer>
|
|
161
166
|
<max_threads>2</max_threads>
|
|
@@ -167,6 +172,13 @@ export const USERS_CONFIG_XML = `<clickhouse>
|
|
|
167
172
|
<!-- Re-enable skip indexes under FINAL (tenantQuery auto-FINALs RMT tables;
|
|
168
173
|
default disables idx_aws_account, idx_application, idx_dedup, idx_fingerprint). -->
|
|
169
174
|
<use_skip_indexes_if_final>1</use_skip_indexes_if_final>
|
|
175
|
+
<!-- Tenant-isolation guards (ClickHouse PR #91065 fix). Belt-and-braces with the
|
|
176
|
+
per-user SQL SETTINGS in 002-users.sql — keep both so \`CREATE OR REPLACE USER\`
|
|
177
|
+
cannot regress this. Without these flags, FINAL queries on un-merged
|
|
178
|
+
ReplacingMergeTree parts can leak across tenants. -->
|
|
179
|
+
<apply_row_policy_after_final>1</apply_row_policy_after_final>
|
|
180
|
+
<apply_prewhere_after_final>1</apply_prewhere_after_final>
|
|
181
|
+
<do_not_merge_across_partitions_select_final>1</do_not_merge_across_partitions_select_final>
|
|
170
182
|
<async_insert>1</async_insert>
|
|
171
183
|
<wait_for_async_insert>1</wait_for_async_insert>
|
|
172
184
|
<async_insert_max_data_size>10000000</async_insert_max_data_size>
|
|
@@ -176,15 +188,53 @@ export const USERS_CONFIG_XML = `<clickhouse>
|
|
|
176
188
|
<async_insert_busy_timeout_min_ms>50</async_insert_busy_timeout_min_ms>
|
|
177
189
|
<async_insert_busy_timeout_max_ms>2000</async_insert_busy_timeout_max_ms>
|
|
178
190
|
<async_insert_use_adaptive_busy_timeout>1</async_insert_use_adaptive_busy_timeout>
|
|
191
|
+
<!-- Server-side deduplication of async inserts. Latent retry safety net:
|
|
192
|
+
if a producer retries the same insert window (network hiccup, lambda re-run,
|
|
193
|
+
SQS redelivery), the second attempt collapses against the first. As of CH 26.1
|
|
194
|
+
this also propagates end-to-end through dependent materialised views — without
|
|
195
|
+
it, a retried insert could double-count in metrics_hourly_mv / log_severity_hourly_mv
|
|
196
|
+
even if the base table dedups. CH pin is 26.3 so the propagation fix is in. -->
|
|
197
|
+
<async_insert_deduplicate>1</async_insert_deduplicate>
|
|
179
198
|
<input_format_parallel_parsing>0</input_format_parallel_parsing>
|
|
180
199
|
<output_format_parallel_formatting>0</output_format_parallel_formatting>
|
|
200
|
+
<!-- Lazy materialisation (CH 25.4+): for \`SELECT * ... LIMIT N\` shapes the planner
|
|
201
|
+
reads only the columns needed to evaluate ORDER BY / WHERE, then fetches the
|
|
202
|
+
remaining columns for the surviving N rows. Order-of-magnitude I/O reduction
|
|
203
|
+
on dashboard queries (e.g. getLatestMetrics LIMIT 1 BY application_id). -->
|
|
204
|
+
<query_plan_optimize_lazy_materialization>1</query_plan_optimize_lazy_materialization>
|
|
205
|
+
<!-- Per-query memory cap (overrides server-wide max_memory_usage of 1 GB
|
|
206
|
+
to give app_writer 2 GB headroom). Belt-and-braces with the inline
|
|
207
|
+
SETTINGS in 002-users.sql so neither layer can drift alone. -->
|
|
208
|
+
<max_memory_usage>2000000000</max_memory_usage>
|
|
181
209
|
<max_memory_usage_for_user>2684354560</max_memory_usage_for_user>
|
|
182
210
|
<max_bytes_before_external_sort>536870912</max_bytes_before_external_sort>
|
|
183
211
|
<max_bytes_before_external_group_by>536870912</max_bytes_before_external_group_by>
|
|
212
|
+
<!-- Per-query caps. Belt-and-braces with the inline SETTINGS in
|
|
213
|
+
002-users.sql so \`CREATE OR REPLACE USER\` cannot regress the bound. -->
|
|
214
|
+
<max_execution_time>30</max_execution_time>
|
|
215
|
+
<max_rows_to_read>10000000</max_rows_to_read>
|
|
184
216
|
</app_writer>
|
|
185
|
-
<
|
|
186
|
-
<
|
|
187
|
-
|
|
217
|
+
<audit_writer>
|
|
218
|
+
<max_threads>1</max_threads>
|
|
219
|
+
<max_insert_threads>1</max_insert_threads>
|
|
220
|
+
<max_concurrent_queries_for_user>2</max_concurrent_queries_for_user>
|
|
221
|
+
<max_memory_usage>500000000</max_memory_usage>
|
|
222
|
+
<max_execution_time>10</max_execution_time>
|
|
223
|
+
<async_insert>1</async_insert>
|
|
224
|
+
<wait_for_async_insert>1</wait_for_async_insert>
|
|
225
|
+
</audit_writer>
|
|
226
|
+
<backup_reader>
|
|
227
|
+
<max_threads>2</max_threads>
|
|
228
|
+
<max_concurrent_queries_for_user>1</max_concurrent_queries_for_user>
|
|
229
|
+
<max_memory_usage>1000000000</max_memory_usage>
|
|
230
|
+
<max_execution_time>3600</max_execution_time>
|
|
231
|
+
</backup_reader>
|
|
232
|
+
<schema_admin>
|
|
233
|
+
<max_threads>2</max_threads>
|
|
234
|
+
<max_concurrent_queries_for_user>1</max_concurrent_queries_for_user>
|
|
235
|
+
<max_memory_usage>1000000000</max_memory_usage>
|
|
236
|
+
<max_execution_time>1800</max_execution_time>
|
|
237
|
+
</schema_admin>
|
|
188
238
|
</profiles>
|
|
189
239
|
<quotas>
|
|
190
240
|
<tenant_default>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Stack } from "aws-cdk-lib";
|
|
1
|
+
import { Annotations, Stack } from "aws-cdk-lib";
|
|
2
2
|
import { Port } from "aws-cdk-lib/aws-ec2";
|
|
3
3
|
import { Construct } from "constructs";
|
|
4
4
|
import App from "../../../app.js";
|
|
@@ -27,7 +27,9 @@ export class AwsStack {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
getCdkStack(id, props) {
|
|
30
|
-
|
|
30
|
+
const stack = new Stack(App.getInstance(), id, this.getStackProps(props));
|
|
31
|
+
Annotations.of(stack).acknowledgeWarning("@aws-cdk/aws-ec2:ipv4IgnoreEgressRule");
|
|
32
|
+
return stack;
|
|
31
33
|
}
|
|
32
34
|
getStackProps(props) {
|
|
33
35
|
// If no explicit props are provided, fall back to the account/region that
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DefaultResult, LifecycleTransition } from "aws-cdk-lib/aws-autoscaling";
|
|
2
|
+
import { QueueHook } from "aws-cdk-lib/aws-autoscaling-hooktargets";
|
|
3
|
+
import { Duration } from "aws-cdk-lib";
|
|
4
|
+
export function regression(asg, queue, id) {
|
|
5
|
+
asg.addLifecycleHook(`${id}LaunchingHook`, {
|
|
6
|
+
lifecycleTransition: LifecycleTransition.INSTANCE_LAUNCHING,
|
|
7
|
+
defaultResult: DefaultResult.ABANDON,
|
|
8
|
+
heartbeatTimeout: Duration.seconds(300),
|
|
9
|
+
notificationTarget: new QueueHook(queue)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type AutoScalingGroup, type DefaultResult, type LifecycleTransition } from "aws-cdk-lib/aws-autoscaling";
|
|
2
|
+
import { type Construct } from "constructs";
|
|
3
|
+
export interface InlineAsgLifecycleHookProps {
|
|
4
|
+
/** ASG to attach the hook to. */
|
|
5
|
+
autoScalingGroup: AutoScalingGroup;
|
|
6
|
+
/** Lifecycle hook name — must be unique within the ASG. */
|
|
7
|
+
hookName: string;
|
|
8
|
+
/** EC2_INSTANCE_LAUNCHING or EC2_INSTANCE_TERMINATING. */
|
|
9
|
+
lifecycleTransition: LifecycleTransition;
|
|
10
|
+
/** Action when heartbeat elapses. */
|
|
11
|
+
defaultResult: DefaultResult;
|
|
12
|
+
/** Heartbeat window before defaultResult fires, in seconds. */
|
|
13
|
+
heartbeatTimeoutSeconds: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Atomically attach an ASG lifecycle hook by appending a
|
|
17
|
+
* `LifecycleHookSpecification` to the ASG's `LifecycleHookSpecificationList`
|
|
18
|
+
* (CFN property on `AWS::AutoScaling::AutoScalingGroup`) instead of emitting
|
|
19
|
+
* a standalone `AWS::AutoScaling::LifecycleHook` resource.
|
|
20
|
+
*
|
|
21
|
+
* Standalone `AWS::AutoScaling::LifecycleHook` resources are created AFTER
|
|
22
|
+
* the ASG. CFN starts the ASG's desiredCapacity ramp as part of ASG creation,
|
|
23
|
+
* not as a separate step, so on a fresh stack the first instance launches
|
|
24
|
+
* BEFORE the hook is attached and the hook fires zero notifications for that
|
|
25
|
+
* instance. `LifecycleHookSpecificationList` is part of the ASG's own CFN
|
|
26
|
+
* payload — the ASG is never in a state where it has instances but no hooks.
|
|
27
|
+
*
|
|
28
|
+
* No `NotificationTargetARN` / `RoleARN` is set. AWS rejects ASG creation when
|
|
29
|
+
* the inline `LifecycleHookSpecificationList` contains two entries with
|
|
30
|
+
* different `NotificationTargetARN` values:
|
|
31
|
+
*
|
|
32
|
+
* "NotificationTargetARN should be the same for all Lifecycle Hooks"
|
|
33
|
+
*
|
|
34
|
+
* The standalone-hook form permits per-hook targets, but inline does not. Two
|
|
35
|
+
* Fjall consumers (`PersistentDataVolume` LAUNCHING + `Ec2GracefulTerminationHandler`
|
|
36
|
+
* TERMINATING) each own their own SQS queue, so a shared target is impossible.
|
|
37
|
+
*
|
|
38
|
+
* Routing is therefore delegated to EventBridge. ASG natively emits
|
|
39
|
+
* `EC2 Instance-launch Lifecycle Action` / `EC2 Instance-terminate Lifecycle Action`
|
|
40
|
+
* events on the account+region default bus for every lifecycle hook regardless
|
|
41
|
+
* of whether a notification target is configured. Each consumer attaches a
|
|
42
|
+
* `Subscription` (from `lib/resources/aws/messaging/subscription.ts`) whose
|
|
43
|
+
* event pattern discriminates by `AutoScalingGroupName` + `LifecycleHookName`,
|
|
44
|
+
* targeting the consumer's own SQS queue. The Lambda sees the EventBridge event
|
|
45
|
+
* envelope and reads `detail.LifecycleActionToken` etc. from the unwrapped
|
|
46
|
+
* detail.
|
|
47
|
+
*
|
|
48
|
+
* Multiple consumers may call this helper against the same ASG — the existing
|
|
49
|
+
* spec list is read, the new entry appended, and the merged array assigned
|
|
50
|
+
* back. Synth is sequential per scope, so the merge is race-free.
|
|
51
|
+
*/
|
|
52
|
+
export declare function attachInlineAsgLifecycleHook(_scope: Construct, _id: string, props: InlineAsgLifecycleHookProps): void;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomically attach an ASG lifecycle hook by appending a
|
|
3
|
+
* `LifecycleHookSpecification` to the ASG's `LifecycleHookSpecificationList`
|
|
4
|
+
* (CFN property on `AWS::AutoScaling::AutoScalingGroup`) instead of emitting
|
|
5
|
+
* a standalone `AWS::AutoScaling::LifecycleHook` resource.
|
|
6
|
+
*
|
|
7
|
+
* Standalone `AWS::AutoScaling::LifecycleHook` resources are created AFTER
|
|
8
|
+
* the ASG. CFN starts the ASG's desiredCapacity ramp as part of ASG creation,
|
|
9
|
+
* not as a separate step, so on a fresh stack the first instance launches
|
|
10
|
+
* BEFORE the hook is attached and the hook fires zero notifications for that
|
|
11
|
+
* instance. `LifecycleHookSpecificationList` is part of the ASG's own CFN
|
|
12
|
+
* payload — the ASG is never in a state where it has instances but no hooks.
|
|
13
|
+
*
|
|
14
|
+
* No `NotificationTargetARN` / `RoleARN` is set. AWS rejects ASG creation when
|
|
15
|
+
* the inline `LifecycleHookSpecificationList` contains two entries with
|
|
16
|
+
* different `NotificationTargetARN` values:
|
|
17
|
+
*
|
|
18
|
+
* "NotificationTargetARN should be the same for all Lifecycle Hooks"
|
|
19
|
+
*
|
|
20
|
+
* The standalone-hook form permits per-hook targets, but inline does not. Two
|
|
21
|
+
* Fjall consumers (`PersistentDataVolume` LAUNCHING + `Ec2GracefulTerminationHandler`
|
|
22
|
+
* TERMINATING) each own their own SQS queue, so a shared target is impossible.
|
|
23
|
+
*
|
|
24
|
+
* Routing is therefore delegated to EventBridge. ASG natively emits
|
|
25
|
+
* `EC2 Instance-launch Lifecycle Action` / `EC2 Instance-terminate Lifecycle Action`
|
|
26
|
+
* events on the account+region default bus for every lifecycle hook regardless
|
|
27
|
+
* of whether a notification target is configured. Each consumer attaches a
|
|
28
|
+
* `Subscription` (from `lib/resources/aws/messaging/subscription.ts`) whose
|
|
29
|
+
* event pattern discriminates by `AutoScalingGroupName` + `LifecycleHookName`,
|
|
30
|
+
* targeting the consumer's own SQS queue. The Lambda sees the EventBridge event
|
|
31
|
+
* envelope and reads `detail.LifecycleActionToken` etc. from the unwrapped
|
|
32
|
+
* detail.
|
|
33
|
+
*
|
|
34
|
+
* Multiple consumers may call this helper against the same ASG — the existing
|
|
35
|
+
* spec list is read, the new entry appended, and the merged array assigned
|
|
36
|
+
* back. Synth is sequential per scope, so the merge is race-free.
|
|
37
|
+
*/
|
|
38
|
+
export function attachInlineAsgLifecycleHook(_scope, _id, props) {
|
|
39
|
+
const cfnAsg = props.autoScalingGroup.node
|
|
40
|
+
.defaultChild;
|
|
41
|
+
const existing = readLifecycleHookSpecList(cfnAsg);
|
|
42
|
+
cfnAsg.lifecycleHookSpecificationList = [
|
|
43
|
+
...existing,
|
|
44
|
+
{
|
|
45
|
+
lifecycleHookName: props.hookName,
|
|
46
|
+
lifecycleTransition: props.lifecycleTransition,
|
|
47
|
+
defaultResult: props.defaultResult,
|
|
48
|
+
heartbeatTimeout: props.heartbeatTimeoutSeconds
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
function readLifecycleHookSpecList(cfnAsg) {
|
|
53
|
+
const current = cfnAsg.lifecycleHookSpecificationList;
|
|
54
|
+
if (current === undefined)
|
|
55
|
+
return [];
|
|
56
|
+
if (Array.isArray(current)) {
|
|
57
|
+
return current;
|
|
58
|
+
}
|
|
59
|
+
throw new Error("Cannot append to lifecycleHookSpecificationList: existing value is an IResolvable — refactor the override to call attachInlineAsgLifecycleHook");
|
|
60
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BlockDeviceVolume, EbsDeviceVolumeType } from "aws-cdk-lib/aws-ec2";
|
|
2
|
+
export interface SafeEbsOptions {
|
|
3
|
+
volumeType?: EbsDeviceVolumeType;
|
|
4
|
+
iops?: number;
|
|
5
|
+
throughput?: number;
|
|
6
|
+
deleteOnTermination?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function safeEbs(sizeGiB: number, opts?: SafeEbsOptions): BlockDeviceVolume;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BlockDeviceVolume, EbsDeviceVolumeType } from "aws-cdk-lib/aws-ec2";
|
|
2
|
+
export function safeEbs(sizeGiB, opts = {}) {
|
|
3
|
+
return BlockDeviceVolume.ebs(sizeGiB, {
|
|
4
|
+
encrypted: true,
|
|
5
|
+
volumeType: opts.volumeType ?? EbsDeviceVolumeType.GP3,
|
|
6
|
+
iops: opts.iops,
|
|
7
|
+
throughput: opts.throughput,
|
|
8
|
+
deleteOnTermination: opts.deleteOnTermination
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -1,9 +1,39 @@
|
|
|
1
|
-
import { type BlockDevice, type IMachineImage, type IVpc, type UserData,
|
|
1
|
+
import { type BlockDevice, type IMachineImage, type IVpc, type UserData, type ISecurityGroup, type IConnectable, Connections, type SubnetConfiguration, type SubnetSelection } from "aws-cdk-lib/aws-ec2";
|
|
2
2
|
import { Construct } from "constructs";
|
|
3
|
-
import { Stack, type StackProps } from "aws-cdk-lib";
|
|
3
|
+
import { Duration, Stack, type StackProps } from "aws-cdk-lib";
|
|
4
4
|
import { type Role } from "aws-cdk-lib/aws-iam";
|
|
5
|
-
import { AutoScalingGroup } from "aws-cdk-lib/aws-autoscaling";
|
|
6
|
-
|
|
5
|
+
import { AutoScalingGroup, Monitoring, type WarmPoolOptions } from "aws-cdk-lib/aws-autoscaling";
|
|
6
|
+
import { type PersistentDataVolumeProps } from "./persistentDataVolume.js";
|
|
7
|
+
export type Ec2InstancePersistentDataVolumeConfig = Omit<PersistentDataVolumeProps, "autoScalingGroup">;
|
|
8
|
+
/**
|
|
9
|
+
* Caller-supplied ASG `UpdatePolicy` resolution. Default (`undefined`) →
|
|
10
|
+
* `rollingUpdate({ minInstancesInService: 0, maxBatchSize: 1, pauseTime:
|
|
11
|
+
* Duration.minutes(5) })`. The rolling shape propagates userdata mutations
|
|
12
|
+
* to running instances on every `LaunchTemplateVersion` change; data
|
|
13
|
+
* continuity for stateful patterns is preserved by `persistentDataVolume`.
|
|
14
|
+
*
|
|
15
|
+
* Variants:
|
|
16
|
+
* - `rollingUpdate` — single-instance roll; `pauseTime` overridable.
|
|
17
|
+
* `minInstancesInService` and `maxBatchSize` are fixed at `0` and `1`.
|
|
18
|
+
* - `replacingUpdate` — explicit opt-in to the legacy full-replacement shape.
|
|
19
|
+
* No Fjall consumer uses this today; retained for future bare-EC2 patterns.
|
|
20
|
+
* - `none` — no caller-driven `UpdatePolicy` (omits both
|
|
21
|
+
* `AutoScalingRollingUpdate` and `AutoScalingReplacingUpdate`). CDK still
|
|
22
|
+
* auto-emits `AutoScalingScheduledAction.IgnoreUnmodifiedGroupSizeProperties`
|
|
23
|
+
* regardless. For callers owning rollout externally.
|
|
24
|
+
*
|
|
25
|
+
* See `aiDocs/troubleshooting/clickhouse-rolling-update-window.md` for the
|
|
26
|
+
* ClickHouse-specific downtime expectations.
|
|
27
|
+
*/
|
|
28
|
+
export type Ec2InstanceUpdatePolicyConfig = {
|
|
29
|
+
type: "rollingUpdate";
|
|
30
|
+
pauseTime?: Duration;
|
|
31
|
+
} | {
|
|
32
|
+
type: "replacingUpdate";
|
|
33
|
+
} | {
|
|
34
|
+
type: "none";
|
|
35
|
+
};
|
|
36
|
+
export interface Ec2InstanceProps extends StackProps {
|
|
7
37
|
spotCapacityPercentage?: number;
|
|
8
38
|
blockDevices?: BlockDevice[];
|
|
9
39
|
accountId?: string;
|
|
@@ -12,32 +42,122 @@ interface Ec2InstanceProps extends StackProps {
|
|
|
12
42
|
subnetConfiguration?: SubnetConfiguration[];
|
|
13
43
|
minCapacity?: number;
|
|
14
44
|
maxCapacity?: number;
|
|
45
|
+
/** CDK `AutoScalingGroupProps.desiredCapacity` — initial instance count. */
|
|
46
|
+
desiredCapacity?: number;
|
|
15
47
|
instanceType: string;
|
|
16
48
|
machineImage?: IMachineImage;
|
|
17
49
|
userData?: UserData;
|
|
18
50
|
role?: Role;
|
|
19
51
|
enableSSH?: boolean;
|
|
20
52
|
defaultPort?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Caller-supplied EC2 instance monitoring resolution. Routes through the
|
|
55
|
+
* LaunchTemplate's `detailedMonitoring` field (the AWS-side source of truth
|
|
56
|
+
* for instances launched through a launch template — the ASG-level
|
|
57
|
+
* `instanceMonitoring` prop is silently ignored by CDK whenever a
|
|
58
|
+
* `launchTemplate` or `mixedInstancesPolicy` is set, which is always the
|
|
59
|
+
* case in this construct). Translation: `Monitoring.DETAILED` → `true`,
|
|
60
|
+
* `Monitoring.BASIC` → `false`. Absent → existing default of `true`
|
|
61
|
+
* (1-minute metrics) is preserved.
|
|
62
|
+
*/
|
|
63
|
+
instanceMonitoring?: Monitoring;
|
|
64
|
+
/**
|
|
65
|
+
* Externally-supplied security group. When provided, `Ec2Instance` does not
|
|
66
|
+
* create its own `AsgSecurityGroup`; the supplied SG is used by the launch
|
|
67
|
+
* template, exposed via `this.asgSecurityGroup`, and threaded into the
|
|
68
|
+
* `IConnectable` view. Callers retain full ownership.
|
|
69
|
+
*/
|
|
70
|
+
securityGroup?: ISecurityGroup;
|
|
71
|
+
/**
|
|
72
|
+
* CDK `AutoScalingGroupProps.vpcSubnets`. Overrides the default
|
|
73
|
+
* `enableSSH ? PUBLIC : resolvePrivateSubnetType(vpc)` inference. Use when
|
|
74
|
+
* the caller needs a precise subnet selection (e.g. AZ pinning).
|
|
75
|
+
*/
|
|
76
|
+
vpcSubnets?: SubnetSelection;
|
|
77
|
+
/** CDK `AutoScalingGroupProps.capacityRebalance`. Absent → CDK default. */
|
|
78
|
+
capacityRebalance?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* CDK `aws-cdk-lib/aws-autoscaling.WarmPoolOptions` verbatim — `minSize`,
|
|
81
|
+
* `maxGroupPreparedCapacity`, `poolState`, `reuseOnScaleIn`. When present,
|
|
82
|
+
* `asg.addWarmPool(warmPool)` is called once after ASG construction.
|
|
83
|
+
*/
|
|
84
|
+
warmPool?: WarmPoolOptions;
|
|
85
|
+
/**
|
|
86
|
+
* CDK `LaunchTemplateProps.associatePublicIpAddress`. When defined,
|
|
87
|
+
* overrides the `!!keyPair` auto-derivation; otherwise the existing
|
|
88
|
+
* keyPair-driven default applies.
|
|
89
|
+
*/
|
|
90
|
+
associatePublicIpAddress?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* ECS cluster ARN — when set, the graceful-termination Lambda also drains
|
|
93
|
+
* and deregisters the container instance before generic cleanup. Empty
|
|
94
|
+
* string is treated as unset (rejecting Pitfall 9 / env-var-truthy traps).
|
|
95
|
+
* Bare-EC2 consumers (bastion, Fivetran) leave this unset.
|
|
96
|
+
*/
|
|
97
|
+
ecsClusterArn?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Pairs the ASG with a standalone EBS data volume that re-attaches across
|
|
100
|
+
* instance refreshes. When set, requires `vpcSubnets.availabilityZones` to
|
|
101
|
+
* be exactly one entry (matching `persistentDataVolume.availabilityZone`);
|
|
102
|
+
* the wrapper's volume is AZ-local and cannot follow a multi-AZ ASG.
|
|
103
|
+
* Forwards the wrapper's `ownerLogicalId` into the graceful-termination
|
|
104
|
+
* Lambda so the TERMINATING and LAUNCHING handlers locate the same volume.
|
|
105
|
+
*/
|
|
106
|
+
persistentDataVolume?: Ec2InstancePersistentDataVolumeConfig;
|
|
107
|
+
/**
|
|
108
|
+
* ASG `UpdatePolicy` resolution. Absent →
|
|
109
|
+
* `UpdatePolicy.rollingUpdate({ minInstancesInService: 0, maxBatchSize: 1,
|
|
110
|
+
* pauseTime: Duration.minutes(5) })`. Userdata mutations propagate to
|
|
111
|
+
* running instances via a single-batch rolling roll. See
|
|
112
|
+
* `Ec2InstanceUpdatePolicyConfig` for the variant menu and
|
|
113
|
+
* `aiDocs/troubleshooting/clickhouse-rolling-update-window.md` for the
|
|
114
|
+
* downtime-window runbook.
|
|
115
|
+
*/
|
|
116
|
+
updatePolicy?: Ec2InstanceUpdatePolicyConfig;
|
|
117
|
+
/**
|
|
118
|
+
* Tags applied to the underlying ASG with
|
|
119
|
+
* `applyToLaunchedInstances: true` so every launched EC2 instance carries
|
|
120
|
+
* the tags. Used for tag-based SSM `SendCommand` targeting
|
|
121
|
+
* (`Targets: [{ Key: "tag:<name>", Values: [<value>] }]`). Empty-string
|
|
122
|
+
* keys or values are rejected by `validateEc2InstanceProps`.
|
|
123
|
+
*/
|
|
124
|
+
tags?: Record<string, string>;
|
|
21
125
|
}
|
|
22
126
|
export declare class Ec2Instance extends Construct implements IConnectable {
|
|
23
127
|
private launchTemplate;
|
|
24
128
|
vpc: IVpc;
|
|
25
|
-
asgSecurityGroup:
|
|
129
|
+
asgSecurityGroup: ISecurityGroup;
|
|
26
130
|
private autoScalingGroup;
|
|
27
131
|
private keyPair;
|
|
28
|
-
|
|
132
|
+
private persistentDataVolume?;
|
|
133
|
+
readonly connections: Connections;
|
|
29
134
|
constructor(scope: Construct, id: string, props: Ec2InstanceProps);
|
|
30
|
-
addVpc
|
|
31
|
-
addKeyPair
|
|
32
|
-
addLaunchTemplate
|
|
33
|
-
addAutoScalingGroup
|
|
135
|
+
private addVpc;
|
|
136
|
+
private addKeyPair;
|
|
137
|
+
private addLaunchTemplate;
|
|
138
|
+
private addAutoScalingGroup;
|
|
139
|
+
/**
|
|
140
|
+
* Apply `props.tags` to the underlying ASG with
|
|
141
|
+
* `applyToLaunchedInstances: true` so the CFN ASG `Tags` array carries
|
|
142
|
+
* `{ Key, Value, PropagateAtLaunch: true }` for each entry. Enables
|
|
143
|
+
* tag-based SSM `SendCommand` targeting on the launched EC2 instances.
|
|
144
|
+
*/
|
|
145
|
+
private applyInstanceTags;
|
|
34
146
|
/**
|
|
35
147
|
* Get the Auto Scaling Group.
|
|
36
148
|
*/
|
|
37
149
|
getAutoScalingGroup(): AutoScalingGroup;
|
|
38
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Wire an ASG `EC2_INSTANCE_TERMINATING` hook + Lambda so instances
|
|
152
|
+
* terminate cleanly during stack updates and stack deletes. Drain ownership
|
|
153
|
+
* lives at the EC2 layer; ECS-specific drain plugs in via `ecsClusterArn`
|
|
154
|
+
* so a single hook handles bare-EC2 (bastion, Fivetran) and ECS-wired
|
|
155
|
+
* ASGs (ClickHouse) without duplicate plumbing in the ECS layer.
|
|
156
|
+
*/
|
|
157
|
+
private addGracefulTerminationHandler;
|
|
158
|
+
private addPersistentDataVolume;
|
|
159
|
+
private suspendAutoScaling;
|
|
39
160
|
}
|
|
40
161
|
export declare class Ec2InstanceStack extends Stack {
|
|
41
162
|
constructor(scope: Construct, id: string, props: Ec2InstanceProps);
|
|
42
163
|
}
|
|
43
|
-
export {};
|