Everything as Code
alican.kustemur@gmail.com
linkedin.com/in/alicankustemur
medium.com/@alicankustemur
Infrastructre as Code with Terraform on AWS
Ali Can Kustemur
💻 DevOps Engineer
Agenda
• Why is Infrastructure as Code (IaC) ?
• What is IaC ?
• Problems we had before IaC ?
• Goals of IaC
• Configuration Management vs Orchestration
• Why & What is Terraform ?
• Demo on AWS
Why is Infrastructure as Code ?
Why is Infrastructure as Code ?
AWS EC2 Schema :
Why is Infrastructure as Code ?
Big Bang
Schema :
Why is Infrastructure as Code ?
Lovely
Code :
What is IaC ?
https://www.thoughtworks.com/insights/blog/infrastructure-code-reason-smile
What is IaC ?
• Infrastructure as Code, or programmable infrastructure,
means writing code to manage configurations and automate provisioning
of infrastructure in addition to deployments.
• The basic idea is that you treat your IT infrastructure as software. This
helps you to make changes to it rapidly and easily, at the same time safely
and reliably.
https://www.thoughtworks.com/insights/blog/infrastructure-code-reason-smile
What is IaC ?
• This allows people to apply software development tools such as version
control systems (VCS), automated testing libraries, and deployment
orchestration to manage infrastructure.
• It also opens the door to exploit development practices such as test-driven
development (TDD), continuous integration (CI), and continuous delivery
(CD).
https://www.thoughtworks.com/insights/blog/infrastructure-code-reason-smile
https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
Problems we had before IAC ?
• Same Infrastructure on all environments
• Quick Deploy
• Versioning
• Immutable Infrastructure
https://www.thoughtworks.com/insights/blog/infrastructure-code-reason-smile
Goals of IaC
• IT infrastructure supports and enables change, rather than being an
obstacle or a constraint.
• Changes to the system are routine, without drama or stress for users or IT
staff.
• IT staff spends their time on valuable things that engage their abilities, not
on routine, repetitive tasks.
• Users are able to define, provision, and manage the resources they need,
without needing IT staff to do it for them.
https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
Goals of IaC
• Teams are able to easily and quickly recover from failures, rather than
assuming failure can be completely prevented.
• Improvements are made continuously, rather than done through
expensive and risky “big bang” projects.
• Solutions to problems are proven through implementing, testing, and
measuring them, rather than by discussing them in meetings and
documents.
https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
IaC is not just for Cloud
Infrastructure as code has come into its own with cloud, because it’s
difficult to manage servers in the cloud well without it. But the principles and
practices of infrastructure as code can be applied to infrastructure whether it
runs on cloud, virtualized systems, or even directly on physical hardware.
https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
Be agile !
• To properly embrace IaC, you need three things: agile
development processes, a DevOps environment and the
tools to write the code.
• Agile is necessary because IaC is all about speed.
https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
Be agile !
• Says Morris: " If you use automation tools but still
manage your infrastructure with the Iron Age approaches
to change management, you’re losing the benefit. IaC is
more reliable, particularly if you use Agile engineering
practices like test driven development, continuous
integration and continuous delivery. "
https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
Configuration Management
vs Orchestration
Why is Terraform ?
What is Terraform ?
• Write, Plan and Create Infrastructure as Code
• Execution Plans ( Actual – Desire State )
• Supports Multivendor ( AWS, Azure, GCP, OpenStack,Wmware etc.) +76
• Resource Graph
• Versioning ( Enterprise )
• Immutable Infrastructure
What is Terraform ?
https://www.slideshare.net/SushilKumar545/hashicorpterraformpackervaultby-sushil
Demo on AWS

