AWS Summit Auckland - Application Delivery Patterns for Developers

42
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Shiva Narayanaswamy, Solution Architect, Amazon Web Services Nick Walker, Systems Engineer, Vend Application Delivery Patterns for Developers Technical 401

Transcript of AWS Summit Auckland - Application Delivery Patterns for Developers

Page 1: AWS Summit Auckland - Application Delivery Patterns for Developers

© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

Shiva Narayanaswamy, Solution Architect, Amazon Web Services

Nick Walker, Systems Engineer, Vend

Application Delivery Patterns for

Developers

Technical 401

Page 2: AWS Summit Auckland - Application Delivery Patterns for Developers

Business

101 Technical

201 Technical

301 Technical

401 Technical

Session Depth

Page 3: AWS Summit Auckland - Application Delivery Patterns for Developers

Agenda: Application Delivery Patterns

• Why?

• What?

• How?

• The Vend Journey

• What the…?

• X Commandments

• What next?

Page 4: AWS Summit Auckland - Application Delivery Patterns for Developers

Mission Statement

Deliver better features to customers, quickly, securely,

more reliably, and cheaper.

http://www.space.com/images/i/000/034/954/original/blue-origin-test-fires-new-rocket-engine-3.jpg

Page 5: AWS Summit Auckland - Application Delivery Patterns for Developers

Deliver “Hello World”

package main

import “fmt”

func main() {

fmt.Printf(“Hello, World.\n”)

}

#!/path/to/python

print “Hello World!”

using System;

using System.Collections.Generic;

using System.Text;

namespace ConsoleApplication1 {

class Program {

static void Main(string[] args) {

Console.WriteLine("Hello, world!");

Console.ReadLine()

}

}

}

#!/path/to/ruby

puts "Hello World!";

var http = require('http');

http.createServer(function (request, response) {

response.writeHead(200, {'Content-Type': 'text/plain'});

response.end('Hello World\n');

}).listen(8080);

Page 6: AWS Summit Auckland - Application Delivery Patterns for Developers

Development LifecycleREPOSITORY

PM SYSTEM

CI SYSTEM

DEVELOPER

LOOKUP

TASKS

SUBMIT

CODE

SCHEDULE BUILD

AUTOMATIC

BUILD

BUILD

RESULTS

BUILD

ARTEFACTS

CLOUDFORMATION,

PUPPET,

CHEF,

ANSIBLE.

CONTAINERS,

AMIs

EXE, MSI,

RPM, DEB,

ZIP, TAR

Page 7: AWS Summit Auckland - Application Delivery Patterns for Developers

Delivery LifecycleREPOSITORY

PM SYSTEM

DEPLOYMENT

SYSTEM

DEVELOPER

LOOKUP

TASKS

SUBMIT

CODE

SCHEDULE BUILD

BUILD /

ARTEFACTS

BUILD

RESULTS

CI SYSTEM

ENVIRONMENTS

SYSTEST

PRE-PROD

PRODUCTIONDEPLOYMENT

RESULTS

DEPLOYMENT

CONFIG

TRIGGER A

PUSH / PULL

Page 8: AWS Summit Auckland - Application Delivery Patterns for Developers

Delivery LifecycleREPOSITORY

PM SYSTEM

DEPLOYMENT

SYSTEM

DEVELOPER

LOOKUP

TASKS

SUBMIT

CODE

SCHEDULE BUILD

BUILD /

ARTEFACTS

BUILD

RESULTS

CI SYSTEM

ENVIRONMENTS

SYSTEST

PRE-PROD

PRODUCTIONDEPLOYMENT

RESULTS

DEPLOYMENT

CONFIG

ATOMIC UNIT OF DELIVERY

FUNCTIONAL CODE

UNIT TESTS

API

BUILD CONFIG

RUNTIME CONFIG

INFRASTRUCTURE CODE

DELIVERY PIPELINE

PUSH / PULL

Page 9: AWS Summit Auckland - Application Delivery Patterns for Developers

PUSH / PULL

Delivery LifecycleREPOSITORY

PM SYSTEM

DEPLOYMENT

SYSTEM

DEVELOPER

LOOKUP

TASKS

SUBMIT

CODE

SCHEDULE BUILD

BUILD /

ARTEFACTS

BUILD

RESULTS

CI SYSTEM

ENVIRONMENTS

SYSTEST

