This post will introduce you into KaiaC, a tool made to simplify Infrastructure As Code. KaiaC is built on top of Terraform and allow you to create cloud resources just with few key values.
Key features of KaiaC
- Infrastructure as Key Value : Infrastructure is described using a simple configuration syntax. This allows a blueprint of your datacenter to be versioned and treated as you would any other code. Additionally, infrastructure can be shared and re-used.
- Terraform features : KaiaC mostly used Terraform in backgroup so you can inherit all the powerfull Terraform features like execution plans. For more information on Terraform, refer to the Terraform website.
Let's create an EC2 t2.micro with KaiaC
Step 1 : Create a KvBook
A KvBook is just the file that contains your key/value(s) configuration informations. You have to create a kvbook to tell KaiaC which type of resources you need.
Hit the following command!
$ kaiac create vmonly
The result should look like :
KvBook /root/kvbooks/vmonly-3Bpkcs9rPV1a.cfg created!
Step 2 : Edit your KvBook
Hit the following command!
$ nano /root/kvbooks/vmonly-3Bpkcs9rPV1a.cfg
The file will look like this, if it is ok for you, leave it as is :
GL_KAIAC_MODULE="vmonly"
GL_NAMESPACE="vmonly001"
GL_NAME="demo1"
GL_STAGE="staging"
BE_AMI_NAME="ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20230919"
BE_EC2_TYPE="t2.micro"
BE_EC2_VOLUME_SIZE="8"
BE_PATH_EC2_PUBKEY="~/.ssh/id_rsa.pub"
Step 3 : Register your KvBook
Hit the following command!
$ kaiac register /root/kvbooks/vmonly-3Bpkcs9rPV1a.cfg
Step 4 : Check your KvBook
Hit the following command!
$ kaiac plan
Step 5 : Apply your KvBook
Hit the following command!
$ kaiac apply
Step 6 : Check your resources
Connect to your AWS EC2 Console.
You should see your created EC2 instance
Step 7 : Destroy your resources
Hit the following command!
$ kaiac destroy
Step 8 : Check your resources again
Connect to your AWS EC2 Console.
You should see your terminated EC2 instance
Where can you find KaiaC ?
KaiaC is distributed as a Debian package and installation instructions can be found here https://www.kaiac.io/install.
If you find this post interesting please leave comments.
Top comments (0)