Slide 1

Slide 1 text

Delivering High-Availability Web Services with NGINX Plus on AWS Owen Garrett Nginx, Inc. Scott Ward Amazon Web Services

Slide 2

Slide 2 text

Introduc)ons  and  Agenda   •  Owen  Garre3   Head  of  Products,  NGINX   •  Sco3  Ward   Solu)ons  Architect,  Amazon  Web  Services  

Slide 3

Slide 3 text

Introducing Amazon Web Services

Slide 4

Slide 4 text

A broad and deep platform that helps customers build sophisticated, scalable applications ©  2014  Amazon.com,  Inc.  and  its  affiliates.  All  rights  reserved.  May  not  be  copied,  modified  or  distributed  in  whole  or  in  part  without  the  express  consent  of  Amazon.com,  Inc.  

Slide 5

Slide 5 text

A Culture of Innovation: Experiment Often & Fail Without Risk

Slide 6

Slide 6 text

Who is using AWS and what are they using it for?

Slide 7

Slide 7 text

Startups on AWS http://aws.amazon.com/solutions/case-studies/

Slide 8

Slide 8 text

Enterprises on AWS http://aws.amazon.com/solutions/case-studies/

Slide 9

Slide 9 text

Infrastructure Foundation Services Regions Availability Zones Storage (Object, Block and Archive) Networking Security & Access Control Platform Services Databases Relational NoSQL Caching Analytics Hadoop Real-time Data warehouse App Services Queuing Orchestration App streaming Transcoding Email Search Deployment & Management Containers Dev/ops Tools Resource Templates Mobile Services Identity Sync Mobile Analytics Notifications Enterprise Applications Virtual Desktops Data Workflows Usage Tracking Monitoring and Logs Compute (VMs, Auto-scaling and Load Balancing) CDN and Points of Presence Collaboration and Sharing

Slide 10

Slide 10 text

11 regions 28 availability zones 52 edge locations Infrastructure

Slide 11

Slide 11 text

AWS Services Overview Amazon EC2 – Virtual Servers & resizable compute capacity Auto Scaling – Scale compute resources up and down Elastic Load Balancing – Load balancer for compute instances Amazon Elastic Block Storage (EBS) – Block storage for EC2

Slide 12

Slide 12 text

AWS Service Overview AWS Identity and Access Management – AWS Account Access Controls Amazon Route 53 – Scalable Domain Name System Amazon CloudWatch – Resource and Application Monitoring

Slide 13

Slide 13 text

Breaking news - New services on AWS

Slide 14

Slide 14 text

Amazon EC2 Container Service   Creates  and  manages  clusters  made  up  of  Docker  containers.  It  launches  and   terminates  the  containers  and  maintains  complete  informa)on  about  the   state  of  your  cluster     Automa)cally  schedules  containers  to  help  find  a  balance  between  your   resource  needs  and  availability  requirements     Using  EC2  Container  Service  you  can  simply  launch  &  manage  clusters  with   thousands  of  instances  and  schedule  tens  of  thousands  of  containers  across   mul)ple  Availability  Zones     Amazon  EC2  Container  Service  launches  your  containers  on  your  own  EC2   instances,  so  that  you  do  not  share  resources  with  other  customers,  places   your  clusters  in  a  VPC,  and  allows  you  to  use  your  own  VPC  security  groups   and  network  ACLs.     Your  applica)ons  can  make  use  of  AWS  features  such  as  Elas)c  IP  addresses,   resource  tags,  and  Virtual  Private  Cloud  (VPC).   h3p://aws.amazon.com/ecs/    

Slide 15

Slide 15 text

AWS Code Deploy   Deploys  your  released  code  to  a  "fleet"  of  EC2  instances       Accommodate  fleets  that  range  in  size  from  one  instance  all  the  way  up  to   tens  of  thousands  of  instances     Automa)cally  schedules  updates  across  mul)ple  Availability  Zones  in   order  to  maintain  high  availability  during  the  deployment       Applica)on  and  Deployment  groups  described  in  YAML-­‐forma3ed  files     Deployment  groups  iden)fy  EC2  instances  by  tags  &  can  also  reference   Auto  Scaling  Groups     Managed  via  AWS  Management  Console,  CLI  or  APIs     Can  be  used  in  conjunc)on  with  Chef  recipes  or  Puppet  scripts     Deploy  configura)on  from  a  variety  of  repositories  (S3,  GitHub,  etc)   h3ps://aws.amazon.com/codedeploy/    

Slide 16

Slide 16 text

Successful  projects  use   NGINX  on  AWS  

Slide 17

Slide 17 text

INTRODUCING  NGINX  AND  NGINX  PLUS  

Slide 18

Slide 18 text

Amazon  web  applicaCon   reference  architecture   •  Route53  DNS   •  Elas)c  Load  Balancer   •  Autoscaling  web  and   app  )ers   •  Ac)ve/standby   databases  

Slide 19

Slide 19 text

Refactoring  the  architecture  with  NGINX   NGINX  provides  basic   load  balancing  for:   –  HTTP   –  FastCGI   –  uWSGI   –  SCGI   –  memcache  

Slide 20

Slide 20 text

Go  further  with  NGINX  Plus   NGINX  F/OSS     Webserver   Accelera)ng  Proxy   Applica)on  Gateway   NGINX  Plus     Advanced  load  balancing  features    Health  checks,  Session  Persistence   Ease-­‐of-­‐management    Dynamic  Configura)on,  Extended  Status   Commercial  support  

Slide 21

Slide 21 text

region region region Elastic Load Balancer Web App 1 NGINX Plus AMI Web App 2 Web App 3 Route53 hosted zone Web App 1 NGINX Plus AMI Web App 2 Web App 3

