terraform demo


adam meghji


Co-Founder and CTO at @universe

Entrepreneur & hacker.
Passionate about DevOps & APIs


kyle white

 
Senior Software Developer at @universe

Pyrotechnic & installation artist.
Passionate about DevOps &  APIs
 

     


Create an event and sell tickets within minutes       


 


Mobile ticketing with at-the-door payments

           

 

 
Joined Ticketmaster in 2015!

  • Incredible AWS community 
  • #aws internal Slack channel, 150 people!!!!!
  • AWS "Community of Practice" internal meetups
  • Amazing group of brilliant engineers



today's QUESTION


How can we build, change, and version
our cloud infrastructure safely and efficiently?

THE OLD WAY ...

console.aws.amazon.com + 1,000,000 mouse clicks 

THE OLD WAY ...

console.aws.amazon.com + 1,000,000 mouse clicks 


PROBLEMATIC!

  • ad hoc, unscripted mouse clicks
  • error-prone +  tedious
  • immediately changes infrastructure
  • imperative
  • unversioned

THE OLD WAY ...

aws cli tools
 

THE OLD WAY ...

aws cli tools


PROBLEMATIC!

  • requires non-trivial scripting
  • immediately changes infrastructure 
  • imperative
  • unversioned

THE OLD WAY ...

cloudformation + json 
 

THE OLD WAY ...

cloudformation + json


not bad! BUT ..

  • verbose JSON syntax
  • immediately changes infrastructure
  • exclusive to AWS
  • feature support can lag behind API

a better way?


terraform!


INFRASTRUCTURE AS CODE


BENEFITS:

          
  • simple DSL which describes infrastructure
  • declarative
  • dependency-aware
  • stateful & idempotent
  • thriving community: 12h to add features

THE NEW WAY ...


terraform!

 


MULTIPLE PROVIDERS

  • AWS, DigitalOcean, Google Cloud, etc.
  • Rundeck, Docker, etc.
  • CloudFlare, MailGun, etc.


MULTIPLE PROVISIONERS

  • Chef, SSH remote-exec, local-exec          

THE NEW WAY ...


terraform!

      

EVOLVE YOUR INFRASTRUCTURE


BENEFITS:

          
  • state file committed to git
  • DSL is self-documenting   
  • supports variables (great for configuration)
  • supports ENV (great for secrets)
  • PRO TIP: add a Makefile


LIVE DEMO!

terraform makefile


TERRAFORM Base.tf


ADD 5 EC2 INSTANCES


add a load balancer


ADD A DNS RECORD


DEMO SOURCE!



github.com/adammeghji/terraform-demo

TERRAFORM @ UNIVERSE


Provisions autoscaling clusters of app servers
and background job workers in production.

  • ELB: listeners, health checks, advanced settings
  • Route53: CNAME, A, ELB aliases
  • ELB Volumes
  • EC2 Security Groups
  • EC2 Launch Configurations
  • EC2 AutoScaling Groups
  • EC2 user-data.sh → provision via Chef Solo

LIMITATIONS

  • some AWS features are not supported
    (i.e. AWS API Gateway)
    (covers 99% of what you need)

  •  state file can result in git merge conflicts
    if 2+ people applying changes simultaneously
    (paid Atlas service addresses this)


QUESTIONS


happy hacking :)


https://universe.com

@AdamMeghji
adam@universe.com
Made with Slides.com