SlideShare a Scribd company logo
1 of 27
Download to read offline
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

What's hot

AWS and Disaster Recovery - Bixler
AWS and Disaster Recovery - BixlerAWS and Disaster Recovery - Bixler
AWS and Disaster Recovery - BixlerAmazon Web Services
 
AWS Office Hours: Disaster Recovery
AWS Office Hours: Disaster RecoveryAWS Office Hours: Disaster Recovery
AWS Office Hours: Disaster RecoveryAmazon Web Services
 
AWS Summit Stockholm 2014 – T3 – disaster recovery on AWS
AWS Summit Stockholm 2014 – T3 – disaster recovery on AWSAWS Summit Stockholm 2014 – T3 – disaster recovery on AWS
AWS Summit Stockholm 2014 – T3 – disaster recovery on AWSAmazon Web Services
 
Disaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
Disaster Recovery Sites on AWS: Minimal Cost, Maximum EfficiencyDisaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
Disaster Recovery Sites on AWS: Minimal Cost, Maximum EfficiencyAmazon Web Services
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeMartin Schütte
 
Disaster Recovery with the AWS Cloud
Disaster Recovery with the AWS CloudDisaster Recovery with the AWS Cloud
Disaster Recovery with the AWS CloudAmazon Web Services
 
Disaster Recovery, Continuity of Operations, Backup, and Archive on AWS | AWS...
Disaster Recovery, Continuity of Operations, Backup, and Archive on AWS | AWS...Disaster Recovery, Continuity of Operations, Backup, and Archive on AWS | AWS...
Disaster Recovery, Continuity of Operations, Backup, and Archive on AWS | AWS...Amazon Web Services
 
Disaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
Disaster Recovery Sites on AWS: Minimal Cost, Maximum EfficiencyDisaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
Disaster Recovery Sites on AWS: Minimal Cost, Maximum EfficiencyAmazon Web Services
 
Best Practices for Architecting Cloud Backup and Recovery Solutions - AWS Mar...
Best Practices for Architecting Cloud Backup and Recovery Solutions - AWS Mar...Best Practices for Architecting Cloud Backup and Recovery Solutions - AWS Mar...
Best Practices for Architecting Cloud Backup and Recovery Solutions - AWS Mar...Amazon Web Services
 
Backup and Archiving in the AWS Cloud
Backup and Archiving in the AWS CloudBackup and Archiving in the AWS Cloud
Backup and Archiving in the AWS CloudAmazon Web Services
 
AWS Webcast - How to Migrate On-premise NAS Storage to Cloud NAS Storage
AWS Webcast - How to Migrate On-premise NAS Storage to Cloud NAS StorageAWS Webcast - How to Migrate On-premise NAS Storage to Cloud NAS Storage
AWS Webcast - How to Migrate On-premise NAS Storage to Cloud NAS StorageAmazon Web Services
 
Terraform modules and some of best-practices - March 2019
Terraform modules and some of best-practices - March 2019Terraform modules and some of best-practices - March 2019
Terraform modules and some of best-practices - March 2019Anton Babenko
 
Aws disaster recovery
Aws disaster recoveryAws disaster recovery
Aws disaster recoveryBipeen Sinha
 
Building a Just-in-Time Application Stack for Analysts
Building a Just-in-Time Application Stack for AnalystsBuilding a Just-in-Time Application Stack for Analysts
Building a Just-in-Time Application Stack for AnalystsAvere Systems
 
Autoscaling Spark on AWS EC2 - 11th Spark London meetup
Autoscaling Spark on AWS EC2 - 11th Spark London meetupAutoscaling Spark on AWS EC2 - 11th Spark London meetup
Autoscaling Spark on AWS EC2 - 11th Spark London meetupRafal Kwasny
 
Aws disaster recovery
Aws disaster recoveryAws disaster recovery
Aws disaster recoveryBipeen Sinha
 

What's hot (20)

AWS and Disaster Recovery - Bixler
AWS and Disaster Recovery - BixlerAWS and Disaster Recovery - Bixler
AWS and Disaster Recovery - Bixler
 
AWS Office Hours: Disaster Recovery
AWS Office Hours: Disaster RecoveryAWS Office Hours: Disaster Recovery
AWS Office Hours: Disaster Recovery
 
AWS Webcast - Disaster Recovery
AWS Webcast - Disaster RecoveryAWS Webcast - Disaster Recovery
AWS Webcast - Disaster Recovery
 
AWS Summit Stockholm 2014 – T3 – disaster recovery on AWS
AWS Summit Stockholm 2014 – T3 – disaster recovery on AWSAWS Summit Stockholm 2014 – T3 – disaster recovery on AWS
AWS Summit Stockholm 2014 – T3 – disaster recovery on AWS
 
Disaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
Disaster Recovery Sites on AWS: Minimal Cost, Maximum EfficiencyDisaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
Disaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
 
Terraform
TerraformTerraform
Terraform
 
Terraform -- Infrastructure as Code
Terraform -- Infrastructure as CodeTerraform -- Infrastructure as Code
Terraform -- Infrastructure as Code
 
Disaster Recovery with the AWS Cloud
Disaster Recovery with the AWS CloudDisaster Recovery with the AWS Cloud
Disaster Recovery with the AWS Cloud
 
Terraform
TerraformTerraform
Terraform
 
Disaster Recovery, Continuity of Operations, Backup, and Archive on AWS | AWS...
Disaster Recovery, Continuity of Operations, Backup, and Archive on AWS | AWS...Disaster Recovery, Continuity of Operations, Backup, and Archive on AWS | AWS...
Disaster Recovery, Continuity of Operations, Backup, and Archive on AWS | AWS...
 
Disaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
Disaster Recovery Sites on AWS: Minimal Cost, Maximum EfficiencyDisaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
Disaster Recovery Sites on AWS: Minimal Cost, Maximum Efficiency
 
Best Practices for Architecting Cloud Backup and Recovery Solutions - AWS Mar...
Best Practices for Architecting Cloud Backup and Recovery Solutions - AWS Mar...Best Practices for Architecting Cloud Backup and Recovery Solutions - AWS Mar...
Best Practices for Architecting Cloud Backup and Recovery Solutions - AWS Mar...
 
Backup and Archiving in the AWS Cloud
Backup and Archiving in the AWS CloudBackup and Archiving in the AWS Cloud
Backup and Archiving in the AWS Cloud
 
AWS Webcast - How to Migrate On-premise NAS Storage to Cloud NAS Storage
AWS Webcast - How to Migrate On-premise NAS Storage to Cloud NAS StorageAWS Webcast - How to Migrate On-premise NAS Storage to Cloud NAS Storage
AWS Webcast - How to Migrate On-premise NAS Storage to Cloud NAS Storage
 
Terraform modules and some of best-practices - March 2019
Terraform modules and some of best-practices - March 2019Terraform modules and some of best-practices - March 2019
Terraform modules and some of best-practices - March 2019
 
Aws disaster recovery
Aws disaster recoveryAws disaster recovery
Aws disaster recovery
 
Terraform Concepts
Terraform ConceptsTerraform Concepts
Terraform Concepts
 
Building a Just-in-Time Application Stack for Analysts
Building a Just-in-Time Application Stack for AnalystsBuilding a Just-in-Time Application Stack for Analysts
Building a Just-in-Time Application Stack for Analysts
 
Autoscaling Spark on AWS EC2 - 11th Spark London meetup
Autoscaling Spark on AWS EC2 - 11th Spark London meetupAutoscaling Spark on AWS EC2 - 11th Spark London meetup
Autoscaling Spark on AWS EC2 - 11th Spark London meetup
 
Aws disaster recovery
Aws disaster recoveryAws disaster recovery
Aws disaster recovery
 

Similar to Managing AWS Using Terraform AWS Atlanta 2018-07-18

Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02
Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02
Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02Derek Ashmore
 
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...Derek Ashmore
 
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06Derek Ashmore
 
Terraform best-practices-and-common-mistakes-dev ops-west-2021
Terraform best-practices-and-common-mistakes-dev ops-west-2021Terraform best-practices-and-common-mistakes-dev ops-west-2021
Terraform best-practices-and-common-mistakes-dev ops-west-2021Derek Ashmore
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with TerraformTim Berry
 
AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019
AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019
AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019Derek Ashmore
 
Aws lambda best practices - ignite - dev opsdays-charlotte
Aws lambda   best practices - ignite - dev opsdays-charlotteAws lambda   best practices - ignite - dev opsdays-charlotte
Aws lambda best practices - ignite - dev opsdays-charlotteDerek Ashmore
 
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019Derek Ashmore
 
AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019
AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019
AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019Derek Ashmore
 
RIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxRIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxMrJustbis
 
Infrastructure as code with terraform and packer
Infrastructure as code with terraform and packerInfrastructure as code with terraform and packer
Infrastructure as code with terraform and packerAlex Landa
 
AWS Community Day - Derek C. Ashmore - AWS Lambda: Best Practices
AWS Community Day  - Derek C. Ashmore - AWS Lambda: Best Practices AWS Community Day  - Derek C. Ashmore - AWS Lambda: Best Practices
AWS Community Day - Derek C. Ashmore - AWS Lambda: Best Practices AWS Chicago
 
AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019
AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019
AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019Derek Ashmore
 
Terraform: Infrastructure as Code
Terraform: Infrastructure as CodeTerraform: Infrastructure as Code
Terraform: Infrastructure as CodePradeep Bhadani
 
Better Practices when Using Terraform to Manage Oracle Cloud Infrastructure
Better Practices when Using Terraform to Manage Oracle Cloud InfrastructureBetter Practices when Using Terraform to Manage Oracle Cloud Infrastructure
Better Practices when Using Terraform to Manage Oracle Cloud InfrastructureSimon Haslam
 
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018Amazon Web Services
 
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...Cloudera, Inc.
 
Terrraform meet Oracle Cloud: Platform Provisioning Automation
Terrraform meet Oracle Cloud: Platform Provisioning AutomationTerrraform meet Oracle Cloud: Platform Provisioning Automation
Terrraform meet Oracle Cloud: Platform Provisioning AutomationSimon Haslam
 

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

Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02
Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02Microservices with Terraform, Docker and the Cloud. JavaOne 2017 2017-10-02
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. Chicago Coders Conference...Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
Microservices with Terraform, Docker and the Cloud. Chicago Coders Conference...
 
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
Microservices with Terraform, Docker and the Cloud. IJug Chicago 2017-06-06
 
Terraform best-practices-and-common-mistakes-dev ops-west-2021
Terraform best-practices-and-common-mistakes-dev ops-west-2021Terraform best-practices-and-common-mistakes-dev ops-west-2021
Terraform best-practices-and-common-mistakes-dev ops-west-2021
 
Infrastructure as Code with Terraform
Infrastructure as Code with TerraformInfrastructure as Code with Terraform
Infrastructure as Code with Terraform
 
AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019
AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019
AWS Lambda: Best Practices and Common Mistakes - Dev Ops West 2019
 
Aws lambda best practices - ignite - dev opsdays-charlotte
Aws lambda   best practices - ignite - dev opsdays-charlotteAws lambda   best practices - ignite - dev opsdays-charlotte
Aws lambda best practices - ignite - dev opsdays-charlotte
 
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2019
 
AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019
AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019
AWS Lambda: Best Practices and Common Mistakes - DevOps East 2019
 
RIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptxRIMA-Infrastructure as a code with Terraform.pptx
RIMA-Infrastructure as a code with Terraform.pptx
 
Infrastructure as code with terraform and packer
Infrastructure as code with terraform and packerInfrastructure as code with terraform and packer
Infrastructure as code with terraform and packer
 
AWS Community Day - Derek C. Ashmore - AWS Lambda: Best Practices
AWS Community Day  - Derek C. Ashmore - AWS Lambda: Best Practices AWS Community Day  - Derek C. Ashmore - AWS Lambda: Best Practices
AWS Community Day - Derek C. Ashmore - AWS Lambda: Best Practices
 
AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019
AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019
AWS Lambda: Best Practices and Common Mistakes - AWS Community Days 2019
 
Terraform: Infrastructure as Code
Terraform: Infrastructure as CodeTerraform: Infrastructure as Code
Terraform: Infrastructure as Code
 
Better Practices when Using Terraform to Manage Oracle Cloud Infrastructure
Better Practices when Using Terraform to Manage Oracle Cloud InfrastructureBetter Practices when Using Terraform to Manage Oracle Cloud Infrastructure
Better Practices when Using Terraform to Manage Oracle Cloud Infrastructure
 
Hadoop Operations
Hadoop OperationsHadoop Operations
Hadoop Operations
 
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
Linux Container Primitives and Runtimes (CON407-R1) - AWS re:Invent 2018
 
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
Simplifying Hadoop with RecordService, A Secure and Unified Data Access Path ...
 
Terrraform meet Oracle Cloud: Platform Provisioning Automation
Terrraform meet Oracle Cloud: Platform Provisioning AutomationTerrraform meet Oracle Cloud: Platform Provisioning Automation
Terrraform meet Oracle Cloud: Platform Provisioning Automation
 
Terraform training 🎒 - Basic
Terraform training 🎒 - BasicTerraform training 🎒 - Basic
Terraform training 🎒 - Basic
 

Recently uploaded

MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 

Recently uploaded (20)

MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 

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