In this course, we introduce you to the DevOps Playbook Part 2.
The DevOps Playbook Part 2 course continues with Books 8 through to 12, covering the topics, Infrastructure as Code, Configuration Management, Continuous Delivery, Continuous Deployment, and Continuous Monitoring, where each book documents a required DevOps competency, one in which you’ll need to adopt and establish skills in to be effective in DevOps.
- Book 8 - Infrastructure as Code
- Book 9 - Configuration Management
- Book 10 - Continuous Delivery
- Book 11 - Continuous Deployment
- Book 12 - Continuous Monitoring
The DevOps Playbook Part 2 course includes 2 demonstrations where we put into practice some of the DevOps theory presented.
- Atlassian BitBucket Pipelines and Terraform
- Atlassian BitBucket Pipelines Promoting Staging to Production
Note: the source code as used within these demonstrations is available at:
- [Instructor] Welcome back, in this lecture we'll introduce you to Infrastructure as Code and how it can help with building complete environments.
Infrastructure as Code is an automation technique used to provision infrastructure. The technique uses practices familiar with software development, whereby the infrastructure is codified into templates or defined in code. By doing so, infrastructures can be created quickly, consistently, and repeatedly. With the success of technologies such as the cloud and software defined networking, coupled together with the adoption of DevOps practices, infrastructure as code has become a key technology enabler when working in these types of environments.
The key idea behind treating your infrastructure as code is that it allows you to leverage and apply existing software tooling, allowing you to run it through toolchains and/or build pipelines. By doing so, you can automate the entire process of launching infrastructure. You start off by checking in your infrastructure as code templates into a version control system such as Git, then from here you can exploit DevOps practices such as continuous integration and continuous delivery, to automatically launch and provision infrastructure. It can be tested for validness using automated testing libraries. Having all of your infrastructure codified into templates and stored within a version control system allows you to maintain versions of your infrastructure and importantly allow you to pinpoint small changes between versions. First of all you need to consider your environment into which you will be provisioning your infrastructure. Is it on-prem, versus the cloud. Is it hybrid or multi cloud. Asking these questions will help you pick the right Infrastructure as code technology. For example, if you're working exclusively in the cloud on AWS, then CloudFormation would be a good choice. If however you have a multi cloud strategy, or don't want to be tied to a specific cloud vendors technology, then Terraform would be the way to go. You will need to upskill and train in the chosen technology. This upfront effort and cost will have its rewards multiple times over in the later parts of any project. Next, align the required infrastructure design to teams within the organization ensuring that each team can author their own Infrastructure as code templates, allowing them to create the necessary infrastructure required to support their own project.
Benefits associated with using Infrastructure as Code to create and provision environments are, Infrastructures can be easily reproduced. Infrastructures can be created consistently. Infrastructures can become disposable. Capex/Opex reduction time to create entire infrastructures drops down to to minutes and can be done without human intervention. And, it allows you to spend time on other high value work.
Challenges associated with using Infrastructure as Code to create and provision environments are, Learning Curve associated with understanding the Infrastructure as Code language. Effort and Cost required to create the provisioning templates. Community Support, the Infrastructure as Code tool and language is kept up to date with all the latest and greatest features being made available on the platform you are provisioning on.
Some example infrastructure as code tools that can be used to provision environments are, Terraform, a cloud agnostic provisioning language. AWS Cloudformation, provides a common language for you to describe and provision all your AWS infrastructure resources. Azure Resource Manager, is a framework for deploying and managing applications across resources and managing groups of resources. And, Google Cloud Deployment Manager, allows you to specify all the resources needed for your application in a declarative format using yaml.
In this first example, AWS Cloudformation templates is used to create a Virtual Private Cloud, and into it deploy a auto scaled web fleet supported by a MySQL RDS database. The provisioning here is kicked off from a developers local terminal using the AWS CLI. In this second example, Terraform is used to provision infrastructure within the Google Cloud Platform. The Terraform templates are stored within GitHub and updates to them trigger a build within Jenkins. Jenkins through the use of a Jenkins Terraform plugin then kicks off the infrastructure provisioning process. The provisioned infrastructure is then configured through the use Ansible playbooks. Ansible is a configuration management tool which we will cover off in the Configuration Management lecture.
Determine if programmable infrastructure is an important requirement for your projects. Naturally so, if your building on a cloud platform such as AWS, Azure, or GCP. Do you need to rebuild infrastructure continually? Do you tear down dev and test environments for cost optimization purposes? Are you adopting an immutable infrastructure strategy? If the answer is yes to any of these questions then you should invest in learning and adopting infrastructure as code. Next, pick the right infrastructure as code tool. Start off by considering whether it's in your long term interests to pick a platform agnostic tool such as Terraform, or if not then pick a platform specific tool, such as CloudFormation for AWS. Ensure that your infrastructure as code templates are treated in the same manner as your application codebase, that is, they should be checked in to your version control system, and integrated into your build and deployment pipelines for automatic infrastructure provisioning.
Okay, that completes this lecture on Infrastructure as Code. Go ahead and close this lecture, and we'll see you shortly in the next one.
Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).