Infrastructure as Code (IaC): Introduction to scripted infrastructure
Dec. 27, 2020•0 likes
0 likes
Be the first to like this
Show More
•116 views
views
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Download to read offline
Report
Technology
An introduction into Infrastructure as Code (scripted infrastructure), covering pros/cons, building, deploying and managing templates.
Michael Pearce, DevOps Engineer @ Peak AI.
Contents
1. What is IaC
2. What is IaC good for… or not
3. How to use IaC
a. Tools
b. Organising templates
c. Structure
d. Key functions
● Infrastructure (represented) As Code / Scripted Infrastructure / Programmable Infrastructure
● Descriptive model, in a machine-readable definition - Templates
● Create and Manage Infra (networks, virtual machines, load balancers, connection topology
etc.)
What is IaC
What is it good for!?
Go to www.menti.com and use
the code 86 54 83 to add your
thoughts!
Benefits of IaC (1)
Repeatable, Reusable &
Scalable
Standardisation Predictable
Infrastructure As Code | peak.ai
Benefits of IaC (2)
Version Control Safer change
management
Reduced Cost
Infrastructure As Code | peak.ai
Downsides of IaC (1)
New skills required Planning often gets
skipped
Errors can be repeated
too!
Infrastructure As Code | peak.ai
Downsides of IaC (2)
Stack drift Accidental destruction! It can still get messy -
Rollbacks, Maintenance etc.
Infrastructure As Code | peak.ai
Tools
Puppet / Chef
Ansible
Terraform
Cloud agnostic software
Terraform syntax
ARM / CloudFormation / CDK
Infrastructure As Code | peak.ai
Automation and Configuration
Master / Node
JSON recipes
Agentless IT automation (SSH)
Ansible Playbooks
Azure and AWS specific template formats
JSON / JSON or YAML
Cloud Development Kit - script your infra in a
familiar language like java, python, typescript and
c#
“”
Tools alone won’t transform and
organisation,
you need to change the mindset of
the team.
11
(organise it like it’s software)
Organising templates
Smaller the better!
Separate concerns
Example -
● Frontend services
● Backend services
● Shared services
● Base Network
● Identity and Access Management
You may also separate a CI/CD pipeline and the main infrastructure
These same templates should be used multiple times for different
environments, accounts, regions etc.
Infrastructure As Code | peak.ai
Exporting / Importing
Rather than hard code mappings or inputting them manually we
can Export and Import values.
But this can also leave undesired complications when you are new
to it.
Infrastructure As Code | peak.ai
Testing
We know how to test other languages.. How do we test infra?
Sometimes we have to try it for real!
Use a sandbox - good check of repeatability.
Template validation - cfn-lint
Infrastructure As Code | peak.ai
Iterate
Things can get messy, especially when deploying a new stack
from scratch. Cloud Formation is a pain when the first create
fails…
Start simple!
Then add more resources as you go along.
Infrastructure As Code | peak.ai
Deletion Policy Attribute
Keep things like S3 bucket or RDS cluster after stack deletion
Could save the day in case of accidents! (But also consider Stack
Protection)