SlideShare una empresa de Scribd logo
1 de 30
Infrastructure as code
usingTerraform
Hello!
I am Harkamal Singh
I enjoy AWS, DevOps, Solutions architecture, data analytics
I code in Python and Go
@harkamals
Stop!
 Who are you
 Systems, developer, .. languages, favorite code editor
 Experience with cloud platforms
 Why are you here
 It’s a safe zone, so feel free to ask questions anytime
Poll
Q: How long does it take to request a virtual machine ?
.. and load balancer, database, then deploy application stack
.. and repeat it for development, staging, production
Put it into perspective
 SpaceX launches a rocket every 4 weeks
Agenda
 Why
 State of things
 Terraform
 Getting started
 Advanced concepts
Why
 Build infrastructure automagically
 Ensure consistent repeatable deployment
 Reuse existing configurations
 Increase your productivity
 Learn for your job
 As a developer, ship complete code to deploy infrastructure stack
and the application.
 Iterate faster, fail fast.
 Stay ahead of the curve
State of things
 Current infrastructure deployments
 Manually managed
 Manually deployed or ad-hoc scripted
 No history or context
 Only few understand end to end
 Out of date runbooks
 Configuration drift
State of things
 What is Infrastructure as code
 Automate creation and maintenance resources (servers, load
balancers, volumes, databases, middleware etc.)
 Build from source control, no manual changes !!
 Ensure testability
Infrastructure is described using a high-level configuration syntax.
This allows a blueprint of your datacenter to be versioned and treated
as you would any other code.
Write and execute code to define, deploy and update infrastructure.
 Tooling
 Terraform, by Hashicorp
 Libraries – boto3, fog, apache libcloud
 Ansible, chef, puppet,CFengine
 AWS Cloud formation
State of things
 Imperative
 Traditional control flow programming
 Build the logic
 Python, java, c++, …
 Declarative
 JSON-like files
 Define the outcomes, not how it should be done
 Dependency management
 Graphing
 Immutable; everything is disposable
State of things
 DevOps 2017 report
 24x faster to recover from failures
 50% less time to find issues
 200x more deploys
 2.2x developer happiness
Enter
Terraform
 Terraform is a tool for building, changing, and versioning
infrastructure safely and efficiently.
 As the configuration changes,Terraform is able to determine what
changed and create incremental execution plans which can be
applied.
 Cloud agnostic
 JSON like syntax, HCL (.tf file extension)
 https://www.terraform.io/docs/configuration/syntax.html
 Standalone binary, written in Golang, cross-platform
 Leader in Infra-as-code space, 11,000+ stars on github
 Open source
 Very active development cycle
 You can contribute or submit issues, feature requests
 https://github.com/hashicorp/terraform
Example:
Declarative
code
#Create a new RHEL74 virtual machine onAWS
# https://www.terraform.io/docs/providers/aws/r/instance.html
provider "aws” {
region = ”eu-west-1"
}
resource "aws_instance” ”vm1” {
ami = "ami-c90195b0"
instance_type = "t2.micro"
tags {
Name = "HelloWorld”
costcentre = “307100”
}
}
Example:
Declarative
code
#Create a new RHEL74 virtual machine onAWS
# https://www.terraform.io/docs/providers/aws/r/instance.html
provider "aws” {
region = ”eu-west-1"
}
resource "aws_key_pair” “ssh_key” {
key_name = "deployer-key"
public_key = "ssh-rsa .. 2xwWdhXmXSrbX8ZbabVohBK41"
}
resource "aws_instance” ”vm1” {
ami = "ami-c90195b0"
instance_type = "t2.micro”
key_name = “${aws_key_pair.ssh_key}”
tags {
Name = "HelloWorld”
costcentre = “307100”
}
}
Example:
Dependency
management
# https://www.terraform.io/docs/commands/graph.html
$ terraform graph
Example:
Providers
A provider is responsible for understandingAPI interactions and exposing resources.
Providers generally are an IaaS (e.g. AWS, GCP, Microsoft Azure, OpenStack), PaaS (e.g. Heroku), or
SaaS services (e.g.Terraform Enterprise, DNSimple,CloudFlare).
https://www.terraform.io/docs/providers
Demo time!
Download terraform: https://www.terraform.io/downloads.html
Terraform: init
Terraform:
validate
Terraform:
plan
Terraform:
apply
Terraform:
apply
Terraform:
show
AWS console
view
Terraform:
destroy
AWS console
view
IDESupport
(optional but
essential)
IntelliJ, PyCharm: full featured IDE extension for auto-completion, syntax highlighting, code snippets,
validation, formatting etc.
AWS billing
Pitfalls
Terraform:
advanced
topics
 State files
 Saves current state in a file (s3, consul, etcd, local)
 Applies diff from current state to apply changes
 Provisioners
 Run local or remove scripts as part of resource creation or deletion.
 Can be used to bootstrap, cleanup before destroy
 Pre-post custom actions
 Modules
 DRY – don’t repeat yourself
 Reuseable, ex: postgres db instance or s3 bucket
