Natural Language Infrastructure as Code: Is it the future of Cloud Automation?

Infrastructure as Code (IaC) has really revolutionised the way we manage and deploy our cloud resources. By treating infrastructure as code, we can automate the provisioning and management of cloud resources, making it faster, more reliable, and more scalable all while including the ability to have full source control benefits.

However, writing IaC can be complex and time-consuming, requiring sometimes a deep understanding of cloud architecture and your chosen IaC tools and provders. This is where Natural Language Infrastructure as Code (NLIC) comes in, offering a simpler and more intuitive way to write IaC using natural language.

What is Natural Language in programming?

Natural-language programming (NLP) is an ontology-assisted way of programming in terms of natural-language sentences, e.g. English

https://en.wikipedia.org/wiki/Natural-language_programming#:~:text=Natural%2Dlanguage%20programming%20(NLP),is%20actually%20a%20computer%20program

The goal of NLP is to enable computers to understand, interpret, and generate human language, allowing for more natural and intuitive communication between humans and machines.

NLP involves a wide range of techniques and technologies, including machine learning, deep learning, and natural language processing. These techniques are used to analyse and understand the structure and meaning of human language, as well as to generate natural language responses

What is Natural Language Infrastructure as Code?

Natural Language Infrastructure as Code (NLIC) is a new approach to writing IaC that uses natural language to describe cloud resources and their relationships. Instead of writing code the likes of YAML or JSON, you can write IaC using simple, human-readable sentences. NLIC uses machine learning and natural language processing (NLP) to translate these sentences into code that can be executed by cloud providers like  Azure, AWS and Google Cloud.

How Natural Language Infrastructure as code works

Lets have a look at an example of creating an azure virtual network in Azure, I will demo both Terraform and Bicep:

  • Virtual Network Name: tamops-vnet
  • Address Space: 192.168.0.0/24
  • Subnet1 Name: vmSubnet
  • Subnet1 Address Space: 192.168.1.0/24
  • Subnet2 Name: dmzSubnet
  • Subnet2 Address Space: 192.168.2.0/24
  • Region: UK South

For my example output, I will be using GitHub Copilot chat

My input below:

Terraform

create me an azure virtual network in azure with terraform called tamops-vnet with:
-	Virtual Network Name: tamops-vnet
-	Address space: 192.168.0.0/24
-	Subnet1 Name: vmSubnet
-	Subnet1 address space: 192.168.1.0/24
-	Subnet2 Name: dmzSubnet
-	Subnet2 address space: 192.168.2.0/24
-	Region: Uk South

Output:

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "tamops-rg" {
  name     = "tamops-rg"
  location = "uksouth"
}

resource "azurerm_virtual_network" "tamops-vnet" {
  name                = "tamops-vnet"
  address_space       = ["192.168.0.0/24"]
  location            = azurerm_resource_group.tamops-rg.location
  resource_group_name = azurerm_resource_group.tamops-rg.name

  subnet {
    name           = "vmSubnet"
    address_prefix = "192.168.1.0/24"
  }

  subnet {
    name           = "dmzSubnet"
    address_prefix = "192.168.2.0/24"
  }
}

Bicep

create me an azure virtual network in azure with azure bicep called tamops-vnet with:
-	Virtual Network Name: tamops-vnet
-	Address space: 192.168.0.0/24
-	Subnet1 Name: vmSubnet
-	Subnet1 address space: 192.168.1.0/24
-	Subnet2 Name: dmzSubnet
-	Subnet2 address space: 192.168.2.0/24
-	Region: Uk South

Output:

	param location string = 'uksouth'

resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
  name: 'tamops-rg'
  location: location
}

resource vnet 'Microsoft.Network/virtualNetworks@2021-04-01' = {
  name: 'tamops-vnet'
  location: rg.location
  resourceGroup: rg.name
  properties: {
    addressSpace: {
      addressPrefixes: [
        '192.168.0.0/24'
      ]
    }
    subnets: [
      {
        name: 'vmSubnet'
        properties: {
          addressPrefix: '192.168.1.0/24'
        }
      }
      {
        name: 'dmzSubnet'
        properties: {
          addressPrefix: '192.168.2.0/24'
        }
      }
    ]
  }
}

Truly awesome, each example was shown within a few seconds, imagine you didn’t know what was required to deploy the virtual network with either Terraform or Bicep? Having to search through documentation, Google search etc to assist.

Benefits of Natural Language Infrastructure as Code

1. Reduces complexity

First and foremost, it is much easier to write and understand. NLIC allows teams to describe cloud resources in plain English, without requiring them to have a deep understanding of cloud architecture or programming languages. This makes it more accessible to a wider range of teams, including those who may not have a background in cloud computing.

2. Speed

NLIC can help to speed up the process of creating and managing cloud resources. By using natural language to describe cloud resources, NLIC can help to reduce the time and effort required to write and maintain IaC code. This can be particularly useful for organisations that need to rapidly deploy and scale cloud resources in response to changing business needs.

3. Collaboration

Can help to improve collaboration between technical and non-technical stakeholders. By using natural language to describe cloud resources, NLIC can help to bridge the gap between technical and non-technical teams, making it easier for them to work together to create and manage cloud resources. This can help to improve communication, reduce misunderstandings, and ensure that everyone is on the same page when it comes to managing cloud resources.

4. Accessibility

NLIC makes it easier for non-technical stakeholders to create and manage cloud resources. By using natural language to describe cloud resources, NLIC reduces the learning curve for IaC and makes it more accessible to a wider range of users.

5. Cost effective

Can help to reduce the cost of managing cloud resources. By reducing the time and effort required to write and maintain IaC code, NLIC can help to reduce the cost of managing cloud resources, making it a cost-effective approach to cloud resource management. This can be particularly useful for organizations that need to manage cloud resources on a tight budget.

Challenges of Natural Language Infrastructure as Code

With NLIC still a somewhat new approach to IaC, there is certainly a number of challenges I feel that still need to me addressed.

1. Uncertainty

Natural language is inherently ambiguous, which can make it difficult to accurately describe cloud resources. The description you enter, you somewhat need to ensure it is correct or it can certainly lead to lead to errors or misconfigurations in the resulting IaC code.

2. Complexity

Your Cloud environment could be quite complex already, in terms of naming, use cases of cloud resources, networking for example – the routing setup etc. Having to describe new resources or changes to currently can become challenging, particularly for non-technical stakeholders.                                                  

3. Lack of modularisation and standardising

Your organisation will most likely be using some sort of standardisation / modularisation within your IaC, Natural Language responses will most likely not match your current outputs unless you clarify within your descriptions.

4. Best practice alignment

How can we ensure NLIC is against the current best practices that the cloud provider may offer?

5. Integration with your current IaC and workflows

NLIC may not integrate so well within your existing organisations IaC workflows and already existing automation. Depending on the current deployment setup, it could be somewhat difficult to integrate.

Conclusion

NLIC is certainly a very promising new approach to writing your IaC and as mentioned above, offers a range of benefits over the traditional approaches. Easier to write, easier to understand; but still be very wary as to how you may want to introduce or implement it.

In short, NLIC does most definitely have the potential to revolutise the way we manage and deploy our cloud resources, making the whole process much faster! It is an innovative approach to IaC that has the potential to make cloud resource management more accessible, accurate, efficient, and cost-effective. However, there are also several challenges that need to be considered in order to fully realise the benefits of NLIC within your organisation.

1 thought on “Natural Language Infrastructure as Code: Is it the future of Cloud Automation?”

Leave a Reply

Discover more from Thomas Thornton Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from Thomas Thornton Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading