#21 Infrastructure as a code solves Genuine issues

Infrastructure of Code – IAC is the management of infrastructure (Virtual machines, Load balancers, connection topology and network) in a descriptive model using the same language as devops teams uses.

What is infrastructure as a Code ?

Infrastructure as a code – IAC is the management of infrastructure (Virtual machines, Load balancers, connection topology and network) in a descriptive model using the same language as devops teams uses.

As per the principle that states that the same source code generates the same binary and IAC model should create the same environment every time its is utilized. Its becoming a key devops practice and it works in parallel with continuous delivery.

Which real problems does IAC solves ?

IAC came into existence to solve two major problems which are stated below:

1. Environmental drift – Take an example where devops teams are managing 100’s of instance of varied application & they are not using IAC. The cumbersome task would be to  maintain the configuration of individual deployment environments. Over the period of time these environments become snowflakes, meaning a devops team cannot reproduce a unique configuration automatically.

Very good chance you will have inconsistency between environments which ultimately leads to issues during the final deployment.

If your system has snowflakes then maintenance and administration of infrastructure are difficult to handle. Ultimately this introduces errors in the system.

Infrastructure as a code

2. Idempotence –  This is a property which states that a deployment script always sets the target environment into the same set of configuration every time , irrespective of the initial state of environment. It is achieved by two ways:

a. Automatically configuring an existing target environment.

b. Rejecting the existing target environment and recreating it as a fresh system.

You can easily achieve this when you use IAC.

What real benefits does IAC delivers ?

Infrastructure as Code enables

  1. DevOps teams to test applications in production-like environments early in the development cycle. multiple test environments can be provisioned reliably and on demand.
  2. Infrastructure represented as code can also be validated and tested to prevent common deployment issues.
  3. Teams who implement IAC can deliver stable environments rapidly and at scale. 
  4. Teams avoid manual configuration of environments and enforce consistency by representing the desired state of their environments via code. 
  5. DevOps teams can work together with a unified set of practices and tools to deliver applications and their supporting infrastructure rapidly, reliably, and at scale.

Declarative definitions ?

IAC technology we normally use declarative definition where possible.

A definition file specifies the “what” an environment required and not necessarily the “how” part of it. File will describe the specific configuration and versions of a server component from infra point of view, but it does not specify the method for installing and configuring it. This provides an required abstraction which helps in greater flexibility in between.

This declarative way also help to reduce the technical overhead of maintaining multiple scripts over a time. There is no single industry standard for declarative format for IAC. Different platforms support varied and multiple file formats as YAML, JSON and XML. Therefore the selection of declarative format depends on the target platform.

For e.g:

Best practices for IAC ?

Below are the list of best practices which we everyone should follow.

  1. Code Everything – You should keep everything related to infrastructure in the code.
  2. Make code your single source of truth –  All the infrastructure specifications should be coded in configuration files. Your configuration files should act as the single source of truth for all the infrastructure management activities.
  3. Maintain version control –  Put all your config files under source control.
  4. Use little documentation or none at all for your infrastructure specifications – Since the configuration files itself will be self explanatory in most of the descriptive languages, devops team does not need to have exhaustive documentation. Instead just enough documentation will be enough.
  5. Test and Monitor Your Configurations. As IAC is based on coding,  therefore anyother code it could be tested and monitored. You can use various tools for it respective which platform you are using. you can check for errors and disparities in your servers before you deploy them to production.
  6. Modular IAC Code –  As in any other language, you can make you scripts modular which could reusable and reconstructed as per the changing deployment configurations.

Available Platforms

There are many platform available to implement IAC, Cloud platforms have there own languages to speak as AWS, Azure etc. Third party platforms such as TerraformAnsible, and Chef are also available to manage automated infrastructure.

In future sessions, we will have hands on session to evaluate platforms one by one.

Explore more at Teknonauts.com

2 thoughts on “#21 Infrastructure as a code solves Genuine issues

Leave a Reply

Your email address will not be published. Required fields are marked *