SlideShare a Scribd company logo
Managing AWS using Terraform
Given by Derek C. Ashmore
AWS Atlanta
July 18, 2018
©2018 Derek C. Ashmore, All Rights Reserved 1
Who am I?
‱ Professional Geek
since 1987
‱ Java/J2EE/Java EE
since 1999
‱ AWS since 2010
‱ Specialties
‱ Cloud
Workshops
‱ Cloud-native
Applications
‱ Yes – I still code!
©2018 Derek C. Ashmore, All Rights Reserved 2
Discussion Resources
‱ This slide deck
– http://www.slideshare.net/derekashmore
‱ Example Terraform project on my GitHub
– https://github.com/Derek-Ashmore/terraform-hands-on-lab
‱ Slide deck has hyper-links!
– Don’t bother writing down URLs
©2018 Derek C. Ashmore, All Rights Reserved 3
Agenda
Introduction
Terraform
Basics
Terraform
Competitors
Terraform
with Teams
Summary /
Q&A
©2018 Derek C. Ashmore, All Rights Reserved 4
Infrastructure as Code
‱ Manual changes
– Increase errors
– Increase unwanted differences
between environments
– Increase admin workload
‱ Scripted/Coded changes
– Larger upfront cost, but
..
– Less busywork
– Leverage Others Work
– Decreases Errors
– Errors fixed in one place
– Eliminates unwanted differences
– Change history (with source control)
©2018 Derek C. Ashmore, All Rights Reserved 5
Terraform
‱ Cloud Management
– Open Source
‱ Very active community
– Extensible to any cloud vendor
‱ AWS, Azure, GCP, AliCloud, Digital Ocean, OpenStack
– Supported for Cloud Support products
‱ Chef, Consul, Kubernetes, Datadog
‱ 62 Providers as of April, 2017 and growing
©2018 Derek C. Ashmore, All Rights Reserved 6
Agenda
Introduction
Terraform
Basics
Terraform
Competitors
Terraform
with Teams
Summary /
Q&A
©2018 Derek C. Ashmore, All Rights Reserved 7
Terraform Basics
‱ Declarative Programming Paradigm
– Describe what the end product contains
‱ Terraform figures out how to get there
‱ Like SQL
– Terraform Resources
‱ Describes deployed artifacts
– Network  Virtual Networks, Subnets, Network ACLs, Gateways, ELB/ALB
– Hosts  Virtual Machines, Databases
– Security  Security groups/policies/roles/groups/users
– Much more
©2017 Derek C. Ashmore, All Rights Reserved 8
Terraform Basics (con’t)
‱ Coding Statement Order
– All *.tf files loaded  Terraform decides execution order
– No GUI  All command line and text editor
‱ Top Commands
– Terraform plan  Describes planned changes
– Terraform apply  Makes planned changes
– Terraform taint  Forces re-creation of a resource
– Terraform destroy  deletes all resources
– Terraform refresh  shows configuration drift
©2018 Derek C. Ashmore, All Rights Reserved 9
Terraform Resources
‱ AWS Subnet Resource
– Count = 3  Three subnets created
– Availability Zones come from a data source (lookup)
– CIDR blocks are input variables
‱ Sample source
©2018 Derek C. Ashmore, All Rights Reserved 10
Terraform Data Sources
‱ Example Data Sources (lookups)
‱ Sample source
©2018 Derek C. Ashmore, All Rights Reserved 11
Terraform Providers
‱ Example Provider
‱ Sample AWS source
‱ Azure Provider
©2018 Derek C. Ashmore, All Rights Reserved 12
Terraform Input Variables
‱ Example Provider
‱ Sample source
©2018 Derek C. Ashmore, All Rights Reserved 13
Reusing Terraform Templates
‱ Example Template Reuse
‱ Sample source
©2018 Derek C. Ashmore, All Rights Reserved 14
Typical Project Structure
©2018 Derek C. Ashmore, All Rights Reserved 15
Terraform State
‱ Terraform stores state
– Local file terraform.tfstate
‱ Teams need to manage state centrally
– Terraform Backends
‱ Locks so that only one person at a time can update
‱ Remote storage
– S3, Azure containers, Google cloud storage, etc.
©2018 Derek C. Ashmore, All Rights Reserved 16
Agenda
Introduction
Terraform
Basics
Terraform
Competitors
Terraform
with Teams
Summary /
Q&A
©2018 Derek C. Ashmore, All Rights Reserved 17
Terraform vs. Ansible/Chef
‱ Terraform designed for infrastructure
– Not designed for configuration management
– Terraform deploys images
‱ Not good at maintaining what’s on those images
‱ If deployments update existing VMs
– You need Ansible, Chef, or Puppet
‱ If deployments are “new” VMs
– Terraform can handle deployments too
©2018 Derek C. Ashmore, All Rights Reserved 18
Paradigm Shift
‱ Deployment as new infrastructure
– New version  new VMs
‱ Software versions baked into images
– Advantages
‱ Facilitates Canary Deployments
– Route53 Routing Policies
‱ Go-live operation has less risk
– Deploy/Backout is just a load balancer switch
– Disadvantages
‱ More moving parts
‱ Impossible to do manually
©2018 Derek C. Ashmore, All Rights Reserved 19
Terraform vs CloudFormation
Terraform
‱ Scripting skills translate to Azure,
Google Cloud, etc.
‱ Less verbose (>50%)
‱ Data Lookups
‱ Custom Plug-ins possible
‱ Active Community Support
‱ Configuration Drift Detection
(‘refresh’)
CloudFormation
‱ Quicker to follow AWS enhancements
‱ GUI support
‱ Automatic centralized state
‱ Vendor Support
©2018 Derek C. Ashmore, All Rights Reserved 20
Agenda
Introduction
Terraform
Basics
Terraform
Competitors
Terraform
with Teams
Summary /
Q&A
©2018 Derek C. Ashmore, All Rights Reserved 21
Terraform with Multiple Admins
‱ State Management
– Backends
‱ Terraform Enterprise Enhancements
– Collaboration
– Security
– Audit History
©2018 Derek C. Ashmore, All Rights Reserved 22
Managing Terraform State
‱ Terraform State
– JSON format
– File terraform.tfstate
(Default)
‱ Backend Options
– S3 Bucket
– Azure
– Terraform Enterprise
– Many more


©2018 Derek C. Ashmore, All Rights Reserved 23
Managing State using S3
‱ S3 as a Backend
– Requires bucket name, key, region
‱ Key == folder name within bucket
‱ S3:ListBucket, GetObject,
PutObject
– Supports Encryption
‱ You provide KMS key
– Locks using DynamoDB table
‱ Primary Key = LockID
– Supports Assuming IAM Role
‱ Best Practices
– Turn on versioning!
– Establish Naming Convention
‱ Clearly identify environment, terraform
project used.
– Configure back-end in
implementation projects, not re-
used modules.
©2018 Derek C. Ashmore, All Rights Reserved 24
Terraform Enterprise Add-Ons
‱ “Jenkins” for Infrastructure build-outs
– Provides non-command line UI
– Terraform runs on central server
‱ Laptop install not required
– Provides automatic audit history and output from previous runs
– User security by Workspace
– Workspaces associated with
‱ AWS Keys (integration with HashiCorp Vault)
‱ back-end configuration
©2018 Derek C. Ashmore, All Rights Reserved 25
Further Reading
‱ This slide deck
– http://www.slideshare.net/derekashmore
‱ The Gruntwork Blog
– https://blog.gruntwork.io/
©2018 Derek C. Ashmore, All Rights Reserved 26
Questions?
‱ Derek Ashmore:
– Blog: www.derekashmore.com
– LinkedIn: www.linkedin.com/in/derekashmore
‱ Connect Invites from attendees welcome
– Twitter: https://twitter.com/Derek_Ashmore
– GitHub: https://github.com/Derek-Ashmore
– Book: http://dvtpress.com/
©2018 Derek C. Ashmore, All Rights Reserved 27

More Related Content

PDF
Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18
PDF
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
PPTX
Terraform
PPTX
Terraform
PDF
Terraform @Base
PDF
Terraform
PDF
Terraform -- Infrastructure as Code
PPTX
Managing AWS Using Terraform AWS Chicago-Suburbs 2018-01-18
Microservices with Terraform, Docker and the Cloud. DevOps Wet 2018
Terraform
Terraform
Terraform @Base
Terraform
Terraform -- Infrastructure as Code

What's hot (6)

PDF
Terraform modules and some of best-practices - March 2019
PPTX
Aws disaster recovery
PPTX
Terraform Concepts
PPTX
Building a Just-in-Time Application Stack for Analysts
PPTX
Autoscaling Spark on AWS EC2 - 11th Spark London meetup
PPTX
Aws disaster recovery
Terraform modules and some of best-practices - March 2019
Aws disaster recovery
Terraform Concepts
Building a Just-in-Time Application Stack for Analysts
Autoscaling Spark on AWS EC2 - 11th Spark London meetup
Aws disaster recovery
Ad

Similar to Managing AWS Using Terraform AWS Atlanta 2018-07-18 (20)

PDF
Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02
PDF
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
PDF
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
PDF
Terraform best-practices-and-common-mistakes-dev ops-west-2021
PDF
Infrastructure as Code with Terraform
PDF
AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019
PDF
Aws lambda best practices - ignite - dev opsdays-charlotte
PPTX
Terraform Best Practices for Infrastructure Scaling
PDF
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019
PDF
AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019
PPTX
RIMA-Infrastructure as a code with Terraform.pptx
PPTX
Infrastructure as code with terraform and packer
PDF
AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019
PDF
AWS Community Day - Derek C. Ashmore - AWS Lambda: Best Practices
PDF
Terraform: Infrastructure as Code
PDF
Better Practices when Using Terraform to Manage Oracle Cloud Infrastructure
PPTX
Hadoop Operations
PPTX
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
PDF
Terrraform meet Oracle Cloud: Platform Provisioning Automation
PPTX
Terraform training 🎒 - Basic
Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Terraform best-practices-and-common-mistakes-dev ops-west-2021
Infrastructure as Code with Terraform
AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019
Aws lambda best practices - ignite - dev opsdays-charlotte
Terraform Best Practices for Infrastructure Scaling
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019
AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019
RIMA-Infrastructure as a code with Terraform.pptx
Infrastructure as code with terraform and packer
AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019
AWS Community Day - Derek C. Ashmore - AWS Lambda: Best Practices
Terraform: Infrastructure as Code
Better Practices when Using Terraform to Manage Oracle Cloud Infrastructure
Hadoop Operations
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Terrraform meet Oracle Cloud: Platform Provisioning Automation
Terraform training 🎒 - Basic
Ad

Recently uploaded (20)

PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
medical staffing services at VALiNTRY
PDF
Nekopoi APK 2025 free lastest update
PDF
AI in Product Development-omnex systems
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PPTX
history of c programming in notes for students .pptx
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
How Creative Agencies Leverage Project Management Software.pdf
Design an Analysis of Algorithms I-SECS-1021-03
Wondershare Filmora 15 Crack With Activation Key [2025
How to Choose the Right IT Partner for Your Business in Malaysia
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
CHAPTER 2 - PM Management and IT Context
medical staffing services at VALiNTRY
Nekopoi APK 2025 free lastest update
AI in Product Development-omnex systems
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
history of c programming in notes for students .pptx
How to Migrate SBCGlobal Email to Yahoo Easily
Operating system designcfffgfgggggggvggggggggg
wealthsignaloriginal-com-DS-text-... (1).pdf
L1 - Introduction to python Backend.pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...

Managing AWS Using Terraform AWS Atlanta 2018-07-18

  • 1. Managing AWS using Terraform Given by Derek C. Ashmore AWS Atlanta July 18, 2018 ©2018 Derek C. Ashmore, All Rights Reserved 1
  • 2. Who am I? ‱ Professional Geek since 1987 ‱ Java/J2EE/Java EE since 1999 ‱ AWS since 2010 ‱ Specialties ‱ Cloud Workshops ‱ Cloud-native Applications ‱ Yes – I still code! ©2018 Derek C. Ashmore, All Rights Reserved 2
  • 3. Discussion Resources ‱ This slide deck – http://www.slideshare.net/derekashmore ‱ Example Terraform project on my GitHub – https://github.com/Derek-Ashmore/terraform-hands-on-lab ‱ Slide deck has hyper-links! – Don’t bother writing down URLs ©2018 Derek C. Ashmore, All Rights Reserved 3
  • 5. Infrastructure as Code ‱ Manual changes – Increase errors – Increase unwanted differences between environments – Increase admin workload ‱ Scripted/Coded changes – Larger upfront cost, but
.. – Less busywork – Leverage Others Work – Decreases Errors – Errors fixed in one place – Eliminates unwanted differences – Change history (with source control) ©2018 Derek C. Ashmore, All Rights Reserved 5
  • 6. Terraform ‱ Cloud Management – Open Source ‱ Very active community – Extensible to any cloud vendor ‱ AWS, Azure, GCP, AliCloud, Digital Ocean, OpenStack – Supported for Cloud Support products ‱ Chef, Consul, Kubernetes, Datadog ‱ 62 Providers as of April, 2017 and growing ©2018 Derek C. Ashmore, All Rights Reserved 6
  • 8. Terraform Basics ‱ Declarative Programming Paradigm – Describe what the end product contains ‱ Terraform figures out how to get there ‱ Like SQL – Terraform Resources ‱ Describes deployed artifacts – Network  Virtual Networks, Subnets, Network ACLs, Gateways, ELB/ALB – Hosts  Virtual Machines, Databases – Security  Security groups/policies/roles/groups/users – Much more ©2017 Derek C. Ashmore, All Rights Reserved 8
  • 9. Terraform Basics (con’t) ‱ Coding Statement Order – All *.tf files loaded  Terraform decides execution order – No GUI  All command line and text editor ‱ Top Commands – Terraform plan  Describes planned changes – Terraform apply  Makes planned changes – Terraform taint  Forces re-creation of a resource – Terraform destroy  deletes all resources – Terraform refresh  shows configuration drift ©2018 Derek C. Ashmore, All Rights Reserved 9
  • 10. Terraform Resources ‱ AWS Subnet Resource – Count = 3  Three subnets created – Availability Zones come from a data source (lookup) – CIDR blocks are input variables ‱ Sample source ©2018 Derek C. Ashmore, All Rights Reserved 10
  • 11. Terraform Data Sources ‱ Example Data Sources (lookups) ‱ Sample source ©2018 Derek C. Ashmore, All Rights Reserved 11
  • 12. Terraform Providers ‱ Example Provider ‱ Sample AWS source ‱ Azure Provider ©2018 Derek C. Ashmore, All Rights Reserved 12
  • 13. Terraform Input Variables ‱ Example Provider ‱ Sample source ©2018 Derek C. Ashmore, All Rights Reserved 13
  • 14. Reusing Terraform Templates ‱ Example Template Reuse ‱ Sample source ©2018 Derek C. Ashmore, All Rights Reserved 14
  • 15. Typical Project Structure ©2018 Derek C. Ashmore, All Rights Reserved 15
  • 16. Terraform State ‱ Terraform stores state – Local file terraform.tfstate ‱ Teams need to manage state centrally – Terraform Backends ‱ Locks so that only one person at a time can update ‱ Remote storage – S3, Azure containers, Google cloud storage, etc. ©2018 Derek C. Ashmore, All Rights Reserved 16
  • 18. Terraform vs. Ansible/Chef ‱ Terraform designed for infrastructure – Not designed for configuration management – Terraform deploys images ‱ Not good at maintaining what’s on those images ‱ If deployments update existing VMs – You need Ansible, Chef, or Puppet ‱ If deployments are “new” VMs – Terraform can handle deployments too ©2018 Derek C. Ashmore, All Rights Reserved 18
  • 19. Paradigm Shift ‱ Deployment as new infrastructure – New version  new VMs ‱ Software versions baked into images – Advantages ‱ Facilitates Canary Deployments – Route53 Routing Policies ‱ Go-live operation has less risk – Deploy/Backout is just a load balancer switch – Disadvantages ‱ More moving parts ‱ Impossible to do manually ©2018 Derek C. Ashmore, All Rights Reserved 19
  • 20. Terraform vs CloudFormation Terraform ‱ Scripting skills translate to Azure, Google Cloud, etc. ‱ Less verbose (>50%) ‱ Data Lookups ‱ Custom Plug-ins possible ‱ Active Community Support ‱ Configuration Drift Detection (‘refresh’) CloudFormation ‱ Quicker to follow AWS enhancements ‱ GUI support ‱ Automatic centralized state ‱ Vendor Support ©2018 Derek C. Ashmore, All Rights Reserved 20
  • 22. Terraform with Multiple Admins ‱ State Management – Backends ‱ Terraform Enterprise Enhancements – Collaboration – Security – Audit History ©2018 Derek C. Ashmore, All Rights Reserved 22
  • 23. Managing Terraform State ‱ Terraform State – JSON format – File terraform.tfstate (Default) ‱ Backend Options – S3 Bucket – Azure – Terraform Enterprise – Many more

 ©2018 Derek C. Ashmore, All Rights Reserved 23
  • 24. Managing State using S3 ‱ S3 as a Backend – Requires bucket name, key, region ‱ Key == folder name within bucket ‱ S3:ListBucket, GetObject, PutObject – Supports Encryption ‱ You provide KMS key – Locks using DynamoDB table ‱ Primary Key = LockID – Supports Assuming IAM Role ‱ Best Practices – Turn on versioning! – Establish Naming Convention ‱ Clearly identify environment, terraform project used. – Configure back-end in implementation projects, not re- used modules. ©2018 Derek C. Ashmore, All Rights Reserved 24
  • 25. Terraform Enterprise Add-Ons ‱ “Jenkins” for Infrastructure build-outs – Provides non-command line UI – Terraform runs on central server ‱ Laptop install not required – Provides automatic audit history and output from previous runs – User security by Workspace – Workspaces associated with ‱ AWS Keys (integration with HashiCorp Vault) ‱ back-end configuration ©2018 Derek C. Ashmore, All Rights Reserved 25
  • 26. Further Reading ‱ This slide deck – http://www.slideshare.net/derekashmore ‱ The Gruntwork Blog – https://blog.gruntwork.io/ ©2018 Derek C. Ashmore, All Rights Reserved 26
  • 27. Questions? ‱ Derek Ashmore: – Blog: www.derekashmore.com – LinkedIn: www.linkedin.com/in/derekashmore ‱ Connect Invites from attendees welcome – Twitter: https://twitter.com/Derek_Ashmore – GitHub: https://github.com/Derek-Ashmore – Book: http://dvtpress.com/ ©2018 Derek C. Ashmore, All Rights Reserved 27