MilkStraw CLI

The MilkStraw CLI (@milkstraw/cli) is a developer-friendly alternative to the web-based Quickstart. Use it to start or maintain your MilkStraw integration without leaving your terminal.

Prerequisites

  • An active MilkStraw AI account
  • The AWS CLI installed and configured
  • AWS credentials with access to your AWS Organization management account
  • The Engineer, Admin, or Owner role to run commands for an organization

Configure AWS credentials#

Set up credentials using one of:

Verify your credentials are working:

Quick start#

Run setup to authenticate, setup and deploy the MilkStraw cross role through CloudFormation stacks into your AWS organization:

Commands#

CommandDescription
milkstraw loginInteractive browser login
milkstraw logoutRevoke token and clear local auth
milkstraw setupComplete onboarding and deploy stacks
milkstraw statusCheck deployment status
milkstraw updateUpdate deployed stacks to latest templates
milkstraw org listList accessible organizations

Inventory#

CommandDescription
milkstraw inventory ec2 listList EC2 on-demand instances
milkstraw inventory rds listList RDS on-demand instances
milkstraw inventory elasticache listList ElastiCache on-demand clusters
milkstraw inventory opensearch listList OpenSearch on-demand clusters
milkstraw inventory opensearch nodes listList OpenSearch nodes across all clusters
milkstraw inventory eks listList EKS clusters
milkstraw inventory eks nodegroups listList EKS node groups across all clusters
milkstraw inventory ebs listList EBS volumes

Commitments#

CommandDescription
milkstraw commitments ec2 listList EC2 Reserved Instances
milkstraw commitments rds listList RDS Reserved Instances
milkstraw commitments elasticache listList ElastiCache Reserved Instances
milkstraw commitments opensearch listList OpenSearch Reserved Instances
milkstraw commitments savings_plans compute listList Compute Savings Plans
milkstraw commitments savings_plans ec2_instance listList EC2 Instance Savings Plans
milkstraw commitments savings_plans sage_maker listList SageMaker Savings Plans
milkstraw commitments savings_plans database listList Database Savings Plans

Global options#

OptionDescription
--org <id>Specify organization ID
--aws-profile <name>Override the AWS named profile
--jsonOutput as JSON
--quietOutput data only
--markdownOutput as Markdown
--verboseEnable verbose output
--agentAgent-safe mode (no prompts, no spinners)

Environment variables#

VariableDescription
MILKSTRAW_ORGDefault organization ID
MILKSTRAW_AWS_PROFILEDefault AWS profile name

AWS credential resolution#

The CLI uses the AWS SDK for JavaScript v3 credential provider chain.

Without --aws-profile, credentials are resolved in this order:

  1. Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
  2. SSO token cache at ~/.aws/sso/cache
  3. Shared credentials file at ~/.aws/credentials (default profile)
  4. Shared config file at ~/.aws/config
  5. ECS container or EC2 instance metadata

With --aws-profile <name> (or MILKSTRAW_AWS_PROFILE), the SDK skips environment variables and uses the named profile from ~/.aws/config and ~/.aws/credentials.

Authentication#

Tokens are stored at ~/.config/milkstraw-cli/token. Login uses the OAuth device code flow via your browser.

Run milkstraw logout at any time to revoke the token and clear local auth.

Tokens expire after 90 days. You can also revoke a token in the app: open Settings > Security, find the token under Access tokens, and click Revoke token.