What’s next
 Terraform is cool, isn’t it !
 Learning resources
 Terraform – up and running (ebook)
 Pluralsight (online training)
 https://www.terraform.io/docs/
 https://terraformbook.com

Más contenido relacionado

La actualidad más candente

Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowAnton Babenko
 
Advanced Discussion on Cloud Formation
Advanced Discussion on Cloud FormationAdvanced Discussion on Cloud Formation
Advanced Discussion on Cloud FormationHenry Huang
 
Understanding AWS with Terraform
Understanding AWS with TerraformUnderstanding AWS with Terraform
Understanding AWS with TerraformKnoldus Inc.
 
Microsoft Azure IaaS and Terraform
Microsoft Azure IaaS and TerraformMicrosoft Azure IaaS and Terraform
Microsoft Azure IaaS and TerraformAlex Mags
 
Apache Superset at Airbnb
Apache Superset at AirbnbApache Superset at Airbnb
Apache Superset at AirbnbBill Liu
 
Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Codemotion
 
Managing AWS infrastructure using CloudFormation
Managing AWS infrastructure using CloudFormationManaging AWS infrastructure using CloudFormation
Managing AWS infrastructure using CloudFormationAnton Babenko
 
Using Terraform to manage the configuration of a Cisco ACI fabric.
Using Terraform to manage the configuration of a Cisco ACI fabric.Using Terraform to manage the configuration of a Cisco ACI fabric.
Using Terraform to manage the configuration of a Cisco ACI fabric.Joel W. King
 
Best Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformBest Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformDevOps.com
 
Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...
Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...
Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...Codemotion
 
Infrastructure as code with Terraform
Infrastructure as code with TerraformInfrastructure as code with Terraform
Infrastructure as code with TerraformSam Bashton
 
Aws atlanta march_2015
Aws atlanta march_2015Aws atlanta march_2015
Aws atlanta march_2015Adam Book
 
AWS Cloud Formation
AWS Cloud Formation AWS Cloud Formation
AWS Cloud Formation Adam Book
 
Building infrastructure with Terraform (Google)
Building infrastructure with Terraform (Google)Building infrastructure with Terraform (Google)
Building infrastructure with Terraform (Google)Radek Simko
 
Case Study: Using Terraform and Packer to deploy go applications to AWS
Case Study: Using Terraform and Packer to deploy go applications to AWSCase Study: Using Terraform and Packer to deploy go applications to AWS
Case Study: Using Terraform and Packer to deploy go applications to AWSPatrick Bolduan
 

La actualidad más candente (20)

Terraform in action
Terraform in actionTerraform in action
Terraform in action
 
Building infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps Krakow
 
Terraform
TerraformTerraform
Terraform
 
Terraform
TerraformTerraform
Terraform
 
Advanced Discussion on Cloud Formation
Advanced Discussion on Cloud FormationAdvanced Discussion on Cloud Formation
Advanced Discussion on Cloud Formation
 
Understanding AWS with Terraform
Understanding AWS with TerraformUnderstanding AWS with Terraform
Understanding AWS with Terraform
 
Microsoft Azure IaaS and Terraform
Microsoft Azure IaaS and TerraformMicrosoft Azure IaaS and Terraform
Microsoft Azure IaaS and Terraform
 
Apache Superset at Airbnb
Apache Superset at AirbnbApache Superset at Airbnb
Apache Superset at Airbnb
 
Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...
 
Managing AWS infrastructure using CloudFormation
Managing AWS infrastructure using CloudFormationManaging AWS infrastructure using CloudFormation
Managing AWS infrastructure using CloudFormation
 
Using Terraform to manage the configuration of a Cisco ACI fabric.
Using Terraform to manage the configuration of a Cisco ACI fabric.Using Terraform to manage the configuration of a Cisco ACI fabric.
Using Terraform to manage the configuration of a Cisco ACI fabric.
 
Best Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with TerraformBest Practices of Infrastructure as Code with Terraform
Best Practices of Infrastructure as Code with Terraform
 
Terraform
TerraformTerraform
Terraform
 
Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...
Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...
Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...
 
Infrastructure as code with Terraform
Infrastructure as code with TerraformInfrastructure as code with Terraform
Infrastructure as code with Terraform
 
Aws atlanta march_2015
Aws atlanta march_2015Aws atlanta march_2015
Aws atlanta march_2015
 
Terraform
TerraformTerraform
Terraform
 
AWS Cloud Formation
AWS Cloud Formation AWS Cloud Formation
AWS Cloud Formation
 