PRE-PROD

PRODUCTIONDEPLOYMENT

RESULTS

DEPLOYMENT

CONFIG

ATOMIC UNIT OF

DEPLOYMENT

DEPLOYABLE ARTEFACT

API

TEST SCRIPTS

BUILD CONFIG

RUNTIME CONFIG

INFRASTRUCTURE CODE

DELIVERY PIPELINE

ENVIRONMENT CONFIG

SECURITY CONFIG

MONITORING CONFIG

BACKUP CONFIG

AVAILABILITY CONFIG

SLA CONFIG

Page 10: AWS Summit Auckland - Application Delivery Patterns for Developers

Application Deployment Patterns

Arbitrary Snowflakes Periodic deployments Blue Green Deployments

Canary Deployment Dark Launch /

Feature ToggleEnvironment Promotion

Page 11: AWS Summit Auckland - Application Delivery Patterns for Developers

Orchestrate Delivery with Pipelines

A pipeline models your release process as a series of stages that promote

changes along a set of environments into the hands of your customers.

A pipeline is a model of your standard procedure for deploying software.

Page 12: AWS Summit Auckland - Application Delivery Patterns for Developers

Pipeline

Stage

Action

Pipeline

Run

Source change

• starts a run; and

• creates an artifact to be used by other actions.

Manual trigger

Stage transition

Parallel Actions

Pipeline Concepts – AWS CodePipeline

Page 13: AWS Summit Auckland - Application Delivery Patterns for Developers

Characteristics of a Good Pipeline

Fast Feedback Validation IdempotentSecureDesired State

Consistency

Roll Forward API Driven Visualisation ExtensibleAs Code

Page 14: AWS Summit Auckland - Application Delivery Patterns for Developers

Pipeline Design

Blockers

Simple Integral Security

Metrics Driven

Chained

Andon Cord Process Events

Loosely Coupled

Corollary to Conways Law :

Your pipelines design will be a copy of your organization's communication structure.

Page 15: AWS Summit Auckland - Application Delivery Patterns for Developers

Pipeline Metrics

• Number of Builds

• Number of Deployments

• Average Time For Changes to Reach Production

• Average Time From First Pipeline Stage to Each Stage

• Number of Changes Reaching Production

• Average Build Time

Page 16: AWS Summit Auckland - Application Delivery Patterns for Developers

Let us Deliver a Polyglot BeastPacker/Puppet/Chef scripts

Foundation SOE pipeline

Foundation SOE AMI/Container

Nginx SOE

pipeline

Java SOE

pipeline

Tomcat SOE

pipeline

Developer

SOE pipeline

Nginx SOE Java SOE Tomcat SOE Developer

Workstation

Page 17: AWS Summit Auckland - Application Delivery Patterns for Developers

Nginx SOE Java SOE Tomcat SOE HAProxy SOE

Let us Deliver a Polyglot Beast

IIS SOE

Application 1

on EC2

Application 2

on ECS

Application 3

on Beanstalk

Page 18: AWS Summit Auckland - Application Delivery Patterns for Developers
Page 19: AWS Summit Auckland - Application Delivery Patterns for Developers

Introduction to Vend

SaaS Point-of-Sale, Ecommerce and

Reporting

18,000+ retail stores in 150+ countries

I’m part of the Platform team - we’re

responsible for internal dev platform

Page 20: AWS Summit Auckland - Application Delivery Patterns for Developers

Pipeline Goals / Metrics

We try to release features as fast as possible, while limiting risk and retaining quality

Important metrics:

Developer Velocity

Release Quality

Developer Happiness

Page 21: AWS Summit Auckland - Application Delivery Patterns for Developers

What Slows Developers Down?

Fear of breaking things

Application complexity and coupling

Constantly re-inventing the wheel

Page 22: AWS Summit Auckland - Application Delivery Patterns for Developers

Vend Deployment Pipeline

Push to GitHub

Build container

Run unit tests

Run integration tests (against other containers)

Deploy to AWS ECS if master

Page 23: AWS Summit Auckland - Application Delivery Patterns for Developers

Containerisation

Start shaping the unit of testing and deployment

Forces developers to think about interfaces and

bounded contexts

Makes it easier to create development and test

environments

Page 24: AWS Summit Auckland - Application Delivery Patterns for Developers

Standardisation

Containers without a sprinkle of best

practices are a recipe for disaster