Infrastructure as Code with Terraform on AWS

  • 1.
  • 2.
    Agenda • Why isInfrastructure as Code (IaC) ? • What is IaC ? • Problems we had before IaC ? • Goals of IaC • Configuration Management vs Orchestration • Why & What is Terraform ? • Demo on AWS
  • 3.
  • 4.
    Why is Infrastructureas Code ? AWS EC2 Schema :
  • 5.
    Why is Infrastructureas Code ? Big Bang Schema :
  • 6.
    Why is Infrastructureas Code ? Lovely Code :
  • 7.
    What is IaC? https://www.thoughtworks.com/insights/blog/infrastructure-code-reason-smile
  • 8.
    What is IaC? • Infrastructure as Code, or programmable infrastructure, means writing code to manage configurations and automate provisioning of infrastructure in addition to deployments. • The basic idea is that you treat your IT infrastructure as software. This helps you to make changes to it rapidly and easily, at the same time safely and reliably. https://www.thoughtworks.com/insights/blog/infrastructure-code-reason-smile
  • 9.
    What is IaC? • This allows people to apply software development tools such as version control systems (VCS), automated testing libraries, and deployment orchestration to manage infrastructure. • It also opens the door to exploit development practices such as test-driven development (TDD), continuous integration (CI), and continuous delivery (CD). https://www.thoughtworks.com/insights/blog/infrastructure-code-reason-smile https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
  • 10.
    Problems we hadbefore IAC ? • Same Infrastructure on all environments • Quick Deploy • Versioning • Immutable Infrastructure https://www.thoughtworks.com/insights/blog/infrastructure-code-reason-smile
  • 11.
    Goals of IaC •IT infrastructure supports and enables change, rather than being an obstacle or a constraint. • Changes to the system are routine, without drama or stress for users or IT staff. • IT staff spends their time on valuable things that engage their abilities, not on routine, repetitive tasks. • Users are able to define, provision, and manage the resources they need, without needing IT staff to do it for them. https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
  • 12.
    Goals of IaC •Teams are able to easily and quickly recover from failures, rather than assuming failure can be completely prevented. • Improvements are made continuously, rather than done through expensive and risky “big bang” projects. • Solutions to problems are proven through implementing, testing, and measuring them, rather than by discussing them in meetings and documents. https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
  • 13.
    IaC is notjust for Cloud Infrastructure as code has come into its own with cloud, because it’s difficult to manage servers in the cloud well without it. But the principles and practices of infrastructure as code can be applied to infrastructure whether it runs on cloud, virtualized systems, or even directly on physical hardware. https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
  • 14.
    Be agile ! •To properly embrace IaC, you need three things: agile development processes, a DevOps environment and the tools to write the code. • Agile is necessary because IaC is all about speed. https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
  • 15.
    Be agile ! •Says Morris: " If you use automation tools but still manage your infrastructure with the Iron Age approaches to change management, you’re losing the benefit. IaC is more reliable, particularly if you use Agile engineering practices like test driven development, continuous integration and continuous delivery. " https://www.safaribooksonline.com/library/view/infrastructure-as-code/9781491924334/ch01.html
  • 17.
  • 18.
  • 19.
    What is Terraform? • Write, Plan and Create Infrastructure as Code • Execution Plans ( Actual – Desire State ) • Supports Multivendor ( AWS, Azure, GCP, OpenStack,Wmware etc.) +76 • Resource Graph • Versioning ( Enterprise ) • Immutable Infrastructure
  • 20.
    What is Terraform? https://www.slideshare.net/SushilKumar545/hashicorpterraformpackervaultby-sushil
  • 21.

Editor's Notes

  • #4 ÖNCE ALTYAPI OLARAK KOD'A NEDEN İHTİYAÇ DUYDUK. BUNDAN BAHSEDELİM. DİYELİM Kİ ŞİRKETİNİZDE Kİ UYGULAMALARI SAAS OLARAK SAĞLAMAK İSTİYORSUNUZ.
  • #5 EC2 İÇİN: - SECURITY GROUP ( FIREWALL ) - STORAGE İÇİN EBS VOLUME - DEFAULT VPC - AVAILABILITY ZONE - SSH PRIVATE KEY
  • #6 İŞTE BU YAPIYI MANUEL OLARAK YÖNETMENİZ OLDUKÇA ZOR VE STRESLİ OLACAKTIR. BİRDEN FAZLA VPC, AVAILABILITY ZONE, LBLER, PUBLIC VE PRIVATE SUBNETLER, SG RULES, INTERNET VE NAT GATEWAYLER
  • #7 TERRAFORM KODU.
  • #8 KIEF MORRIS DER KI: ALTYAPIYI KOD OLARAK ETKİNLEŞTİRME FİKRİ, YAZILIMI ÇALIŞTIRMAK İÇİN KULLANILAN SİSTEM VE AYGITLARIN KENDİLERİ GİBİ YANİ BİR YAZILIM GİBİ ELE ALINABİLMESİDİR.
  • #18 ÖNCE ALTYAPI OLARAK KOD'A NEDEN İHTİYAÇ DUYDUK. BUNDAN BAHSEDELİM. DİYELİM Kİ ŞİRKETİNİZDE Kİ UYGULAMALARI SAAS OLARAK SAĞLAMAK İSTİYORSUNUZ.
  • #19 ÖNCE ALTYAPI OLARAK KOD'A NEDEN İHTİYAÇ DUYDUK. BUNDAN BAHSEDELİM. DİYELİM Kİ ŞİRKETİNİZDE Kİ UYGULAMALARI SAAS OLARAK SAĞLAMAK İSTİYORSUNUZ.