DEV Community

Alex Spinov
Alex Spinov

Posted on

SST Has a Free Framework for Building on AWS — Here's How to Use It

AWS is powerful but configuring Lambda, API Gateway, DynamoDB, and S3 takes days. SST lets you define your entire AWS infrastructure in TypeScript — deploy in minutes.

What Is SST?

SST is an open-source framework that makes it easy to build full-stack apps on AWS. Define your infrastructure in TypeScript, deploy with one command, and get live Lambda debugging.

Quick Start

npx create-sst@latest my-app
cd my-app && npx sst dev
Enter fullscreen mode Exit fullscreen mode

Infrastructure as TypeScript

// sst.config.ts
export default $config({
  app(input) {
    return {
      name: "my-app",
      removal: input.stage === "production" ? "retain" : "remove",
    };
  },
  async run() {
    // Create an S3 bucket
    const bucket = new sst.aws.Bucket("Uploads");

    // Create a Postgres database
    const db = new sst.aws.Postgres("Database", {
      scaling: { min: "0.5 ACU", max: "4 ACU" },
    });

    // Create an API
    const api = new sst.aws.ApiGatewayV2("Api");
    api.route("GET /users", "packages/functions/src/users.list");
    api.route("POST /users", "packages/functions/src/users.create");

    // Create a Next.js site
    const site = new sst.aws.Nextjs("Site", {
      link: [api, bucket, db],
    });

    return { url: site.url };
  },
});
Enter fullscreen mode Exit fullscreen mode

Resource Linking (Type-Safe)

// In your Lambda function
import { Resource } from "sst";

export async function handler() {
  // TypeScript knows all properties
  const bucketName = Resource.Uploads.name;
  const dbUrl = Resource.Database.url;

  // Upload to S3
  await s3.putObject({
    Bucket: Resource.Uploads.name,
    Key: "file.txt",
    Body: "Hello",
  });
}
Enter fullscreen mode Exit fullscreen mode

Live Lambda Dev

npx sst dev
# Your Lambda functions run locally
# Changes are reflected instantly (no redeploy)
# Set breakpoints in VS Code
# Connects to real AWS resources
Enter fullscreen mode Exit fullscreen mode

Available Components

  • Compute: Lambda, ECS, EC2
  • Storage: S3, DynamoDB, Postgres, Redis
  • API: API Gateway, AppSync
  • Frontend: Next.js, Astro, Remix, SvelteKit
  • Auth: Cognito, custom
  • Events: EventBridge, SQS, SNS, Cron
  • DNS: Route53

Why SST

Feature SST Serverless Framework CDK
Language TypeScript YAML TypeScript
Live dev Yes Emulator No
Frontend Built-in Manual Manual
Type safety Resource linking None Constructs
Deploy speed Incremental Full Full

Get Started


Building serverless data pipelines? My Apify scrapers integrate with AWS. Custom solutions: spinov001@gmail.com

Top comments (0)