Developers have to learn “this is how we do

things in this service!”

Our early containerisation approach - great

for Dev, terrible for Ops

Page 25: AWS Summit Auckland - Application Delivery Patterns for Developers

What we Standardised

Authentication

Logging

Configuration Injection

Request Routing

Monitoring

Page 26: AWS Summit Auckland - Application Delivery Patterns for Developers

Request Routing

Our routing layer handles API requests from

the edge to port on a container

Authentication, Authorisation and Rate Limiting

all handled

Common libraries in a few languages to parse

authentication tokens

Page 27: AWS Summit Auckland - Application Delivery Patterns for Developers

Container Configuration

Standardised config directory location

Bake development configuration into

the container

Container platform mounts volume over

the top of the config directory

Page 28: AWS Summit Auckland - Application Delivery Patterns for Developers

Feature Management

Simple conditional around a “risky” piece of

code

Control the conditional by some external

process

Decouples deployment from feature

releases - less nervous developers!

if (hasFeature("new_thing")) {

// New code path

} else {

// Old path

}

Page 29: AWS Summit Auckland - Application Delivery Patterns for Developers

Feature Management Rules

Feature true/false can be driven by a set of

rules, considering the context of the user

- Percentage of all customers

- Time (n customers per y time)

- Account Size / Value

- Market / Region

- Opt in attributes

Page 30: AWS Summit Auckland - Application Delivery Patterns for Developers

Monitoring Service Health and Usage

Is my service up? Is it logging errors?

Statsd, Kibana, Redash

Are people using it in the way that I

expect?

We should check that our assumptions

about user behaviour are correct

Page 31: AWS Summit Auckland - Application Delivery Patterns for Developers

We’re Still Improving

Docker Compose / Docker for Mac instead

of Vagrant

Automated service discovery

Dynamic configuration instead of static

Puppet-based ones

Page 32: AWS Summit Auckland - Application Delivery Patterns for Developers

Lessons Learned

Start with a automated pipeline, optimise the slow

parts as you find them

Going down the container route? Create a “best

practices” document!

Decouple feature releases from deployment and

stage rollouts to reduce risk

Page 33: AWS Summit Auckland - Application Delivery Patterns for Developers
Page 34: AWS Summit Auckland - Application Delivery Patterns for Developers

Salutations to the Demo Gods

BuildKite

Page 35: AWS Summit Auckland - Application Delivery Patterns for Developers

Application Delivery from Outer Space

Cost Aware Serverless

Shared Experience Observer PatternThrottles

Location Aware

Page 36: AWS Summit Auckland - Application Delivery Patterns for Developers

Some Tools

AWS Codepipeline BuildKite

Page 37: AWS Summit Auckland - Application Delivery Patterns for Developers

Commandments for Application Delivery

I. Acknowledge time. Version control everything

II. Be the master of your dependencies

III. Externalising configurations shall set you free

IV. Don’t be a prisoner of state

V. Loosely couple

VI. Audits that don’t kill you, make you stronger

VII. Everyone sees everything, all the time

VIII. Measure success

IX. Continuous practice

X. Own your Destiny, end to end

Page 38: AWS Summit Auckland - Application Delivery Patterns for Developers

How Do I Start?

THINK BIG

START SMALL

ACT NOW

Page 39: AWS Summit Auckland - Application Delivery Patterns for Developers

AWS Training & Certification

Intro Videos & Labs

Free videos and labs to

help you learn to work

with 30+ AWS services

– in minutes!

Training Classes

In-person and online

courses to build

technical skills –

taught by accredited

AWS instructors

Online Labs

Practice working with

AWS services in live

environment –

Learn how related

services work

together

AWS Certification

Validate technical

skills and expertise –

identify qualified IT

talent or show you

are AWS cloud ready

Learn more: aws.amazon.com/training

Page 40: AWS Summit Auckland - Application Delivery Patterns for Developers

Your Training Next Steps:

Visit the AWS Training & Certification pod to discuss your

training plan & AWS Summit training offer

Register & attend AWS instructor led training

Get Certified

AWS Certified? Visit the AWS Summit Certification Lounge to pick up your swag

Learn more: aws.amazon.com/training

Page 41: AWS Summit Auckland - Application Delivery Patterns for Developers
Page 42: AWS Summit Auckland - Application Delivery Patterns for Developers

Thank You!