Installation
The Hereya CLI is your primary interface for managing AWS resources as code dependencies. Hereya lets you add AWS infrastructure to your applications as easily as npm packages, using reusable infrastructure as code components built with AWS CDK (TypeScript) or OpenTofu.
This guide walks you through installing the CLI, connecting to Hereya Cloud, and preparing your AWS environment.
Prerequisites
Section titled “Prerequisites”Before installing Hereya, ensure you have:
- Node.js 20 or higher - Hereya CLI is built on Node.js
- AWS Account - Required for infrastructure management
- AWS CLI configured - Needed for resource provisioning
Verify your Node.js version:
node --version# Should output v20.0.0 or higherIf you need to install or upgrade Node.js, visit nodejs.org.
Installing Hereya CLI
Section titled “Installing Hereya CLI”Hereya CLI is available as an npm package and should be installed globally for system-wide access.
npm install -g hereya-cliyarn global add hereya-clipnpm add -g hereya-cliAfter installation, verify it’s working:
hereya --versionConnecting to Hereya Cloud
Section titled “Connecting to Hereya Cloud”After installation, connect to Hereya Cloud to enable full functionality:
hereya loginThis command opens your browser for authentication and configures your local CLI.
Why Connect to Hereya Cloud?
Section titled “Why Connect to Hereya Cloud?”Hereya Cloud provides essential services that enhance your infrastructure management:
- Package Registry Access - Browse and install AWS resource packages from the Hereya registry
- Project Metadata - Store and sync project configurations across team members
- Workspace Management - Centrally manage different environments (dev, staging, production)
- Team Collaboration - Share resources and configurations with your team
- Version Control - Track package versions and updates
Your authentication credentials are stored securely on your local machine and are never transmitted with your infrastructure code.
Bootstrap AWS Infrastructure
Section titled “Bootstrap AWS Infrastructure”Before creating your first Hereya project, you need to bootstrap your AWS account. This one-time setup prepares AWS to work with Hereya:
hereya bootstrap awsWhat Does Bootstrap Do?
Section titled “What Does Bootstrap Do?”The bootstrap process creates foundational AWS resources that Hereya needs:
- State Storage Bucket - Secure S3 bucket with versioning and encryption for storing OpenTofu state files (bucket name includes “terraform” for historical compatibility)
- Hereya Backend Bucket - S3 bucket with object lock enabled for storing Hereya backend files and deployment artifacts
- DynamoDB Table - Table named
terraformStateLockfor managing concurrent access to state files - CloudFormation Stack - Manages all bootstrap infrastructure components
Hereya packages are reusable infrastructure as code components that currently support:
- AWS CDK (TypeScript)
- OpenTofu (open-source fork of Terraform)
Security features include:
- All S3 buckets have public access blocked
- Encryption enforced on all buckets
- SSL/TLS required for all bucket access
- Versioning enabled for state tracking and rollback capabilities
- Object lock on backend bucket for additional data protection
You can review the exact infrastructure code at github.com/hereya/bootstrap-aws-stack.
These resources are:
- Created once per AWS account/region combination
- Shared across all your Hereya projects
- Managed separately from your application resources
- Designed to not interfere with existing AWS resources
Important: The bootstrap command uses your current AWS CLI configuration. Ensure you’re connected to the correct AWS account and region before running it.
Verify Your Setup
Section titled “Verify Your Setup”After completing the installation steps, verify everything is configured correctly:
# Check CLI installationhereya --versionNext Steps
Section titled “Next Steps”With Hereya installed and configured, you’re ready to start building:
- Quick Start Guide - Build your first app with AWS resources in minutes
- First Project - Detailed walkthrough of project setup
- Browse Package Registry - Explore available AWS resource packages
- Managing Dependencies - Learn how to add and configure AWS resources
Troubleshooting
Section titled “Troubleshooting”Node.js Version Error
Section titled “Node.js Version Error”If you see an error about Node.js version:
# Check your current versionnode --version
# If below v20, upgrade Node.js from nodejs.org# Or use a version manager like nvm:nvm install 20nvm use 20Permission Errors During Installation
Section titled “Permission Errors During Installation”If you encounter permission errors with global installation:
Option 1: Fix npm permissions (Recommended)
# Configure npm to use a different directorymkdir ~/.npm-globalnpm config set prefix '~/.npm-global'echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrcsource ~/.bashrcOption 2: Use a Node version manager
- nvm for macOS/Linux
- nvm-windows for Windows
AWS Credentials Not Found
Section titled “AWS Credentials Not Found”If bootstrap fails with credential errors:
# Configure AWS CLIaws configure
# Or set environment variablesexport AWS_ACCESS_KEY_ID=your_access_keyexport AWS_SECRET_ACCESS_KEY=your_secret_keyexport AWS_REGION=us-east-1Network/Proxy Issues
Section titled “Network/Proxy Issues”If you’re behind a corporate proxy:
# Set proxy for npmnpm config set proxy http://proxy.company.com:8080npm config set https-proxy http://proxy.company.com:8080
# Set proxy for AWS CLIexport HTTP_PROXY=http://proxy.company.com:8080export HTTPS_PROXY=http://proxy.company.com:8080Updating Hereya CLI
Section titled “Updating Hereya CLI”Keep your Hereya CLI up to date for the latest features and fixes:
Check Current Version
Section titled “Check Current Version”hereya --versionUpdate Commands
Section titled “Update Commands”npm update -g hereya-cliyarn global upgrade hereya-clipnpm update -g hereya-cliView Available Versions
Section titled “View Available Versions”npm view hereya-cli versions --jsonUninstalling Hereya
Section titled “Uninstalling Hereya”Remove Bootstrap Resources (Optional)
Section titled “Remove Bootstrap Resources (Optional)”Before uninstalling the CLI, you can optionally remove the bootstrap infrastructure:
hereya unbootstrap awsNote: This command removes the CloudFormation stack but does not delete the S3 buckets to prevent accidental loss of state files. You’ll need to manually delete the buckets using AWS CLI or Console after ensuring no active projects depend on them.
Remove Hereya CLI
Section titled “Remove Hereya CLI”npm uninstall -g hereya-cliyarn global remove hereya-clipnpm remove -g hereya-cli