Slide 1

Slide 1 text

Dive in IAC (Infrastructure as Code) Noah.Lee

Slide 2

Slide 2 text

References - https://www.terraform.io/ - https://www.packer.io/ - https://cloudonaut.io/cloudformation-vs-terraform/

Slide 3

Slide 3 text

Index 1. What is Devops? 2. What is IAC (Infrastructure as code)? 3. What is benefit? 4. Why Terraform? 5. How to Adjust Buzzvil? 6. Cons of Terraform? 7. What to do next?

Slide 4

Slide 4 text

1. What is Devops? - Move to cloud (e.g. AWS, Azure and Google cloud). - Ops team spending all their time working on software. (e.g Chef, Puppet, Terraform and Docker) - To automate as much of the software process.

Slide 5

Slide 5 text

2. What is IAC (Infrastructure As Code) Goal - Write and execute code to define, deploy and update your infrastructure - Treat all aspects of operations as software - even those aspects that represent hardware (e.g, setting up physical servers) Four categories of IAC tools - AD hoc script - Configuration management tools - Server templating tools - Server provisioning tools

Slide 6

Slide 6 text

2. What is IAC (Infrastructure As Code) 1) AD hoc script - Straightforward approach to automating anything to write - e.g boto3

Slide 7

Slide 7 text

2. What is IAC (Infrastructure As Code) 2) Configuration management tool - Coding conventions - Idempotence - Distribution - e.g stack.py

Slide 8

Slide 8 text

2. What is IAC (Infrastructure As Code) 3) Server Templating Tools - An alternative to configuration management that has been growing in popularity - To create an image of a server that captures a fully self-contained “snapshot”. - e.g Packer

Slide 9

Slide 9 text

2. What is IAC (Infrastructure As Code) 4) Server Provisioning Tools - Provisioning tools to not only servers, but also databases, caches, load balancers, subnet, firewall settings, routing rules and almost every aspect - No in Buzzvil

Slide 10

Slide 10 text

3. What is benefits? What is difficult? - Click button on AWS console can make a mistake - Understand the structure of infrastructure is so hard - No History - Do the same job repeatedly

Slide 11

Slide 11 text

3. What is benefits? - Speed and safety - Documentation - Version control - Validation - Reuse - Happiness

Slide 12

Slide 12 text

4. Why Terraform Versus Procedural Language - How to achieve some desired end state e.g) create 15 instances

Slide 13

Slide 13 text

4. Why Terraform Versus CloudFormation (AWS) Pros - Handle Existing Resource ( Import existing resource ) - Verify changes ( Terraform presents a detailed and readable summary of the changes ) - Scope ( Support other cloud providers and 3rd party ) Cons - Wait condition ( No wait condition for service ) - No rolling update for Auto Scaling group

Slide 14

Slide 14 text

5. How to adjust Buzzvil Create redis instance task STEP 1. Build AMI Image STEP 2. AD hoc script Create Instance STEP 3. Master - Slave with SSH

Slide 15

Slide 15 text

5. How to adjust Buzzvil Disk Full Error …

Slide 16

Slide 16 text

5. How to adjust Buzzvil Disk Full Error … Method create_instace is used for creating many kinds of instance. In this error, parameter must to be “volume_size = 200”

Slide 17

Slide 17 text

5. How to adjust Buzzvil - BuzzAd, BuzzScreen redis has same spec ( Reuse ), only different AMI image.

Slide 18

Slide 18 text

5. How to adjust Buzzvil - Show relation Master - Slave - Set Master - Slave, after created redises automatically

Slide 19

Slide 19 text

6. Cons of Terraform Cons - Wait condition ( Service ) - No rollback for Auto scaling group Resolution Harmony with Kubernetes , Terraform control static resource (e.g VPC, Subnet, EIP, Security_group …)

Slide 20

Slide 20 text

7. What to do next? Terraform state - S3: share state - Dynamo: lock

Slide 21

Slide 21 text

7. What to do next? - Import existing resource to Terraform - Harmony with Kubernetes - Make module for reuse - Provisioning with Ansible

Slide 22

Slide 22 text

Thanks to Zune, Liam, Andy