sst 2.45.1 → 2.45.2

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.
@@ -1,5 +1,5 @@
1
1
  const FIELDS = ["dependencies", "devDependencies"];
2
- const SST_PKGS = ["sst", "astro-sst", "svelte-kit-sst", "solid-start-sst"];
2
+ const SST_PKGS = ["sst", "svelte-kit-sst", "solid-start-sst"];
3
3
  export const update = (program) => program.command("update [version]", "Update your SST and CDK packages", (yargs) => yargs.positional("version", {
4
4
  type: "string",
5
5
  describe: "Optionally specify a version to update to",
@@ -6,7 +6,7 @@ import { SSTConstruct } from "./Construct.js";
6
6
  import { Permissions } from "./util/permission.js";
7
7
  import { BindingProps, BindingResource } from "./util/binding.js";
8
8
  import { IVpc } from "aws-cdk-lib/aws-ec2";
9
- import { ContainerDefinitionOptions, CpuArchitecture, FargateService, FargateTaskDefinition, FargateServiceProps, ICluster } from "aws-cdk-lib/aws-ecs";
9
+ import { ContainerDefinitionOptions, CpuArchitecture, FargateService, FargateTaskDefinition, FargateServiceProps, ICluster, ScalableTaskCount } from "aws-cdk-lib/aws-ecs";
10
10
  import { RetentionDays } from "aws-cdk-lib/aws-logs";
11
11
  import { ApplicationLoadBalancer, ApplicationLoadBalancerProps, ApplicationTargetGroupProps, BaseApplicationListenerProps } from "aws-cdk-lib/aws-elasticloadbalancingv2";
12
12
  declare const supportedCpus: {
@@ -119,7 +119,7 @@ export interface ServiceProps {
119
119
  */
120
120
  maxContainers?: number;
121
121
  /**
122
- * Scales in or out to achieve a target cpu utilization.
122
+ * Scales in or out to achieve a target cpu utilization. Set to `false` to disable.
123
123
  * @default 70
124
124
  * @example
125
125
  * ```js
@@ -131,9 +131,9 @@ export interface ServiceProps {
131
131
  * }
132
132
  *```
133
133
  */
134
- cpuUtilization?: number;
134
+ cpuUtilization?: number | false;
135
135
  /**
136
- * Scales in or out to achieve a target memory utilization.
136
+ * Scales in or out to achieve a target memory utilization. Set to `false` to disable.
137
137
  * @default 70
138
138
  * @example
139
139
  * ```js
@@ -145,9 +145,9 @@ export interface ServiceProps {
145
145
  * }
146
146
  *```
147
147
  */
148
- memoryUtilization?: number;
148
+ memoryUtilization?: number | false;
149
149
  /**
150
- * Scales in or out to achieve a target request count per container.
150
+ * Scales in or out to achieve a target request count per container. Set to `false` to disable.
151
151
  * @default 500
152
152
  * @example
153
153
  * ```js
@@ -158,7 +158,7 @@ export interface ServiceProps {
158
158
  * }
159
159
  *```
160
160
  */
161
- requestsPerContainer?: number;
161
+ requestsPerContainer?: number | false;
162
162
  };
163
163
  /**
164
164
  * Bind resources for the function
@@ -491,6 +491,7 @@ export declare class Service extends Construct implements SSTConstruct {
491
491
  private service?;
492
492
  private distribution?;
493
493
  private alb?;
494
+ private scaling?;
494
495
  constructor(scope: Construct, id: string, props: ServiceProps);
495
496
  /**
496
497
  * The CloudFront URL of the website.
@@ -513,6 +514,7 @@ export declare class Service extends Construct implements SSTConstruct {
513
514
  applicationLoadBalancer: ApplicationLoadBalancer | undefined;
514
515
  hostedZone: import("aws-cdk-lib/aws-route53").IHostedZone | undefined;
515
516
  certificate: import("aws-cdk-lib/aws-certificatemanager").ICertificate | undefined;
517
+ scaling: ScalableTaskCount | undefined;
516
518
  } | undefined;
517
519
  getConstructMetadata(): {
518
520
  type: "Service";
@@ -149,6 +149,7 @@ export class Service extends Construct {
149
149
  service;
150
150
  distribution;
151
151
  alb;
152
+ scaling;
152
153
  constructor(scope, id, props) {
153
154
  super(scope, id);
154
155
  const app = scope.node.root;
@@ -178,7 +179,7 @@ export class Service extends Construct {
178
179
  const cluster = this.createCluster(vpc);
179
180
  const { container, taskDefinition, service } = this.createService(cluster);
180
181
  const { alb, target } = this.createLoadBalancer(vpc, service);
181
- this.createAutoScaling(service, target);
182
+ const scaling = this.createAutoScaling(service, target);
182
183
  this.alb = alb;
183
184
  // Create Distribution
184
185
  this.distribution = this.createDistribution(alb);
@@ -187,6 +188,7 @@ export class Service extends Construct {
187
188
  this.service = service;
188
189
  this.container = container;
189
190
  this.taskDefinition = taskDefinition;
191
+ this.scaling = scaling;
190
192
  this.bindForService(props?.bind || []);
191
193
  this.attachPermissionsForService(props?.permissions || []);
192
194
  Object.entries(props?.environment || {}).map(([key, value]) => this.addEnvironmentForService(key, value));
@@ -253,6 +255,7 @@ export class Service extends Construct {
253
255
  applicationLoadBalancer: this.alb,
254
256
  hostedZone: this.distribution?.cdk.hostedZone,
255
257
  certificate: this.distribution?.cdk.certificate,
258
+ scaling: this.scaling,
256
259
  };
257
260
  }
258
261
  /////////////////////
@@ -490,20 +493,25 @@ export class Service extends Construct {
490
493
  minCapacity: minContainers ?? 1,
491
494
  maxCapacity: maxContainers ?? 1,
492
495
  });
493
- scaling.scaleOnCpuUtilization("CpuScaling", {
494
- targetUtilizationPercent: cpuUtilization ?? 70,
495
- scaleOutCooldown: CdkDuration.seconds(300),
496
- });
497
- scaling.scaleOnMemoryUtilization("MemoryScaling", {
498
- targetUtilizationPercent: memoryUtilization ?? 70,
499
- scaleOutCooldown: CdkDuration.seconds(300),
500
- });
501
- if (target) {
496
+ if (cpuUtilization !== false) {
497
+ scaling.scaleOnCpuUtilization("CpuScaling", {
498
+ targetUtilizationPercent: cpuUtilization ?? 70,
499
+ scaleOutCooldown: CdkDuration.seconds(300),
500
+ });
501
+ }
502
+ if (memoryUtilization !== false) {
503
+ scaling.scaleOnMemoryUtilization("MemoryScaling", {
504
+ targetUtilizationPercent: memoryUtilization ?? 70,
505
+ scaleOutCooldown: CdkDuration.seconds(300),
506
+ });
507
+ }
508
+ if (target && requestsPerContainer !== false) {
502
509
  scaling.scaleOnRequestCount("RequestScaling", {
503
510
  requestsPerTarget: requestsPerContainer ?? 500,
504
511
  targetGroup: target,
505
512
  });
506
513
  }
514
+ return scaling;
507
515
  }
508
516
  createDistribution(alb) {
509
517
  const { cdk, customDomain } = this.props;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.45.1",
4
+ "version": "2.45.2",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },