CLI for triggering hydration service from CI pipelines
npm install @bamboo-sh/hydration-cliCLI for triggering hydration service from CI pipelines.
``bash`
npm install -g @bamboo-sh/hydration-clior
pnpm add -g @bamboo-sh/hydration-cli
Trigger a hydration for a specific service version:
`bash`
hydration-cli hydrate \
--service-name my-service \
--version 42 \
--env dev
Options:
- -s, --service-name (required) - Name of the service to hydrate-v, --version
- (required) - Version number of the service--stack-name
- - CloudFormation stack name (defaults to serviceName-version)-e, --env
- - Environment suffix for SSM parameter lookup (e.g., dev, prod)--poll-interval
- - Polling interval in milliseconds (default: 10000)--timeout
- - Timeout in milliseconds (default: 7200000 / 2 hours)-r, --region
- - AWS region
Trigger a sync operation:
`bash`
hydration-cli sync --env dev
Options:
- -e, --env - Environment suffix for SSM parameter lookup--poll-interval
- - Polling interval in milliseconds (default: 10000)--timeout
- - Timeout in milliseconds (default: 3600000 / 1 hour)-r, --region
- - AWS region
Check the status of an existing execution:
`bashCheck status once
hydration-cli status --execution-arn arn:aws:states:...
Options:
-
-a, --execution-arn (required) - Execution ARN to check
- --wait - Wait for execution to complete
- --poll-interval - Polling interval in milliseconds (default: 10000)
- --timeout - Timeout in milliseconds (default: 7200000)
- -r, --region - AWS regionCircleCI Example
`yaml
version: 2.1jobs:
hydrate:
docker:
- image: cimg/node:20.0
steps:
- checkout
- run:
name: Install hydration CLI
command: npm install -g @bamboo-sh/hydration-cli
- run:
name: Run hydration
command: |
hydration-cli hydrate \
--service-name $SERVICE_NAME \
--version $CIRCLE_BUILD_NUM \
--env $ENVIRONMENT \
--region ap-southeast-2
workflows:
deploy:
jobs:
- hydrate:
context: aws-credentials
`Exit Codes
-
0 - Execution completed successfully
- 1 - Execution failed, timed out, or an error occurredAWS Permissions
The CLI requires the following AWS permissions:
`json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:GetParameter"
],
"Resource": "arn:aws:ssm:::parameter/hydration-service*/step-function-arn"
},
{
"Effect": "Allow",
"Action": [
"states:StartExecution",
"states:DescribeExecution",
"states:GetExecutionHistory"
],
"Resource": "arn:aws:states:::stateMachine:HydrationService*"
},
{
"Effect": "Allow",
"Action": [
"states:DescribeExecution",
"states:GetExecutionHistory"
],
"Resource": "arn:aws:states:::execution:HydrationService:"
}
]
}
`Environment Variables
-
AWS_REGION - AWS region (can also be set via --region flag)
- AWS_ACCESS_KEY_ID - AWS access key
- AWS_SECRET_ACCESS_KEY - AWS secret key
- AWS_SESSION_TOKEN` - AWS session token (if using temporary credentials)