Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0bdaa7e
feat: add standalone Alb component for shared load balancers
ekaya97 Feb 6, 2026
787bcf7
fix: address PR review feedback
ekaya97 Feb 17, 2026
1f647a2
Merge origin/dev
vimtor Mar 16, 2026
2982b21
Revert platform changes to match origin/dev
vimtor Mar 16, 2026
2b6b0ae
remove _refVersion from alb component
vimtor Mar 16, 2026
eb33330
simplify service load balancer wiring
vimtor Mar 16, 2026
62838da
fix listener race condition and url trailing slash
vimtor Mar 16, 2026
4ae89d9
remove inline lb config type hack and use proper type narrowing
vimtor Mar 16, 2026
ac60231
fix alb listener rules not being created
vimtor Mar 16, 2026
f9a5ad7
use aws api lookups instead of tags for alb.get() references
vimtor Mar 16, 2026
6a88371
simplify alb listeners to plain array, remove async output indirection
vimtor Mar 16, 2026
51ae33d
extract listenerKey and targetKey helpers into load-balancer.ts
vimtor Mar 16, 2026
427ab88
remove domain references from shared alb examples and delete aws-shar…
vimtor Mar 16, 2026
97cbf2f
merge static test.sh into shared alb test and remove domain-specific …
vimtor Mar 16, 2026
1043f78
remove configurable default actions from alb, hardcode 403 to match s…
vimtor Mar 16, 2026
8eb2d8f
fix stale example, remove unused import, revert unrelated diff
vimtor Mar 17, 2026
d306889
add static get aws shared alb example
vimtor Mar 16, 2026
a3e7b71
add alb to internal component docs
vimtor Mar 17, 2026
c5f3bcc
restore useful code comments removed during refactor
vimtor Mar 18, 2026
6f161e6
simplify alb fields and remove dead type check in normalizeLoadBalancer
vimtor Mar 18, 2026
f089112
move resource creation out of apply in new alb and service-alb code
vimtor Mar 18, 2026
fd49419
unwrap Input with output().apply() for alb listener rule header condi…
vimtor Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/aws-shared-alb-static/api/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# sst
.sst
10 changes: 10 additions & 0 deletions examples/aws-shared-alb-static/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:18-bullseye-slim

WORKDIR /app/

COPY package.json /app
RUN npm install

COPY index.mjs /app

ENTRYPOINT ["node", "index.mjs"]
29 changes: 29 additions & 0 deletions examples/aws-shared-alb-static/api/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import express from "express";

const PORT = 3000;

const app = express();

app.get("/", (req, res) => {
res.json({ status: "ok" });
});

app.get("/api", (req, res) => {
res.json({ service: "api", message: "Hello from the API service" });
});

app.get("/api/health", (req, res) => {
res.json({ status: "ok" });
});

app.get("/api/greeting", (req, res) => {
res.json({ service: "api", message: "Hello from the API service" });
});

app.get("/api/*", (req, res) => {
res.json({ service: "api", path: req.path });
});

app.listen(PORT, () => {
console.log(`API service is running on http://localhost:${PORT}`);
});
7 changes: 7 additions & 0 deletions examples/aws-shared-alb-static/api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "api",
"version": "1.0.0",
"dependencies": {
"express": "^4.21.1"
}
}
10 changes: 10 additions & 0 deletions examples/aws-shared-alb-static/api/sst-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* This file is auto-generated by SST. Do not edit. */
/* tslint:disable */
/* eslint-disable */
/* deno-fmt-ignore-file */
/* biome-ignore-all lint: auto-generated */

/// <reference path="../sst-env.d.ts" />

import "sst"
export {}
47 changes: 47 additions & 0 deletions examples/aws-shared-alb-static/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions examples/aws-shared-alb-static/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "aws-shared-alb-static",
"version": "1.0.0",
"dependencies": {
"sst": "^4"
}
}
26 changes: 26 additions & 0 deletions examples/aws-shared-alb-static/sst-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* This file is auto-generated by SST. Do not edit. */
/* tslint:disable */
/* eslint-disable */
/* deno-fmt-ignore-file */
/* biome-ignore-all lint: auto-generated */

declare module "sst" {
export interface Resource {
"Api": {
"service": string
"type": "sst.aws.Service"
"url": string
}
"MyVpc": {
"type": "sst.aws.Vpc"
}
"SharedAlb": {
"type": "sst.aws.Alb"
"url": string
}
}
}
/// <reference path="sst-env.d.ts" />

import "sst"
export {}
80 changes: 80 additions & 0 deletions examples/aws-shared-alb-static/sst.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/// <reference path="./.sst/platform/config.d.ts" />

