KEMBAR78
Creating AWS infrastructure using Terraform | PDF
Presented By: Vidushi Bansal
Creating AWS
Infrastructure using
Terraform
Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
Punctuality
Respect Knolx session timings, you
are requested not to join sessions
after a 5 minutes threshold post
the session start time.
Feedback
Make sure to submit a constructive
feedback for all sessions as it is
very helpful for the presenter.
Silent Mode
Keep your mobile devices in silent
mode, feel free to move out of
session in case you need to attend
an urgent call.
Avoid Disturbance
Avoid unwanted chit chat during
the session.
Our Agenda
01 Infrastructure as a Code
02 Imperative vs Declarative
03 Infrastructure as a Code key points
04 Why IAAC
05 Terraform
06 Terraform Components
07 Demo
What is Infrastructure as a code?
Infrastructure as Code or IaC is the process of
provisioning and managing infrastructure defined
through code, instead of doing so with a manual
process.
As infrastructure is defined as code, it allows users to
easily edit and distribute configurations while
ensuring the desired state of the infrastructure. This
means you can create reproducible infrastructure
configurations.
IMPERATIVE
Get base
Get sauce
Get cheese
# Make a Pizza
Get Toppings
Get the base ready
Add sauce to base
Add cheese
Add cheese
Add ingredients at top
Bake it
DECLARATIVE
# Make a Pizza
food “pizza” {
ingredients = [
“base”, “sauce”, “cheese”, “toppings”
]
}
Infrastructure as a Code: Core concepts
Consistency
Each time you do something the result will
be same. The infrastructure setup reduces
the possibility of oversights and decreases
the chances of incompatibility issues with
the infrastructure.
Idempotency
If we haven’t changed anything about our
configuration, and we apply it again to the
same environment, nothing will change in
our environment because our defined
configuration matches the reality of the
infrastructure that exists.
Defined in code
Stored in
source control
Declarative or
imperative
Push or Pull
Why IAAC
Automated Deployments
Consistent Environments
Repeatable Process
Reusable Components
Terraform
Terraform is an infrastructure as code (IaC) tool that
allows you to build, change, and version infrastructure
safely and efficiently. This includes low-level
components such as compute instances, storage, and
networking, as well as high-level components such as
DNS entries, SaaS features, etc. Terraform can manage
both existing service providers and custom in-house
solutions.
Terraform Components
Terraform Executable
It is a single executable written in GO
Terraform Files
It contains configuration and typically
have .tf extension
Terraform Plugins
It is used to interact with the
providers
Terraform State
It is used to maintain the state of the
configuration
output "instance_ip_addr" {
value =
aws_instance.server.private_ip
}
variable "image_id" {
type = string
}
variable
"availability_zone_names" {
type = list(string)
default = ["us-east-1a"]
}
data "aws_ami" "example" {
most_recent = true
owners = ["self"]
tags = {
Name = "app-server"
}
}
resource "aws_instance" "" {
ami = "ami-a1b2c3d4"
instance_type = "t2.micro"
}
Terraform Configuration File Components
Variables
Output Data
Resource
Providers
Terraform
Configuration
Files
provider "google" {
alias = "europe"
region = "europe-west1"
}
DEMO
Thank You !
Get in touch:
vidushi.bansal@knoldus.com

Creating AWS infrastructure using Terraform

  • 1.
    Presented By: VidushiBansal Creating AWS Infrastructure using Terraform
  • 2.
    Lack of etiquetteand manners is a huge turn off. KnolX Etiquettes Punctuality Respect Knolx session timings, you are requested not to join sessions after a 5 minutes threshold post the session start time. Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. Silent Mode Keep your mobile devices in silent mode, feel free to move out of session in case you need to attend an urgent call. Avoid Disturbance Avoid unwanted chit chat during the session.
  • 3.
    Our Agenda 01 Infrastructureas a Code 02 Imperative vs Declarative 03 Infrastructure as a Code key points 04 Why IAAC 05 Terraform 06 Terraform Components 07 Demo
  • 4.
    What is Infrastructureas a code? Infrastructure as Code or IaC is the process of provisioning and managing infrastructure defined through code, instead of doing so with a manual process. As infrastructure is defined as code, it allows users to easily edit and distribute configurations while ensuring the desired state of the infrastructure. This means you can create reproducible infrastructure configurations.
  • 5.
    IMPERATIVE Get base Get sauce Getcheese # Make a Pizza Get Toppings Get the base ready Add sauce to base Add cheese Add cheese Add ingredients at top Bake it
  • 6.
    DECLARATIVE # Make aPizza food “pizza” { ingredients = [ “base”, “sauce”, “cheese”, “toppings” ] }
  • 7.
    Infrastructure as aCode: Core concepts Consistency Each time you do something the result will be same. The infrastructure setup reduces the possibility of oversights and decreases the chances of incompatibility issues with the infrastructure. Idempotency If we haven’t changed anything about our configuration, and we apply it again to the same environment, nothing will change in our environment because our defined configuration matches the reality of the infrastructure that exists. Defined in code Stored in source control Declarative or imperative Push or Pull
  • 8.
    Why IAAC Automated Deployments ConsistentEnvironments Repeatable Process Reusable Components
  • 9.
    Terraform Terraform is aninfrastructure as code (IaC) tool that allows you to build, change, and version infrastructure safely and efficiently. This includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc. Terraform can manage both existing service providers and custom in-house solutions.
  • 10.
    Terraform Components Terraform Executable Itis a single executable written in GO Terraform Files It contains configuration and typically have .tf extension Terraform Plugins It is used to interact with the providers Terraform State It is used to maintain the state of the configuration
  • 11.
    output "instance_ip_addr" { value= aws_instance.server.private_ip } variable "image_id" { type = string } variable "availability_zone_names" { type = list(string) default = ["us-east-1a"] } data "aws_ami" "example" { most_recent = true owners = ["self"] tags = { Name = "app-server" } } resource "aws_instance" "" { ami = "ami-a1b2c3d4" instance_type = "t2.micro" } Terraform Configuration File Components Variables Output Data Resource Providers Terraform Configuration Files provider "google" { alias = "europe" region = "europe-west1" }
  • 12.
  • 13.
    Thank You ! Getin touch: vidushi.bansal@knoldus.com