Extending cloud infrastructure

On this page 2

Stacks keeps application cloud configuration in config/cloud.ts and project-specific server definitions in cloud/servers.ts.

Configure infrastructure

export default {
  project: {
    name: 'my-app',
    slug: 'my-app',
    region: 'us-east-1',
  },
  mode: 'server',
  infrastructure: {
    compute: { type: 't3.micro', spot: false },
    loadBalancer: { enabled: true, type: 'application' },
    ssl: { enabled: true },
    dns: { provider: 'route53' },
    cdn: { enabled: true },
  },
}

Use server mode for persistent processes and WebSockets. Use serverless mode for Lambda-based APIs and event-driven workloads.

Use cloud helpers

import {
  addJumpBox,
  getSecurityGroupId,
  hasBeenDeployed,
  purchaseDomain,
} from '@stacksjs/cloud'

const deployed = await hasBeenDeployed()
const securityGroupId = await getSecurityGroupId('my-app')

await addJumpBox('my-app-cloud')
await purchaseDomain('example.com', { years: 1, privacy: true, autoRenew: true })

The cloud package also exposes Route 53 hosted-zone helpers and targeted cleanup functions for buckets, functions, log groups, parameters, VPCs, subnets, CDK remnants, and IAM users.

Always run buddy cloud --diff after changing infrastructure and review the generated CloudFormation changes before deploying.