# @architect-io/cldctl

> cldctl standardizes the interfaces for common cloud resources like VPCs, managed kubernetes clusters, and more, making it easier for developers to create and manage on-demand cloud infrastructure

Latest version **0.1.5** (published 2023-03-31) · 0 weekly downloads

## Install

```sh
npm install @architect-io/cldctl
pnpm add @architect-io/cldctl
yarn add @architect-io/cldctl
bun add @architect-io/cldctl
```

Provides the command `cldctl`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2023-03-31 |
| First published | 2023-01-17 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12.0.0 |
| Dependencies | 33 |
| Unpacked size | 2.1 MB |
| Known vulnerabilities | 0 (+54 in 7 direct dependencies) |
| Install scripts | no |
| Author | Architect.io @architect-team |
| Maintainers | mueschm-architect, david.thor, tjhiggins |

## Links

- npm: https://www.npmjs.com/package/@architect-io/cldctl
- Repository: https://github.com/architect-team/cldctl
- Issues: https://github.com/architect-team/cldctl/issues
- npm.io page: https://npm.io/package/@architect-io/cldctl

## Dependencies (33)

- [pg](https://npm.io/package/pg.md) ^8.8.0
- [ajv](https://npm.io/package/ajv.md) ^8.11.0
- [tar](https://npm.io/package/tar.md) ^6.1.11
- [rxjs](https://npm.io/package/rxjs.md) ^7.5.6
- [uuid](https://npm.io/package/uuid.md) ^9.0.0
- [axios](https://npm.io/package/axios.md) ^0.27.2
- [cdktf](https://npm.io/package/cdktf.md) 0.13.0
- [chalk](https://npm.io/package/chalk.md) ^5.1.2
- [execa](https://npm.io/package/execa.md) ^6.1.0
- [listr](https://npm.io/package/listr.md) ^0.14.3
- [mysql2](https://npm.io/package/mysql2.md) ^2.3.3
- [uuidv4](https://npm.io/package/uuidv4.md) ^6.2.13
- [adm-zip](https://npm.io/package/adm-zip.md) ^0.5.9
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.1229.0
- [js-yaml](https://npm.io/package/js-yaml.md) ^4.1.0
- [mongodb](https://npm.io/package/mongodb.md) ^4.10.0
- [winston](https://npm.io/package/winston.md) ^3.8.2
- [fs-extra](https://npm.io/package/fs-extra.md) 9.1.0
- [inquirer](https://npm.io/package/inquirer.md) ^8.2.4
- [cli-table](https://npm.io/package/cli-table.md) ^0.3.11
- [deepmerge](https://npm.io/package/deepmerge.md) ^4.2.2
- [untildify](https://npm.io/package/untildify.md) ^4.0.0
- [constructs](https://npm.io/package/constructs.md) ^10.1.139
- [googleapis](https://npm.io/package/googleapis.md) ^109.0.1
- [log-update](https://npm.io/package/log-update.md) ^5.0.1
- [strip-ansi](https://npm.io/package/strip-ansi.md) ^7.0.1
- [@oclif/core](https://npm.io/package/@oclif/core.md) ^1.8.2
- [log-symbols](https://npm.io/package/log-symbols.md) ^5.1.0
- [cli-spinners](https://npm.io/package/cli-spinners.md) ^2.7.0
- [digitalocean](https://npm.io/package/digitalocean.md) ^1.2.1
- [dots-wrapper](https://npm.io/package/dots-wrapper.md) ^3.8.1
- [@oclif/plugin-help](https://npm.io/package/@oclif/plugin-help.md) ^5.1.12
- [@oclif/plugin-plugins](https://npm.io/package/@oclif/plugin-plugins.md) ^2.1.0

## Recent versions

- 0.1.5 (latest) — 2023-03-31
- 1.0.0-cldctl-node-module.3 (cldctl-node-module) — 2023-05-19
- 1.0.0-cldctl-node-module-2.1 (cldctl-node-module-2) — 2023-05-16
- 0.1.4-rc1 (rc) — 2023-02-08
- 1.0.0-cldctl-node-module.2 — 2023-05-19
- 1.0.0-cldctl-node-module.1 — 2023-05-12
- 0.1.4-rc — 2023-02-08
- 0.1.4 — 2023-02-01
- 0.1.2 — 2023-02-01
- 0.1.1 — 2023-01-17
- 0.1.0 — 2023-01-17

## README

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://cdn.architect.io/logo/horizontal-inverted.png"/>
    <source media="(prefers-color-scheme: light)" srcset="https://cdn.architect.io/logo/horizontal.png"/>
    <img width="320" alt="Architect Logo" src="https://cdn.architect.io/logo/horizontal.png"/>
  </picture>
</p>

<p align="center">
  <a href="https://oclif.io"><img src="https://img.shields.io/badge/cli-oclif-brightgreen.svg" alt="oclif" /></a>
  <a href="https://npmjs.org/package/@architect-io/cldctl"><img src="https://img.shields.io/npm/v/@architect-io/cldctl.svg" alt="Version" /></a>
  <a href="https://github.com/architect-team/architect-cldctl/blob/main/package.json"><img src="https://img.shields.io/github/license/architect-team/cldctl.svg" alt="License" /></a>
</p>

<h1 style="text-align: center">
  cldctl - for creating on-demand cloud infrastructure
</h1>

cldctl standardizes the interfaces for common cloud resources like VPCs, managed kubernetes clusters, and more, making it easier for developers to create and manage on-demand cloud infrastructure. With this CLI, you'll be able to `list`, `get`, `create`, or `delete` supported resources from your favorite cloud providers and tools without learning the API calls or language used by each individual provider.

## Preqes
Please make sure to install

[ ] [NodeJS](https://nodejs.org/en/)

## Usage

```sh
# Install the CLI
$ npm install -g @architect-io/cldctl

# Register your first provider
$ cldctl add credentials --name my-credentials

# List some resources
$ cldctl list vpc --credentials my-credentials

# Create a resource
$ cldctl create vpc
```

## Cloud Providers

Before you'll be able to interact with any cloud resources, you'll need to register your cloud credentials with cldctl:

```sh
# The CLI will prompt you for available provider types and required credentials
$ cldctl add credentials
```

Scroll down to see more information about how to register each provider. **We highly recommend taking the time to read through our Readme for your desired cloud provider.** While cldctl can help to simplify the managment of resources, each cloud provider has it's own quirks that can still add some complexity to getting started. Our step by step guide can help make sure everything wroks smoothly the first time.

### Supported providers
- [x] [digitalocean](./src/%40providers/digital-ocean/)
- [x] [aws](./src/%40providers/aws/)
- [x] [gcp](./src/%40providers/gcp/)
- [ ] azure

### GCP

To use `cldctl` with Google Cloud, or GCP, you’ll need to add a [service account](https://console.cloud.google.com/iam-admin/serviceaccounts] to the cluster you want to work with. Once you’ve created the service account, give the service account the `Kubernetes Engine Admin`, `Compute Admin` and `Service Account User` roles, as shown in the screenshot below.

![Screenshot of GCP service roles page](./docs/static/gcp-service-roles.png)


#### Download key file

Now that you’ve granted the necessary permissions to your service account, you’ll need to generate and download a key file so `cldctl` can use the service account. Click `Keys` in the menu bar above the service account, then click on the `Add Key` dropdown box and select ‘Create new key`. Keep the default selection of `JSON` for the format and click the `Create` button.

![Screenshot of the GCP secret keys creation page](./docs/static/gcp-create-private-key.png)

Once you click the `Create` button, the key file should automatically begin downloading to your local machine. You’ll provide the path to this file to `cldctl` when you run the `create provider` command.

#### Enable APIs

The final step is to enable the ability to manage GCP using their APIs. From the GCP management console, ensure that the [`Compute Engine API`](https://console.cloud.google.com/apis/library/compute.googleapis.com?project=just-strength-351118) and the [`Kubernetes Admin API`](https://console.cloud.google.com/apis/library/container.googleapis.com?project=just-strength-351118) are enabled.

![Screenshot of the GCP API enable page](./docs/static/gcp-enable-compute-api.png)


### AWS
#### Create IAM user

For AWS, we’ll need to create a new IAM user and generate an access key. From the [IAM page](https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/users) of the web console, click the `Add users` button. Give the user a meaningful name and continue clicking the `Next` button, accepting defaults, until the user is created.

#### Add policies

Once the user is created, click on the user name to access the user details. From the `Permission` tab, click the `Add permissions` dropdown box and select `Add inline policy`.

![Screenshot of the AWS user policies page](./docs/static/aws-user.png)

From the policy editor that is displayed, click on the `JSON` tab, enter the following text into the editor, and click the `Review policy` button.

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "eks:*",
                "iam:*",
                "ec2:*",
                "logs:*"
            ],
            "Resource": "*"
        }
    ]
}
```

![Screenshot of the AWS custom policy creation page](./docs/static/aws-custom-policy.png)

Give the policy a meaningful name and click the `Create policy` button.

![Screenshot of the AWS policies page](./docs/static/aws-policies.png)

#### Generate access keys

You now have a new IAM user with the appropriate permissions. The last step is to generate the access key. Click on the `Security credentials` tab, scroll to the `Access keys` section, and click the `Create access key` button.

![Screenshot of the AWS credentials page](./docs/static/aws-access-key-created.png)

On the next screen, select the radio button next to `Command Line Interface (CLI)`, scroll to the bottom of the screen and check the box to accept the recommendations, and click the `Next` button.

![Screenshot of the AWS Access Key type page](./docs/static/aws-access-key-start.png)

Give the key a descriptive name, and click the `Create access key` button.

![Screenshot of the AWS Access Key finalization page](./docs/static/aws-access-key-creation.png)

From here, you can click the button to copy the key directly to your clipboard or download it in a `.csv` file. You’ll use this key to register your AWS provider.

![Screenshot of the AWS Access Key retrival page](./docs/static/aws-access-key-review.png)

### Digitial Ocean
#### Generate token

Navigate to the [Api Page](https://cloud.digitalocean.com/account/api/tokens) on the Digitial Ocean dashboard and click `Generate New Token`. Enter a useful name, set `Expiration` to `No expiry`, and click the `Generate Token` button.

![Screenshot of Digitial Ocean token creattion page](./docs/static/do-token.png)

Once the token is generated it will appear in the list of keys. Copy the token as once you leave this page the token will not be visible again. You’ll use this token to register your Digital Ocean provider.


## Resource types

The first reponsibility of this CLI is to define a set of standard schemas for common cloud resources, like VPCs, Regions, managed kubernetes clusters, and more. Below is the current list of supported schemas as well as some insights into future plans for support:

### Supported resources

- [x] [region](./src/%40resources/region/)
- [x] [vpc](./src/%40resources/vpc/)
- [x] [kubernetesCluster](./src/%40resources/kubernetesCluster/)
- [ ] [kubernetesNamespace](./src/%40resources/kubernetesNamespace/)
- [ ] [database](./src/%40resources/database/)
- [ ] [databaseType](./src/%40resources/databaseType/)
- [ ] [databaseVersion](./src/%40resources/databaseVersion/)
- [ ] [databaseSchema](./src/%40resources/databaseSchema/)
- [ ] [databaseUser](./src/%40resources/databaseUser/)
- [ ] [dnsZone](./src/%40resources/dnsZone/)
- [ ] [dnsRecord](./src/%40resources/dnsRecord/)

### Interacting with resources

```sh
$ cldctl list <resource>
$ cldctl list all
$ cldctl get <resource> <id>
$ cldctl create <resource>
$ cldctl delete <resource> <id>
```

---
_Source: https://npm.io/package/@architect-io/cldctl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
