Skip to content

Latest commit

 

History

History
250 lines (147 loc) · 7.21 KB

cli.md

File metadata and controls

250 lines (147 loc) · 7.21 KB

CLI reference

Basti CLI is a command line tool that allows you to connect to your private AWS resources using AWS Session Manager port forwarding. The CLI provides an end-to-end experience for setting up and using Basti. Alternatively, you can use Basti CDK to set up and manage your Basti infrastructure with AWS CDK. You will still use the CLI to connect to your resources.

Table of contents

Commands

basti init

Usage:

basti init

Initializes the connection target. This command creates the bastion instance and all the other resources required to start a connection. You only need to run this command once for each target. The command always tries to reuse the existing resources. For example, if the bastion instance already exists in the target's VPC, a new one won't be created.

If used without arguments, the interactive mode will prompt you for all the required options. To run the command in the automatic mode, pass all the required options as command line arguments.

--rds-instance <instance-id>

String

The ID of the RDS instance to connect to.

--rds-cluster <cluster-id>

String

The ID of the RDS cluster to connect to.

--elasticache-redis-cluster <cluster-id>

String

The ID of the Elasticache Redis cluster to connect to. When the cluster is initialized, you can connect to any of its nodes as well as to the cluster itself.

--elasticache-memcached-cluster <cluster-id>

String

The ID of the Elasticache Memcached cluster to connect to. When the cluster is initialized, you can connect to any of its nodes as well as to the cluster itself.

--custom-target-vpc <vpc-id>

String

The ID of the VPC the custom connection target resides in. After Basti is initialized for the given VPC, you can connect to any target in the VPC using the --custom-target-host and --custom-target-port options.

--bastion-instance-type <instance-type>

String, Default: "t2.micro"

The EC2 instance type to be used for the bastion instance.

--bastion-assign-public-ip <true|false>

Boolean, Default: true

Whether to assign a public IP address to the bastion instance.

--tag <tag-name>=<tag-value>

String, Can be used multiple times

A tag to be applied to the bastion instance and other resources created by Basti. This option can be used multiple times to specify multiple tags. Tags with the same name will be overwritten in the order they are specified. Tags specified with the --tag option will always overwrite tags specified in the tags file.

--tags-file <path>

String, Can be used multiple times

A path to a JSON file with tags. This option can be used multiple times to specify multiple files. Tags with the same name will be overwritten in the order they are specified. Tags specified with the --tag option will always overwrite tags specified in the tags file.

Example of a tags file:

{
  "Project": "my-project",
  "Environment": "production"
}

--aws-profile <profile-name>

String

The name of the AWS CLI profile to be used to interact with AWS. If not specified, the default profile will be used.

--aws-region <region-name>

String

The name of the AWS region to be used to interact with AWS. If not specified, the region from the default profile will be used.


basti connect

Usage:

basti connect [connection]

Starts a port forwarding session to the connection target. The connection target must be initialized with the basti init command before it can be used with this command.

If used without arguments, the interactive mode will prompt you for all the required options. Alternatively, you can pass all the required options as command line arguments or specify a connection defined in the Basti configuration file.

connection

String

The name of the connection to be used. The connection must be defined in the Basti configuration file.

--rds-instance <instance-id>

String

The ID of the RDS instance to connect to.

--rds-cluster <cluster-id>

String

The ID of the RDS cluster to connect to.

--elasticache-redis-cluster <cluster-id>

String

The ID of the Elasticache Redis cluster to connect to. For a Cluster Mode Disabled (CMD) cluster, the primary endpoint is used. For a Cluster Mode Enabled (CME) cluster, the configuration endpoint is used.

--elasticache-redis-node <node-id>

String

The ID of the Elasticache Redis node to connect to. You can specify both primary and replica nodes.

--elasticache-memcached-cluster <cluster-id>

String

The ID of the Elasticache Memcached cluster to connect to. The primary endpoint is used.

--elasticache-memcached-node <node-id>

String

The ID of the Elasticache Memcached node to connect to. You can specify both primary and replica nodes.

--custom-target-vpc <vpc-id>

String

The ID of the custom connection target's VPC.

--custom-target-host <host>

String

The IP address or the DNS name of the custom connection target.

--custom-target-port <port>

Integer

The port of the custom connection target.

--local-port <port>

Integer

The local port to forward the connection to. The connection target will be available on localhost:<port>.

--aws-profile <profile-name>

String

The name of the AWS CLI profile to be used to interact with AWS. If not specified, the default profile will be used.

--aws-region <region-name>

String

The name of the AWS region to be used to interact with AWS. If not specified, the region from the default profile will be used.


basti cleanup

Usage:

basti cleanup

Removes all the resources created by Basti in your AWS account. The list of resources will be displayed and you will be prompted to confirm the cleanup.

--confirm

Boolean, Aliases: -c, -y

Automatically confirm the cleanup without interactive prompting.

--aws-profile <profile-name>

String

The name of the AWS CLI profile to be used to interact with AWS. If not specified, the default profile will be used.

--aws-region <region-name>

String

The name of the AWS region to be used to interact with AWS. If not specified, the region from the default profile will be used.