/**
* ## AWS Shared ALB
*
* Creates a standalone ALB that is shared across stages. In dev, the ALB is
* referenced via `Alb.get()`. In production, it's created fresh.
*
* Uses the `$dev ? get : new` pattern to share infrastructure across stages.
*/
export default $config({
app(input) {
return {
name: "aws-shared-alb",
removal: input?.stage === "production" ? "retain" : "remove",
home: "aws",
providers: {
aws: {
region: "us-east-1",
},
},
};
},
async run() {
const vpc = $dev
? sst.aws.Vpc.get("MyVpc", "vpc-xxx")
: new sst.aws.Vpc("MyVpc");

const cluster = $dev
? sst.aws.Cluster.get("MyCluster", { id: "cluster-xxx", vpc })
: new sst.aws.Cluster("MyCluster", { vpc });

const alb = $dev
? sst.aws.Alb.get("SharedAlb", "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/xxx")
: new sst.aws.Alb("SharedAlb", {
vpc,
listeners: [
{ port: 80, protocol: "http" },
],
});

if ($dev) {
new sst.aws.Service("Web", {
cluster,
image: { context: "web/" },
loadBalancer: {
instance: alb,
rules: [
{
listen: "80/http",
forward: "3000/http",
conditions: { path: "/app/*" },
priority: 200,
},
],
},
});
}

new sst.aws.Service("Api", {
cluster,
image: { context: "api/" },
loadBalancer: {
instance: alb,
rules: [
{
listen: "80/http",
forward: "3000/http",
conditions: { path: "/api/*" },
priority: 100,
},
],
},
});

return {
url: alb.url,
};
},
});
3 changes: 3 additions & 0 deletions examples/aws-shared-alb-static/web/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# sst
.sst
10 changes: 10 additions & 0 deletions examples/aws-shared-alb-static/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:18-bullseye-slim

WORKDIR /app/

COPY package.json /app
RUN npm install

COPY index.mjs /app

ENTRYPOINT ["node", "index.mjs"]
29 changes: 29 additions & 0 deletions examples/aws-shared-alb-static/web/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import express from "express";

const PORT = 3000;

const app = express();

app.get("/", (req, res) => {
res.json({ status: "ok" });
});

app.get("/app", (req, res) => {
res.send("<h1>Web App</h1><p>Hello from the Web service</p>");
});

app.get("/app/health", (req, res) => {
res.json({ status: "ok" });
});

app.get("/app/greeting", (req, res) => {
res.send("<h1>Web App</h1><p>Hello from the Web service</p>");
});

app.get("/app/*", (req, res) => {
res.send(`<h1>Web App</h1><p>Path: ${req.path}</p>`);
});

app.listen(PORT, () => {
console.log(`Web service is running on http://localhost:${PORT}`);
});
7 changes: 7 additions & 0 deletions examples/aws-shared-alb-static/web/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "web",
"version": "1.0.0",
"dependencies": {
"express": "^4.21.1"
}
}
10 changes: 10 additions & 0 deletions examples/aws-shared-alb-static/web/sst-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* This file is auto-generated by SST. Do not edit. */
/* tslint:disable */
/* eslint-disable */
/* deno-fmt-ignore-file */
/* biome-ignore-all lint: auto-generated */

/// <reference path="../sst-env.d.ts" />

import "sst"
export {}
3 changes: 3 additions & 0 deletions examples/aws-shared-alb/api/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# sst
.sst
10 changes: 10 additions & 0 deletions examples/aws-shared-alb/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:18-bullseye-slim

WORKDIR /app/

COPY package.json /app
RUN npm install

COPY index.mjs /app

ENTRYPOINT ["node", "index.mjs"]
21 changes: 21 additions & 0 deletions examples/aws-shared-alb/api/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import express from "express";

const PORT = 3000;

const app = express();

app.get("/api", (req, res) => {
res.json({ service: "api", message: "Hello from the API service" });
});

app.get("/api/health", (req, res) => {
res.json({ status: "ok" });
});

app.get("/api/*", (req, res) => {
res.json({ service: "api", path: req.path });
});

app.listen(PORT, () => {
console.log(`API service is running on http://localhost:${PORT}`);
});
7 changes: 7 additions & 0 deletions examples/aws-shared-alb/api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "api",
"version": "1.0.0",
"dependencies": {
"express": "^4.21.1"
}
}
9 changes: 9 additions & 0 deletions examples/aws-shared-alb/api/sst-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* This file is auto-generated by SST. Do not edit. */
/* tslint:disable */
/* eslint-disable */
/* deno-fmt-ignore-file */

/// <reference path="../sst-env.d.ts" />

import "sst"
export {}
7 changes: 7 additions & 0 deletions examples/aws-shared-alb/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "aws-shared-alb",
"version": "1.0.0",
"dependencies": {
"sst": "^4"
}
}
Loading
Loading