ros-cdk-cli v0.3.6
ROS CDK Toolkit
The ROS CDK Toolkit provides the ros
command-line interface that can be used to work with ROS CDK applications.
Command | Description |
---|---|
ros init | Start a new CDK project (app) |
ros config | Config the basic info of your account |
ros list | List stacks in an application |
ros synth | Synthesize a CDK app to ROS template(s) |
ros diff | Diff stacks against current state |
ros deploy | Deploy a stack into an ALIYUN account |
ros destroy | Deletes a stack from an ALIYUN account |
This module is part of the Ali Cloud Development Kit project.
Commands
ros init
Creates a new CDK project.
$ # List the available template types & languages
$ ros init --list
Available templates:
* app: Template for a CDK Application
└─ ros init app --language=[java|typescript]
* lib: Template for a CDK Construct Library
└─ ros init lib --language=typescript
$ # Create a new library application in typescript
$ ros init app --language=typescript
ros list
Lists the stacks modeled in the CDK app.
$ # List all stacks in the CDK app
$ # The first column will display the stack name and the following is the status of this stack
$ ros list
ecs deploy
vpc synth
vswitch init
ros synthesize
Synthesizes the CDK app and produces a cloud assembly to a designated output (defaults to cdk.out
)
Typically you don't interact directly with cloud assemblies. They are files that include everything needed to deploy your app to a cloud environment.
If your app contains a single stack or a stack is supplied as an argument to ros synth
, the template will also be displayed in the standard output (STDOUT) as YAML
.
If there are multiple stacks in your application, ros synth
will synthesize the cloud assembly to cdk.out
.
$ # Synthesize cloud assembly for StackName and output the template to STDOUT
$ ros synth MyStackName
$ # Synthesize cloud assembly for all the stacks and save them into ros.out/
$ ros synth
ros diff
Computes differences between the infrastructure specified in the current state of the CDK app and the currently deployed application (or a user-specified ROS template). This command returns non-zero if any differences are found.
$ # Diff against the currently deployed stack
$ ros diff StackName
ros deploy
Deploys a stack of your CDK app to it's environment.
$ ros deploy MyStackName
Parameters
Pass parameters to your template during deployment by using --parameters
(STACK:KEY=VALUE)
. This will apply the value VALUE
to the key KEY
for stack STACK
.
Example of providing an attribute value for an VPC through a parameter in TypeScript:
Usage of parameter in CDK Stack:
const vpc = new Vpc(this, 'ROS-VPC', {
vpcName: new RosParameter(this, 'vpcNameParameter', {
description: 'VPC name',
type: ros.RosParameterType.STRING,
}),
cidrBlock: '10.0.0.0/8'
}
Parameter values as a part of ros deploy
$ ros deploy --parameters "vpcNameParameter=theVpcName"
ros destroy
Deletes a stack from it's environment. This will cause the resources in the stack to be destroyed. If you do not provide the region, the region in configuration will be used.
$ ros destroy StackName
ros config
On top of passing configuration through command-line arguments, it is possible to use JSON configuration files. Before deployment you should have finished the configuration, including endpoint, AccessKey, AccessKeySecret and region. The AccessKey and AccessKeySecret will be encrypted and then be stored in json file named 'account.config.json' under the root. However, if you add option '-g', the file will be stroed under the package path. (The local file will be check firstly.)
JSON Configuration files
Some of the interesting keys that can be used in the JSON configuration files:
{
"endpoint": "https://ros.aliyuncs.com",
"regionId": "cn-beijing",
"accessKeyId": "xxxx",
"accessKeySecret": "xxxx"
}
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago