DEV Community

Cover image for Klotho - installation and first look on CLI
Paweł Piwosz
Paweł Piwosz

Posted on

Klotho - installation and first look on CLI

Prerequisities

In order to use Klotho, some dependencies are needed.

I do my test of Klotho using AWS EC2 Linux machine. I created new machine and installed all needed software.

curl

Curl must be installed in your system. Amazon Linux 2 has it already installed, so I skipped it.

Git

Basic tool to work, right? However it is not a dependency here. I will use it later, so I decided to have it installed already.

sudo yum install -y git
Enter fullscreen mode Exit fullscreen mode

AWS CLI

As I test Klotho with AWS, I need CLI to interact with the selected Cloud. The installation is simple:

wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
unzip awscli-exe-linux-x86_64.zip
rm awscli-exe-linux-x86_64.zip
sudo ./aws/install
rm -rf aws
Enter fullscreen mode Exit fullscreen mode

After successful installation, CLI needs to be configured with user's credentials. To start configuration of CLI, use

aws configure
Enter fullscreen mode Exit fullscreen mode

And fill data.

Docker

Docker is also one of the required services. Different distibution have different installation processes, here I show the Amazon Linux commands.

sudo yum install docker
sudo usermod -aG docker ec2-user
Enter fullscreen mode Exit fullscreen mode

First, Docker was installed and after installation I added my user (ec2-user) to the group docker to allow him use Docker CLI.

Pulumi

Pulumi is well-known Infrastructure as Code tool. Although Pulumi is giving 'almost automated' way of installation, I do not use it. Security reasons :). So, I install it in old-fashioned way.

wget https://get.pulumi.com/releases/sdk/pulumi-v3.29.1-linux-x64.tar.gz
tar xzvf pulumi-v3.29.1-linux-x64.tar.gz
sudo mv pulumi/pulumi* /usr/local/bin/
rm -rf pulumi*
pulumi version
Enter fullscreen mode Exit fullscreen mode

I downloaded the tarball, unpacked it and moved all files from pulumi folder to /usr/local/bin (which is defined in my $PATH). I removed not needed files and on the end I checked if installation was successful.

NodeJS and packages

Another needed tool is NodeJS. I used the instruction fron their GitHub. Of course, when other programming languages are used, other packages must be installed.

https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-x64.tar.xz
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-v16.14.2-linux-x64.tar.xz -C /usr/local/lib/nodejs
export PATH=/usr/local/lib/nodejs/node-v16.14.2-linux-x64/bin:$PATH
node -v
npm version
Enter fullscreen mode Exit fullscreen mode

Well, not very convenient way, but I don't care here. I use it for tests. Additionally, I added PATH=$PATH:/usr/local/lib/nodejs/node-v16.14.2-linux-x64/bin to my .bash_profile

To finalize this step, I installed two needed packages

npm install -g typescript ts-node
Enter fullscreen mode Exit fullscreen mode

Terraform?

Not needed at this moment. Klotho uses Pulumi now, so TF is obsolete today.

Download the tool

Finally, it is the time to install Klotho. I used the instruction from Klotho website.

curl -L "https://api.cloudcompiler.run/v1/cli/$(uname | tr '[:upper:]' '[:lower:]')/cloudcc" -o cloudcc
chmod +x cloudcc
sudo mv cloudcc /usr/local/bin/
Enter fullscreen mode Exit fullscreen mode

Final step

The final step of the installation will be initialize the Pulumi project for local use.

pulumi login --local
Enter fullscreen mode Exit fullscreen mode

And we are ready to go!

First run

When Klotho is run for the first time, it asks for the email. Looks like... I cannot go without it.

First run

Right. I am not very big fan of this approach. I understand reasoning, but I preffer to have this as an option. But ok, Khloto is in early access state, so this might be very useful for developers.

After complete this step, finally I am able to execute the first command

cloudcc -h
Enter fullscreen mode Exit fullscreen mode

And I see help information.

Help is constructed in intuitive way, I can see the resemblance to AWS CLI and other tools. If I want to see help for specific command, I can do it. For example:

cloudcc compile -h
Enter fullscreen mode Exit fullscreen mode

Will show me information about compile commands.

What are main options for Klotho?

Compile. This is the first step of creating infrastructure. Code is instrumented, Requirements defined, Klotho is generating templates to deploy on target environment.

Up. This command will spin up or update the environment after compilation.

Destroy. Well, obviously, with this command the environment will be removed.

Latest comments (0)