Getting Started

Deploy your static site to AWS in 5 minutes.

Prerequisites

  • Node.js 18+
  • AWS account
  • AWS credentials configured (aws configure)

Installation

bash
npm install -g scf-deploy

Or use without installing:

bash
npx scf-deploy init

AWS Credentials Setup

SCF requires AWS credentials to create and manage AWS resources.

1. Create IAM User and Access Key

If you don't have an Access Key yet, create one in the AWS Console:

  1. Sign in to AWS IAM Console
  2. Click Users → Create user
  3. Enter username (e.g., scf-deploy-user)
  4. Select Attach policies directly and add:
    • AmazonS3FullAccess
    • CloudFrontFullAccess
  5. After creating the user, go to Security credentials tab
  6. Click Create access key → Select CLI
  7. Save the Access Key ID and Secret Access Key

šŸ”’ Security Note: The Secret Access Key is only shown once. Store it securely.

2. Configure AWS CLI

Register your Access Key locally:

bash
aws configure

Enter your credentials:

AWS Access Key ID: AKIA... # Your Access Key ID AWS Secret Access Key: wJalr... # Your Secret Access Key Default region name: ap-northeast-2 # Seoul region (or your preferred region) Default output format: json

Verify the configuration:

bash
# Test if credentials are valid
aws sts get-caller-identity

If successful, you'll see your account info:

json
{
    "UserId": "AIDA...",
    "Account": "123456789012",
    "Arn": "arn:aws:iam::123456789012:user/scf-deploy-user"
}

3. Authentication Methods

SCF supports three authentication methods:

MethodUse CaseCommand
AWS CLI configLocal development (default)aws configure
Environment variablesCI/CD pipelinesexport AWS_ACCESS_KEY_ID=...
Named profileMultiple AWS accounts--profile option

Environment Variables (CI/CD)

bash
export AWS_ACCESS_KEY_ID=AKIA...
export AWS_SECRET_ACCESS_KEY=wJalr...
export AWS_REGION=ap-northeast-2

npx scf-deploy deploy

Named Profiles (Multiple Accounts)

bash
# Add a new profile
aws configure --profile production

# Deploy with specific profile
npx scf-deploy deploy --profile production

For better security, grant only necessary permissions:

json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "S3Access",
      "Effect": "Allow",
      "Action": [
        "s3:CreateBucket",
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject",
        "s3:ListBucket",
        "s3:PutBucketPolicy",
        "s3:PutBucketWebsite",
        "s3:GetBucketLocation"
      ],
      "Resource": [
        "arn:aws:s3:::my-site-*",
        "arn:aws:s3:::my-site-*/*"
      ]
    },
    {
      "Sid": "CloudFrontAccess",
      "Effect": "Allow",
      "Action": [
        "cloudfront:CreateDistribution",
        "cloudfront:UpdateDistribution",
        "cloudfront:GetDistribution",
        "cloudfront:CreateInvalidation",
        "cloudfront:ListDistributions"
      ],
      "Resource": "*"
    }
  ]
}

šŸ’” Tip: Replace my-site-* with your actual bucket name pattern.

Troubleshooting Authentication

Error MessageCauseSolution
Credentials not foundNot configuredRun aws configure
Access DeniedInsufficient permissionsCheck IAM policy
Invalid credentialsWrong keysRegenerate Access Key

For more details, see the Troubleshooting Guide.

First Deployment

1. Initialize

bash
cd your-project
npx scf-deploy init

This creates scf.config.ts:

typescript
import { defineConfig } from 'scf-deploy';

export default defineConfig({
  app: 'my-site',
  region: 'ap-northeast-2',
  s3: {
    bucketName: 'my-site-bucket-abc123',
  },
  cloudfront: {
    enabled: true,
  },
});

2. Deploy

bash
npx scf-deploy deploy

Output:

āœ“ Building project... āœ“ AWS credentials verified āœ“ S3 bucket ready ↑ Uploading files... [ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ] 100% āœ“ CloudFront invalidation created āœ“ Deployment complete! URL: https://d1234567890abc.cloudfront.net

Build Directory

SCF auto-detects your build directory:

FrameworkDirectory
Vite, Vuedist
Create React Appbuild
Next.js (static)out
Nuxt 3.output/public

Or specify manually:

typescript
s3: {
  bucketName: 'my-bucket',
  buildDir: './dist',
}

Next Steps

3 min read • Last updated: 2025-11-25