Terraform has gained a lot in popularity lately and is the tool you need to master if you are or about to get into a Ops / DevOps role. You typically use a technology like Ansible, Chef, or Puppet to automate the provisioning of software. Terraform starts from the same principle, infrastructure as code, but focusses on the automation of the infrastructure itself. Your whole Cloud infrastructure (instances, volumes, networking, IPs) can be described in terraform.
In this course you’ll learn how to use terraform to automate your infrastructure. I will first show you the basics of terraform and will then explain how to automate infrastructure on AWS using terraform. You can open an AWS account for free to do the labs. I also provide a lot of code examples which you can immediately use to automate your own infrastructure.
Update (Oct-2016):
- Added AWS Autoscaling lectures
- Added Terraform+Packer Jenkins integration lectures
- Added Terraform with Docker on AWS (ECR and ECS)
- Added Terraform with Jenkins workflow using ECR and ECS
Update (Dec-2016):
- Added a lecture about useful terraform commands
- Added a demo on how to use terraform show/graph/taint/untaint/import
- Added a lecture and demo about Elastic Beanstalk on AWS
Update (Jun-2018):
- Terraform for Windows setup + puttygen
- Interpolation
- Conditionals
- Built-in functions
- Module development with an ECS + ALB module demo
- Setting up a hosted Kubernetes cluster using AWS EKS
This course includes english captions.
Course Introduction
Contains useful information for this course
Introduction to terraform
Introduction to what terraform is.
An explanation of how to install terraform on Windows / MacOS / Linux
An alternative installation procedure using Vagrant. This will allow you to use exactly the same setup I have!
Terraform basics
First steps in terraform: learn how to spin up your first instance
First steps in terraform: learn how to spin up your first instance
Summary of the first steps in terraform
Test your knowledge
Terraform basics
How to use variables in terraform
A demo of how to use variables in terraform
Provision software on your instance using chef / ansible / puppet / shell scripts.
A demo to show you how to provision software using a shell script
In this demo I'll show you how to use WinRM to provision a Windows Server
Using outputs in terraform you can output information on screen
A demo showing how outputs work
The terraform.tfstate can be stored remotely. This helps collaboration when using Terraform within a team.
This demo shows how to store the remote terraform state in an S3 bucket. By changing a few flags you can also use it to save it to a consul cluster.
You can use datasources to retrieve external information like AWS IP addresses, AMI IDs, and so on.
A demo using the AWS Region IP ranges to create a security group that only allows access from eu-west-1 and eu-central-1 in AWS.
You can use a template provider in terraform to render templates into strings
There's more than just AWS in terraform. An overview of other providers.
An overview on how to use modules in terraform
A demo showing you how to use external modules. This demo will launch a full consul cluster using an external terraform module
An overview of useful terraform commands
A demo of a few useful terraform commands, including terraform show, terraform graph, terraform import, terraform taint, terraform untaint
Test your knowledge!
Terraform with AWS
An introduction to AWS VPCs (Virtual Private Cloud) - Part 1
An introduction to AWS VPCs (Virtual Private Cloud) - Part 2
An introduction to AWS VPCs (Virtual Private Cloud) - Part 3
A demo showing you how to launch a VPC with an internet gateway and a NAT gateway
Now that we have created our VPC, we can launch EC2 instances in the VPC
This is a demo showing you how to launch instances within a VPC
Test your knowledge!
This lecture shows you how to use EBS (Elastic Block Storage) with an instance
This demo shows you how to attach EBS volumes to EC2 instances
Userdata can be used to execute commands at launch time
In this demo userdata will be used to format and mount an EBS volume if no filesystem is present. This way EBS volumes can be persisted in an automated way when the instance needs replacement.
This lecture explains the difference between private static IPs, EIPs and DNS (Route53)
This demo shows how to use Route53 to create DNS zones in AWS
This lecture explains how to spin up an RDS (relational database service) instance with terraform on AWS
In this demo I will spin up an RDS instance (using RDS subnets, RDS parameter groups, and security groups) and will connect from an EC2 instance to MariaDB..
IAM stands for Identity & Access Management. In this lecture I explain the different possibilities for access management. I explain users, groups, policies, and roles.
In this demo I create a group with an AWS group policy and attach it to a user.
IAM roles can be used to assume (temporary) access. In this lecture I explain how this works.
IAM roles can be used to assume (temporary) access. In this lecture I show you how to attach a role to an EC2 instance that will give permissions to read/write to an S3 bucket.
A lecture explaining how to setup autoscaling in AWS using terraform
A demo of autoscaling using terraform on AWS
Introduction into Elastic Load Balancers and Application Load Balancers in AWS
This lecture explains how to use ELBs in terraform with a static list of instances and an autoscaling group
A demo showing how to use terraform with an ELB together with autoscaling
An introduction of how the Application Load Balancer (ALB) works in terraform
ElasticBeanstalk (AWS's PaaS solution) setup using Terraform
ElasticBeanstalk (AWS's PaaS solution) setup demo using Terraform
Test your knowledge!
Advanced Terraform Usage
Packer
With packer AMIs can be created that can be used to launch an EC2 instance.
Packer can be integrated with terraform. This workflow shows how to create a workflow where packer creates the AMI and terraform launches the EC2 instance with the correct AMI ID
Where does Terraform fit in the DevOps organization? In this lecture I show you an example workflow with terraform, packer and jenkins
This demo shows a full cycle of an app in github, the building of a custom AMI with packer in Jenkins and the provisioning and deployment with Terraform
Test your knowledge
Docker on AWS using ECS and ECR
This lectures gives an introduction of Docker
This lecture explains how to use Docker on AWS using terraform
This lecture shows how to build docker images that can be pushed on ECR
In this demo I show how to push a docker built image to ECR
This lecture explains part I of the setup of ECS using terraform, with autoscaling and IAM roles
This lecture explains part II of the setup of ECS using terraform, with autoscaling, IAM roles, ECS task definitions and ECS Service definitions
This demo shows you how to run the pushed NodeJS app on ECS
In this demo I show you how to run a Jenkins workflow to build docker images, push the image to ECR, and use terraform to update ECS with the latest docker image
Module Development
AWS EKS (hosted Kubernetes)
Course Completion
Course Completion lecture