Slide 22

Slide 22 text

Relevant  NGINX  Plus  features   •  Content-­‐based  rou)ng   •  Request  Priori)za)on   •  Health  Checks   •  Session  Persistence   •  PROXY  support   •  Dynamic  Reconfigura)on  (inc  DNS)   •  Extended  Status  

Slide 23

Slide 23 text

Content-­‐based  Rou)ng   Full  control  over  request     rouCng  for  mulCple     applicaCons     Single  front-­‐end  ELB  service     Mul)ple  front-­‐end  domains   Mul)ple  back-­‐end  applica)ons  

Slide 24

Slide 24 text

Request  Priori)za)on   Internet Large  spike  of  traffic   risks  overwhelming   upstream  servers     NGINX  Plus  limits  concurrent   connec)ons  to  upstream  servers   and  queues  addi)onal  traffic   Upstream  servers   protected  from   effects  of  traffic  spike   max_conns=150

Slide 25

Slide 25 text

Health  Checks   SophisCcated,  app-­‐specific   health  checks     Detect  applica)on  failures   Orchestrate  upgrades  

Slide 26

Slide 26 text

Session  Persistence   Per-­‐applicaCon  session     persistence  rules     Cookie-­‐inser)on,  rules-­‐based,   Learn  mode     Consistent-­‐hash  load  balancing  

Slide 27

Slide 27 text

PROXY  protocol   Internet Amazon  ELB  (mulCple  availability  zones)   Load-­‐balances  TCP  with  PROXY  protocol   NGINX  proxies  WebSockets   and  terminates  SPDY  traffic   Allows  for  support  for  WebSocket  proxying     and  SPDY  termina)on  

Slide 28

Slide 28 text

Dynamic  Reconfigura)on   Control  load  balancing  configura)on  dynamically   http { resolver 192.168.0.2; upstream backends { zone backends 64k; server api.u.com resolve; } upstream_conf; } DNS Changes  in  DNS  can  dynamically   update  NGINX  Plus’  load   balancing  configura)on   API Upstream_conf  API  gives  a   simple  HTTP  API  to  control   configura)on  

Slide 29

Slide 29 text

Extended  Status   …  with  CloudWatch  integra)on   GET /status/connections/active 17 GET /status/upstreams/ demoupstreams/0/server ”192.168.45.2:80" { checks: 15375, fails: 183, unhealthy: 165, last_passed: true } GET /status/upstreams/ demoupstreams/0/health_checks

Slide 30

Slide 30 text

Complemen)ng  Amazon  ELB  

Slide 31

Slide 31 text

Monitoring with Cloudwatch Know what is going on with your environment at all times!

Slide 32

Slide 32 text

Amazon CloudWatch Default Amazon EC2 metrics CPU Utilization (Percent) Disk Reads (Bytes) Disk Read Operations (Operations) Disk Writes (Bytes) Disk Write Operations (Operations) Network In (Bytes) Network Out (Bytes) Status Check Failed (Count) 1 or 5 minute intervals

Slide 33

Slide 33 text

NGINX Metrics into Amazon CloudWatch status.html à CloudWatch Install Agent $ sudo yum install nginx-cw-agent $ sudo apt-get install nginx-cw-agent  

Slide 34

Slide 34 text

NGINX Metrics into Amazon CloudWatch status.html à CloudWatch Update Configuration $ /etc/nginx-cw-agent/nginx-cw-agent.ini [source1] name=exampleorg url=http://example.org/status [source2] name=examplecom url=http://example.com/status http_user=testuser http_pass=testpass  

Slide 35

Slide 35 text

NGINX Metrics into Amazon CloudWatch status.html à CloudWatch Start Background Agent  Test  -­‐  $ /usr/bin/nginx-cw-agent.py –f start  All  in  -­‐  $ sudo service nginx-cw-agent start   View  Metrics  

Slide 36

Slide 36 text

NGINX with Amazon CloudWatch Logs •  Consolidate metrics and alarming for log files from 1 or many instances •  Define filters to parse content from your log files •  Measure and alarm on specific attributes •  Define retention period for your log files EC2   CloudWatch

Slide 37

Slide 37 text

NGINX with Amazon CloudWatch Logs Filter Alarm

Slide 38

Slide 38 text

NGINX with Amazon CloudWatch Logs EC2   EC2   EC2   EC2   EC2   EC2   Capture  logs  from  mul)ple  instances  in  one  place   CloudWatch

Slide 39

Slide 39 text

NEXT  STEPS  

Slide 40

Slide 40 text

Get  started  with  NGINX  Plus  AMI    h3p://aws.amazon.com/marketplace  

Slide 41

Slide 41 text

Finding  NGINX  Plus  on  AWS    h3p://aws.amazon.com/marketplace  -­‐  search  for  NGINX  

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

  ubuntu@ip-­‐172-­‐31-­‐20-­‐254:~$  /etc/init.d/nginx  status    *  nginx  is  running     ubuntu@ip-­‐172-­‐31-­‐20-­‐254:~$  cd  /etc/nginx/conf.d     ubuntu@ip-­‐172-­‐31-­‐20-­‐254:~$  nginx  –s  reload     Is  it  running…?  

Slide 44

Slide 44 text

Check  out  the  NGINX  Plus     on  AWS  whitepaper     Partner  Whitepapers:   h3p://aws.amazon.com/whitepapers/       h3p://d0.awssta)c.com/whitepapers/ AWS_NGINX_Plus-­‐whitepaper-­‐final_v4.pdf      

Slide 45

Slide 45 text

THANK  YOU