advanced infrastructure as code: building modular, dynamic aws cloudformation stacks

24
Advanced Infrastructure as Code Building Dynamic, Modular AWS CloudFormation Stacks Thomas “T-Rex” Rectenwald Senior Systems Engineer, DevOps Logicworks www .logicworks.net ©2016 Logicworks. All Rights Reserved.

Upload: amazon-web-services

Post on 12-Jan-2017

379 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

Advanced Infrastructure as CodeBuilding Dynamic, Modular AWS CloudFormation Stacks

Thomas “T-Rex” RectenwaldSenior Systems Engineer, DevOpsLogicworks

www.logicworks.net

©2016 Logicworks. All Rights Reserved.

Page 2: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

About Logicworks

We design, build, automate, and manage cloud infrastructure for enterprise IT.

Cloud Strategy & Migration

Managed Cloud

Cloud Security

DevOps Automation

©2016 Logicworks. All Rights Reserved. 2

Page 3: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

The days when IT managed monolithic, infrequently modified

systems are long gone.

©2014 Logicworks. All Rights Reserved. 3

Page 4: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

How to efficiently manage multiple stacks?

Manage infrastructure as code.

©2014 Logicworks. All Rights Reserved. 4

Page 5: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

What is Infrastructure as Code?

©2016 Logicworks. All Rights Reserved. 5

✗✔• State machine• Versioned• Essential part of

deployment process

• One-off• Just a quick way

to script an environment

Page 6: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

IaC is youngAWS CloudFormation is awesome but unforgivingRisk of over-engineering and assuming a perfect worldIaC implemented incorrectly can be dangerous

Stack Anarchy

©2016 Logicworks. All Rights Reserved. 6

Page 7: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

Agenda

©2016 Logicworks. All Rights Reserved. 7

① AWS CloudFormationFundamentals② Advanced Best Practices

▪ Stack Organization▪ Naming Conventions▪ Blast Radius

③ Creating a ServiceCatalog④Dynamic AWS CloudFormation & Beyond

Page 8: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

Build network foundationConfigure gateways and access points

Install management services, like Puppet

Allocate Amazon S3buckets

Attach encrypted volumesControl and manage access though AWS Identity & Access

Management (IAM)

Register DNS names with Amazon Route 53

Configure logshipping and retention

① AWS CloudFormation Fundamentals

©2016 Logicworks. All Rights Reserved. 8

WHAT CLOUDFORMATION DOES:

Page 9: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

② Best Practices: Stack Organization

©2016 Logicworks. All Rights Reserved. 9

QA Stage Production

ASGs

Security Groups

Layered Architecture

Instances ELBsVarious

Substacks

Page 10: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

② Best Practices: Stack Organization

©2016 Logicworks. All Rights Reserved. 10

Instances, ASGs, ELBs,

etc.

Service Oriented Architecture

Networks(VPCs, routes, subnets, etc.)

Security Groups

IAM(Global

Resource)

Page 11: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

② Best Practices: Naming Conventions

©2016 Logicworks. All Rights Reserved. 11

Page 12: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

② Best Practices: Stack Organization

QA

©2016 Logicworks. All Rights Reserved. 12

Stage Production

ASGs

Security Groups

Instances ELBsVarious

Substacks✗Layered Architecture

Page 13: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

② Best Practices: Stack Organization

ASGs

Security Groups

Instances ELBsVarious

Substacks✗Q✗A

S✗tag

e

Prod✗uction

Layered Architecture

©2016 Logicworks. All Rights Reserved. 13

Page 14: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

② Best Practices: Blast Radius

Instances,

©2016 Logicworks. All Rights Reserved. 14

ASGs, ELBs,etc.

Networks(VPCs, routes, subnets, etc.)

Security Groups

IAM(Global

Resource)✗Service Oriented Architecture

Page 15: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

③ Service Catalog

High Performance Multi-Region

PCI Compliant Template

Secu

rity

/Co

mpl

ianc

e

Low Cost Non-Compliant

Development Template

Performance / Availability

AWS Service Catalog

©2016 Logicworks. All Rights Reserved. 15

Page 16: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

(Isn’t it time we stopped worrying about this stuff?)

③ Service Catalog: Too Much to Manage?

Route Tables

©2016 Logicworks. All Rights Reserved. 16

Load Balancers

Security Groups

VPCs

Subnets

Access Policies

S3 Bucket Policies

IAMRoles

DRInstances

Page 17: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

③ Service Catalog: Framework

©2016 Logicworks. All Rights Reserved. 17

AWS CloudFormation is the right medium,

but is it the righttool?

What you really need:a framework

Page 18: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

④ Dynamic CloudFormation: Troposphere

The Goal: Generate JSON, do not develop in it.

• Use a real programming language not a data format

• Enjoy variables, libraries, easy integration into CI/CD

• Infrastructure as an Application

©2016 Logicworks. All Rights Reserved. 18

Page 19: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

Troposphere Demo

©2016 Logicworks. All Rights Reserved. 19

Page 20: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

④ Dynamic CloudFormation: SparkleFormation

©2016 Logicworks. All Rights Reserved. 20

Page 21: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

④ Dynamic CloudFormation: “Beyond”

AWS CloudFormation

©2016 Logicworks. All Rights Reserved. 21

Page 22: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

The Big Picture: Dynamic CloudFormation

Static Templates

Dynamic Program Instruction

Function-Based Programming

</HTML>

AWSCloudFormation

SparkleFormation Troposphere AWS Lambda

©2016 Logicworks. All Rights Reserved. 22

Page 23: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

1. Build templates, not snowflakes2. Create central management & governance by making

templates available in self-service fashion to product teams3. Investigate new, more flexible abstraction layers to manage

multiple templates

©2016 Logicworks. All Rights Reserved. 23

Summary: What to Do Now

Page 24: Advanced Infrastructure as Code: Building Modular, Dynamic AWS CloudFormation Stacks

Questions?

©2015 Logicworks. All Rights Reserved.

Thomas “T-Rex” Rectenwald Logicworks www.logicworks.net

Visit Logicworks’ Booth #433 for more information on AWS Managed Services