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-deployOr use without installing:
bash
npx scf-deploy initAWS 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:
- Sign in to AWS IAM Console
- Click Users ā Create user
- Enter username (e.g.,
scf-deploy-user) - Select Attach policies directly and add:
AmazonS3FullAccessCloudFrontFullAccess
- After creating the user, go to Security credentials tab
- Click Create access key ā Select CLI
- 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 configureEnter 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-identityIf 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:
| Method | Use Case | Command |
|---|---|---|
| AWS CLI config | Local development (default) | aws configure |
| Environment variables | CI/CD pipelines | export AWS_ACCESS_KEY_ID=... |
| Named profile | Multiple 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 deployNamed Profiles (Multiple Accounts)
bash
# Add a new profile
aws configure --profile production
# Deploy with specific profile
npx scf-deploy deploy --profile production4. Minimum Required Permissions (Recommended)
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 Message | Cause | Solution |
|---|---|---|
Credentials not found | Not configured | Run aws configure |
Access Denied | Insufficient permissions | Check IAM policy |
Invalid credentials | Wrong keys | Regenerate Access Key |
For more details, see the Troubleshooting Guide.
First Deployment
1. Initialize
bash
cd your-project
npx scf-deploy initThis 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 deployOutput:
ā 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:
| Framework | Directory |
|---|---|
| Vite, Vue | dist |
| Create React App | build |
| Next.js (static) | out |
| Nuxt 3 | .output/public |
Or specify manually:
typescript
s3: {
bucketName: 'my-bucket',
buildDir: './dist',
}Next Steps
- Configuration - All options
- API Reference - CLI commands
- Examples - Framework examples