Deployment
Alchemy makes it simple to deploy infrastructure to production. This guide covers deployment strategies, best practices, and CI/CD integration.Basic Deployment
Deploy your application by running youralchemy.run.ts script:
- Create or update resources
- Save state to
.alchemy/ - Display resource URLs and outputs
Deployment Phases
Alchemy supports three phases:Up Phase (Default)
Create or update resources:Read Phase
Read resource state without making changes:Destroy Phase
Delete all resources:Stages
Stages allow you to deploy multiple independent environments (dev, staging, production):Using Stages
Environment-Specific Configuration
Use different configurations per stage:alchemy.run.ts
State Management
Local State (Default)
By default, Alchemy stores state locally in.alchemy/:
Local state is fine for development, but use remote state stores for CI/CD and teams.
Remote State
For production and teams, use a remote state store:Secrets Management
Setting Passwords
Secrets require a password for encryption:Per-Stage Passwords
Use different passwords for different stages:CI/CD Integration
GitHub Actions
GitLab CI
.gitlab-ci.yml
CircleCI
.circleci/config.yml
Deployment Strategies
Blue-Green Deployment
Deploy to a new stage, test, then switch:Canary Deployment
Gradually roll out changes:Rollback
Quick Rollback
Destroy the current deployment and redeploy a previous version:State-Based Rollback
Alchemy maintains state history. You can manually restore previous state:Monitoring Deployments
Deployment Logs
Alchemy logs all resource operations:Quiet Mode
Suppress logs in CI:Telemetry
Alchemy sends anonymous telemetry by default. Opt out:Best Practices
Multi-Region Deployment
Deploy to multiple regions:Troubleshooting
State Conflicts
If multiple deployments run simultaneously:Missing Credentials
Orphaned Resources
If resources aren’t cleaned up:Example: Production Deployment
Next Steps
- Managing Secrets - Secure secret management
- Monorepo Setup - Deploy multiple applications
- Testing - Test before deploying