@devramps/cli
v0.1.21
Published
DevRamps CLI - Bootstrap AWS infrastructure for CI/CD pipelines
Maintainers
Readme
@devramps/cli
DevRamps CLI - Bootstrap AWS infrastructure for CI/CD pipelines.
This CLI tool helps you set up IAM roles in your AWS accounts that allow DevRamps to deploy your applications securely using OIDC federation.
Prerequisites
Node.js
This tool requires Node.js version 18 or higher.
First time installing Node.js?
- macOS: Install via Homebrew:
brew install node - Windows: Download from nodejs.org or use nvm-windows
- Linux: Use your package manager or nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash nvm install 18
Verify your installation:
node --version # Should be v18.0.0 or higher
npm --version # Should be v8.0.0 or higherAWS CLI
You need AWS credentials configured. The CLI uses these credentials to assume roles in your target accounts.
- Install the AWS CLI: AWS CLI Installation Guide
- Configure credentials:
Or set environment variables:aws configureexport AWS_ACCESS_KEY_ID=your_access_key export AWS_SECRET_ACCESS_KEY=your_secret_key
Installation
You can run the CLI directly using npx (no installation required):
npx @devramps/cli bootstrapOr install it globally:
npm install -g @devramps/cli
devramps bootstrapUsage
Bootstrap Command
The bootstrap command creates IAM roles in your target AWS accounts based on your pipeline definitions.
npx @devramps/cli bootstrap [options]Options
| Option | Description |
|--------|-------------|
| --target-account-role-name <name> | Role to assume in target accounts. Default: OrganizationAccountAccessRole, fallback: AWSControlTowerExecution |
| --pipeline-slugs <slugs> | Comma-separated list of pipeline slugs to bootstrap. Default: all pipelines |
| --dry-run | Show what would be deployed without actually deploying |
| --verbose | Enable verbose logging for debugging |
Examples
Bootstrap all pipelines:
npx @devramps/cli bootstrapBootstrap specific pipelines:
npx @devramps/cli bootstrap --pipeline-slugs my-app,my-other-appUse a custom role name for cross-account access:
npx @devramps/cli bootstrap --target-account-role-name MyCustomRolePreview changes without deploying:
npx @devramps/cli bootstrap --dry-runProject Structure
Your project should have a .devramps folder at the root with the following structure:
your-project/
├── .devramps/
│ ├── my-pipeline/
│ │ ├── pipeline.yaml # Required: Pipeline definition
│ │ └── aws_additional_iam_policies.yaml # Optional: Additional IAM policies
│ └── another-pipeline/
│ └── pipeline.yaml
└── ... your application codeAdditional IAM Policies
You can specify additional IAM policies in either JSON or YAML format for e.g. infrastructure synthesis:
aws_additional_iam_policies.yaml:
- Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- s3:GetObject
- s3:PutObject
Resource: "arn:aws:s3:::my-bucket/*"aws_additional_iam_policies.json:
[
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:PutObject"],
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
]What Gets Created
For each pipeline and target account combination, the bootstrap command creates a CloudFormation stack named DevRamps-<pipeline-slug>-Bootstrap containing:
- OIDC Identity Provider (
devramps.com) - Enables secure, credential-less authentication - IAM Role (
DevRamps-CICD-DeploymentRole) - The role that DevRamps assumes to deploy your application- Trust policy allowing only your organization and pipeline
- Policies for each deployment step type
- Any additional policies you've specified
Supported Step Types
| Step Type | Description |
|-----------|-------------|
| DEVRAMPS:EKS:DEPLOY | Deploy to EKS using kubectl |
| DEVRAMPS:EKS:HELM | Deploy to EKS using Helm |
| DEVRAMPS:ECS:DEPLOY | Deploy to ECS |
| DEVRAMPS:APPROVAL:BAKE | Wait/approval step (no AWS permissions needed) |
| CUSTOM:* | Custom steps (define permissions in additional policies) |
Troubleshooting
"Could not find .devramps folder"
Make sure you're running the command from the root of your project, where the .devramps folder is located.
"No AWS credentials found"
Configure AWS credentials using one of these methods:
- Run
aws configureto set up credentials - Set
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYenvironment variables - Use AWS SSO:
aws sso login
"Unable to assume role"
Your current AWS credentials don't have permission to assume the target role. Make sure:
- The role exists in the target account
- Your current credentials have
sts:AssumeRolepermission for that role - The role's trust policy allows your current identity to assume it
Try specifying a different role:
npx @devramps/cli bootstrap --target-account-role-name MyCustomRole"Authentication timed out"
The browser authentication flow has a 5-minute timeout. If you see this error:
- Make sure your browser opened the DevRamps authentication page
- Complete the login and organization selection
- If the page didn't open, check if a popup blocker is preventing it
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE for details.
