[Knowledge Edition] Coding of infrastructure configuration. Learn the concept of "infrastructure as code" to make configuration management smarter.
My name is Teraoka and I am an infrastructure engineer.
The theme of this blog is here ⇒ infrastructure as code
When I was thinking about what to write, it became longer than I expected, so I decided to divide it into a knowledge section and a technical section.
First, the knowledge section. What is infrastructure as code I'll summarize it from here.
■What is "infrastructure as code"?
In short, it means coding
the infrastructure configuration (It's just as it is, Google Translate is also surprising.) Cloud services such as AWS are mainstream these days, so
building new infrastructure or changing infrastructure can be done by clicking a button from the GUI screen, but
infrastructure as code , you can't do that. I don't.
Infrastructure is built by
writing everything as code like a program and There is a special tool called "terraform", so
I will introduce it in the technical section! (I will write about it on my blog later)
■Why do we “code” it in the first place?
You don't go out of your way to do something like this even though there's no benefit to it. (There are benefits)
To summarize, it is as follows ↓
Automation of infrastructure construction
Isn't this the biggest advantage?
When you need to build multiple servers with the same configuration,
there are many things you have to do twice if you do it manually.
Do I have to repeat the exact same task for each server? I don't want to do that if possible.
In the previous section, I wrote the following:
Infrastructure is built by writing everything as "code" like a program and
The configuration "I'm going to create an infrastructure configuration like this" has already been written in code, so
all you have to do is ask the specialized tool to "create it like this." Everything else will be done automatically.
, you can always get the same results
no matter who does the work This also prevents human error .
Centralized management of infrastructure configurations
When building a new infrastructure or making changes,
it is necessary to keep a record of what the structure is and when and which parts were changed.
(It's called a design document or a procedure manual.)
If you don't leave it behind, you won't know what the current structure is.
(Obviously, if you don't understand this, an operational error will occur.)
Also, if you want to keep design documents and procedure manuals,
you need to update the documents with the latest information whenever you perform any work.
You will refer to that document the next time you perform the same task.
However, since it is done manually by humans, mistakes are inevitable.
It's easy to forget to update your documentation.
When this happens, the content of the document and the actual structure become somehow different.
the person who last updated the document was my predecessor and has already left the site,
I would be disappointed...
With
infrastructure as code , since the infrastructure is built based on a procedure manual that has been created in the form of code in advance,
it is necessary to edit the code when changing settings , so there is no chance of forgetting to update it.
also possible to perform version control using Git etc. in the same way as program sources .
■Convenient but has some concerns
Naturally, the cost of learning will increase
If you can't write code, you can't change the configuration in the first place.
You will also need to learn new ways to use the tools for deployment.
I think this will increase the cost of learning.
Will we come to a time when infrastructure engineers will not be able to do their jobs unless they can write code?
An unexpected error occurs due to the code.
If there is a mistake in the code, it will stop with an error. (It's the same as programming languages.)
It's bad for your mental health to deploy when there are mistakes, so
by sharing the code on Github, you can prevent knowledge from becoming individualized and
always check for mistakes through the eyes of a third party. I think you need an operational flow that makes you aware of it.
■Summary
To be honest, in the knowledge section, I just read long texts (
I think it's an attractive idea if you can properly understand the mechanism and operate it.
Above all, the sound of "infrastructure as code" is cool.
...That's all for the jokes, next time we'll talk about the technical aspects, so let's get our hands dirty. Look forward to it! !