What are components?
Components are TypeScript classes that create and manage cloud resources. SST provides high-level components for common use cases, and you can also use low-level Pulumi resources when needed.sst.config.ts
- Has a unique name within your app
- Takes configuration props specific to that resource type
- Creates the necessary cloud resources automatically
- Can be linked to other components
Built-in components
SST provides components for both AWS and Cloudflare. Here are some commonly used ones:Compute
Function
AWS Lambda functions with live development
Service
Long-running containers on ECS
Worker
Cloudflare Workers
Cron
Scheduled tasks
APIs
ApiGatewayV2
HTTP APIs with API Gateway
AppSync
GraphQL APIs
Realtime
WebSocket connections with pub/sub
Frontends
Nextjs
Next.js applications
Remix
Remix applications
Astro
Astro sites
StaticSite
Static websites
Storage
Bucket
S3 buckets for object storage
Dynamo
DynamoDB tables
Postgres
RDS Postgres databases
Redis
ElastiCache Redis clusters
Queues & Events
Queue
SQS queues with Lambda subscribers
SnsTopic
SNS topics for pub/sub
Bus
EventBridge event buses
Component structure
Every component follows this pattern:- Logical name — A unique identifier within your app (e.g.,
"MyBucket") - Props — Configuration options specific to the component
Logical names
The logical name is how you reference the component in your code and in the SST Console. It must be unique within your app.Physical names
SST automatically generates physical names for your resources by prefixing them with your app name and stage:- Resources don’t conflict across stages
- Resources are identifiable in the AWS Console
- Names comply with AWS naming restrictions
Using components
Define components in therun function of your sst.config.ts:
sst.config.ts
Accessing properties
Component properties are Pulumi Outputs, which means they’re computed during deployment:Outputs ensure that dependencies between resources are tracked correctly during deployment.
Subscribing to events
Many components support subscribing to events:Using Pulumi resources
You can use any Pulumi resource alongside SST components:Component transforms
You can use transforms to modify how components are created:sst.config.ts
- Enforce organizational standards
- Apply consistent configurations
- Modify default behaviors
Dev mode behavior
Some components behave differently insst dev:
- Functions — Run locally with Live Lambda Development
- Frontends — Start their dev server instead of deploying
- Services — Run their dev command instead of deploying to ECS
- Databases — Can connect to local instances (Postgres, Redis)
dev prop:
Best practices
Use meaningful names
Give components descriptive logical names:Group related resources
Organize related components together:Use linking
Prefer linking over manual permissions:Next steps
Linking
Connect components together
Config
Learn about sst.config.ts
Component Reference
Browse all components
Providers
Add cloud providers