Building infrastructure with Terraform (Google)
Building infrastructure with Terraform (Google)Building infrastructure with Terraform (Google)
Building infrastructure with Terraform (Google)
 
Case Study: Using Terraform and Packer to deploy go applications to AWS
Case Study: Using Terraform and Packer to deploy go applications to AWSCase Study: Using Terraform and Packer to deploy go applications to AWS
Case Study: Using Terraform and Packer to deploy go applications to AWS
 

Similar a Infrastructure as code, using Terraform

Continuous Deployment with Amazon Web Services by Carlos Conde
Continuous Deployment with Amazon Web Services by Carlos Conde Continuous Deployment with Amazon Web Services by Carlos Conde
Continuous Deployment with Amazon Web Services by Carlos Conde Codemotion
 
PHP Buildpacks in the Cloud on Bluemix
PHP Buildpacks in the Cloud on BluemixPHP Buildpacks in the Cloud on Bluemix
PHP Buildpacks in the Cloud on BluemixIBM
 
Cloud Foundry for PHP developers
Cloud Foundry for PHP developersCloud Foundry for PHP developers
Cloud Foundry for PHP developersDaniel Krook
 
DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...
DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...
DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...DevOpsDays Riga
 
AWS re:Invent 2016: Deploying and Managing .NET Pipelines and Microsoft Workl...
AWS re:Invent 2016: Deploying and Managing .NET Pipelines and Microsoft Workl...AWS re:Invent 2016: Deploying and Managing .NET Pipelines and Microsoft Workl...
AWS re:Invent 2016: Deploying and Managing .NET Pipelines and Microsoft Workl...Amazon Web Services
 
