Infrastructure as code (IaC) is a method to create and manage infrastructure resources like servers, networks, storage, load balancers, and others, using descriptive code. Instead of using manual steps, the desired infrastructure configuration is represented as code inside files (sometimes called "configuration files"). These files serve as a model for the IaC tools which read the instructions inside and create the infrastructure.
This method provides multiple benefits in terms of speed, cost, and reliability. It allows faster deployments by removing manual steps that would take a much longer time and using an automated way instead, that quickly provisions and configures the infrastructure. It saves a lot of time and effort freeing up teams to work on other tasks, hence reducing costs for the business. IaC provides more reliability by reducing errors in configuration that can happen more often with manual steps. It makes creating the infrastructure a repeatable error-free task as no human error is introduced.
Amazon Web Services (AWS) is a public cloud environment that enables an on-demand self-service model for provisioning resources that can be used instantly by clients. AWS offers a wide variety of services including servers, networking, storage, serverless functions, security tools, databases, and others.
Users can request any resource/service and it gets created as fast as possible. They will only pay for the time they are using it. Or for the number of requests sent to this resource. In other cases, they'll pay for the amount of data used or transferred. Either way, when the resource/service is not needed anymore, the users can delete it to stop paying for an unnecessary component. This can provide a better and more cost-effective model than buying on-premise infrastructure and paying all the costs of the hardware and setup, upfront.
To manually create resources, users can navigate the online interface provided by AWS. Basically, buttons, menus, text boxes on a web page. The users can interact with those to specify how they want to configure their infrastructure. But APIs (Application Programming Interfaces) are also supported. Programs can connect to the API to interact with AWS directly, thus eliminating the need for manual human interaction. And IaC tools are one example of programs using APIs to tell AWS what it should do.
Crossplane is a modern IaC tool that is deployed on a Kubernetes cluster to enable it to become a universal control plane for creating infrastructure resources external to the cluster. Using Crossplane, you can manage infrastructure resources on a cloud platform like AWS in the same way you manage Kubernetes resources.
For example, you declare the resource you need on AWS, something like an RDS, VPC, or EC2 instance, using a normal YAML file with all the specifications you want for it. Then you deploy this to Kubernetes using standard kubectl commands. Next, it’s up to the Kubernetes controllers and packages that Crossplane installed on the cluster, to understand this resource specification and communicate with AWS to create it as desired.
And you know how Kubernetes can self-heal? When something deviates from the user-intended configuration, it can self-correct. With Crossplane, this ability is extended to infrastructure as well. For example, maybe you created a YAML file to create a database instance on AWS with 64GB of RAM. And then an employee uses the AWS web page, and accidentally modifies this to have 32GB of RAM. Crossplane can detect that and fix it, switching it back to an instance with 64GB of RAM.
Crossplane + AWS Playground
In this Playground you’re provided with the following :
Using this Playground you’re ready to start working with Crossplane on AWS and create your infrastructure resources through Kubernetes. All you need is a KodeKloud Pro subscription and you’ll have access to this Playground through your web browser.