[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...
[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...
[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...Ludovic Piot
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowKaxil Naik
 
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & Packer
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & PackerLAMP Stack (Reloaded) - Infrastructure as Code with Terraform & Packer
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & PackerJan-Christoph Küster
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesYevgeniy Brikman
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAmazon Web Services
 
The other Apache Technologies your Big Data solution needs
The other Apache Technologies your Big Data solution needsThe other Apache Technologies your Big Data solution needs
The other Apache Technologies your Big Data solution needsgagravarr
 
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...NETWAYS
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitDanilo Poccia
 
Azure deployments and ARM templates
Azure deployments and ARM templatesAzure deployments and ARM templates
Azure deployments and ARM templatesgjuljo
 

Similar a Infrastructure as code, using Terraform (20)

Continuous Deployment with Amazon Web Services by Carlos Conde
Continuous Deployment with Amazon Web Services by Carlos Conde Continuous Deployment with Amazon Web Services by Carlos Conde
Continuous Deployment with Amazon Web Services by Carlos Conde
 
TIAD : Automating the modern datacenter
TIAD : Automating the modern datacenterTIAD : Automating the modern datacenter
TIAD : Automating the modern datacenter
 
PHP Buildpacks in the Cloud on Bluemix
PHP Buildpacks in the Cloud on BluemixPHP Buildpacks in the Cloud on Bluemix
PHP Buildpacks in the Cloud on Bluemix
 
Cloud Foundry for PHP developers
Cloud Foundry for PHP developersCloud Foundry for PHP developers
Cloud Foundry for PHP developers
 
DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...
DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...
DevOpsDaysRiga 2018: Anton Babenko - What you see is what you get… for AWS in...
 
AWS re:Invent 2016: Deploying and Managing .NET Pipelines and Microsoft Workl...
AWS re:Invent 2016: Deploying and Managing .NET Pipelines and Microsoft Workl...AWS re:Invent 2016: Deploying and Managing .NET Pipelines and Microsoft Workl...
AWS re:Invent 2016: Deploying and Managing .NET Pipelines and Microsoft Workl...
 
[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...
[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...
[Capitole du Libre] #serverless -  mettez-le en oeuvre dans votre entreprise...
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache Airflow
 
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & Packer
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & PackerLAMP Stack (Reloaded) - Infrastructure as Code with Terraform & Packer
LAMP Stack (Reloaded) - Infrastructure as Code with Terraform & Packer
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
 
Chti jug - 2018-06-26
Chti jug - 2018-06-26Chti jug - 2018-06-26
Chti jug - 2018-06-26
 
Jug - ecosystem
Jug -  ecosystemJug -  ecosystem
Jug - ecosystem
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for Government
 
The other Apache Technologies your Big Data solution needs
The other Apache Technologies your Big Data solution needsThe other Apache Technologies your Big Data solution needs
The other Apache Technologies your Big Data solution needs
 
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
OSDC 2015: Mitchell Hashimoto | Automating the Modern Datacenter, Development...
 
Running PHP In The Cloud
Running PHP In The CloudRunning PHP In The Cloud
Running PHP In The Cloud
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with Git
 
Azure deployments and ARM templates
Azure deployments and ARM templatesAzure deployments and ARM templates
Azure deployments and ARM templates
 

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Infrastructure as code, using Terraform

  • 2. Hello! I am Harkamal Singh I enjoy AWS, DevOps, Solutions architecture, data analytics I code in Python and Go @harkamals
  • 3. Stop!  Who are you  Systems, developer, .. languages, favorite code editor  Experience with cloud platforms  Why are you here  It’s a safe zone, so feel free to ask questions anytime
  • 4. Poll Q: How long does it take to request a virtual machine ? .. and load balancer, database, then deploy application stack .. and repeat it for development, staging, production Put it into perspective  SpaceX launches a rocket every 4 weeks
  • 5. Agenda  Why  State of things  Terraform  Getting started  Advanced concepts
  • 6. Why  Build infrastructure automagically  Ensure consistent repeatable deployment  Reuse existing configurations  Increase your productivity  Learn for your job  As a developer, ship complete code to deploy infrastructure stack and the application.  Iterate faster, fail fast.  Stay ahead of the curve
  • 7. State of things  Current infrastructure deployments  Manually managed  Manually deployed or ad-hoc scripted  No history or context  Only few understand end to end  Out of date runbooks  Configuration drift
  • 8. State of things  What is Infrastructure as code  Automate creation and maintenance resources (servers, load balancers, volumes, databases, middleware etc.)  Build from source control, no manual changes !!  Ensure testability Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your datacenter to be versioned and treated as you would any other code. Write and execute code to define, deploy and update infrastructure.  Tooling  Terraform, by Hashicorp  Libraries – boto3, fog, apache libcloud  Ansible, chef, puppet,CFengine  AWS Cloud formation
  • 9. State of things  Imperative  Traditional control flow programming  Build the logic  Python, java, c++, …  Declarative  JSON-like files  Define the outcomes, not how it should be done  Dependency management  Graphing  Immutable; everything is disposable
  • 10. State of things  DevOps 2017 report  24x faster to recover from failures  50% less time to find issues  200x more deploys  2.2x developer happiness
  • 11. Enter Terraform  Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently.  As the configuration changes,Terraform is able to determine what changed and create incremental execution plans which can be applied.  Cloud agnostic  JSON like syntax, HCL (.tf file extension)  https://www.terraform.io/docs/configuration/syntax.html  Standalone binary, written in Golang, cross-platform  Leader in Infra-as-code space, 11,000+ stars on github  Open source  Very active development cycle  You can contribute or submit issues, feature requests  https://github.com/hashicorp/terraform
  • 12. Example: Declarative code #Create a new RHEL74 virtual machine onAWS # https://www.terraform.io/docs/providers/aws/r/instance.html provider "aws” { region = ”eu-west-1" } resource "aws_instance” ”vm1” { ami = "ami-c90195b0" instance_type = "t2.micro" tags { Name = "HelloWorld” costcentre = “307100” } }
  • 13. Example: Declarative code #Create a new RHEL74 virtual machine onAWS # https://www.terraform.io/docs/providers/aws/r/instance.html provider "aws” { region = ”eu-west-1" } resource "aws_key_pair” “ssh_key” { key_name = "deployer-key" public_key = "ssh-rsa .. 2xwWdhXmXSrbX8ZbabVohBK41" } resource "aws_instance” ”vm1” { ami = "ami-c90195b0" instance_type = "t2.micro” key_name = “${aws_key_pair.ssh_key}” tags { Name = "HelloWorld” costcentre = “307100” } }
  • 15. Example: Providers A provider is responsible for understandingAPI interactions and exposing resources. Providers generally are an IaaS (e.g. AWS, GCP, Microsoft Azure, OpenStack), PaaS (e.g. Heroku), or SaaS services (e.g.Terraform Enterprise, DNSimple,CloudFlare). https://www.terraform.io/docs/providers
  • 16. Demo time! Download terraform: https://www.terraform.io/downloads.html
  • 26. IDESupport (optional but essential) IntelliJ, PyCharm: full featured IDE extension for auto-completion, syntax highlighting, code snippets, validation, formatting etc.
  • 29. Terraform: advanced topics  State files  Saves current state in a file (s3, consul, etcd, local)  Applies diff from current state to apply changes  Provisioners  Run local or remove scripts as part of resource creation or deletion.  Can be used to bootstrap, cleanup before destroy  Pre-post custom actions  Modules  DRY – don’t repeat yourself  Reuseable, ex: postgres db instance or s3 bucket
  • 30. What’s next  Terraform is cool, isn’t it !  Learning resources  Terraform – up and running (ebook)  Pluralsight (online training)  https://www.terraform.io/docs/  https://terraformbook.com