delivering high-availability web services with nginx plus on aws
TRANSCRIPT
![Page 1: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/1.jpg)
Delivering High-Availability Web Services with NGINX Plus on AWS
Owen Garrett
Nginx, Inc.
Scott Ward
Amazon Web Services
![Page 2: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/2.jpg)
Introductions and Agenda
• Owen GarrettHead of Products, NGINX
• Scott WardSolutions Architect, Amazon Web Services
![Page 3: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/3.jpg)
Introducing Amazon Web Services
![Page 4: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/4.jpg)
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.
![Page 5: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/5.jpg)
A Culture of Innovation: Experiment Often & Fail Without
Risk
![Page 6: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/6.jpg)
Who is using AWS and what are
they using it for?
![Page 7: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/7.jpg)
Startups on AWS
http://aws.amazon.com/solutions/case-studies/
![Page 8: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/8.jpg)
Enterprises on AWS
http://aws.amazon.com/solutions/case-studies/
![Page 9: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/9.jpg)
Infrastructure
Foundation
Services
Regions Availability Zones
Storage(Object, Block and Archive)
NetworkingSecurity &
Access Control
Platform
Services
Databases
Relational
NoSQL
Caching
Analytics
Hadoop
Real-time
Data warehouse
App Services
Queuing
Orchestration
App streaming
Transcoding
Search
Deployment & Management
Containers
Dev/ops Tools
Resource
Templates
Mobile Services
Identity
Sync
Mobile
Analytics
Notifications
Enterprise
ApplicationsVirtual Desktops
Data Workflows
Usage
Tracking
Monitoring
and Logs
Compute(VMs, Auto-scaling and Load Balancing)
CDN and Points of Presence
Collaboration and Sharing
![Page 10: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/10.jpg)
11 regions
28 availability
zones
52 edge locations
Infrastructure
![Page 11: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/11.jpg)
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
![Page 12: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/12.jpg)
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
![Page 13: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/13.jpg)
Breaking news - New services on AWS
![Page 14: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/14.jpg)
Amazon EC2 Container Service
Creates and manages clusters made up of Docker containers. It launches and terminates the containers and maintains complete information about the state of your clusterAutomatically schedules containers to help find a balance between your resource needs and availability requirementsUsing EC2 Container Service you can simply launch & manage clusters with thousands of instances and schedule tens of thousands of containers across multiple Availability ZonesAmazon 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 applications can make use of AWS features such as Elastic IP addresses, resource tags, and Virtual Private Cloud (VPC).
http://aws.amazon.com/ecs/
![Page 15: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/15.jpg)
AWS Code DeployDeploys 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
Automatically schedules updates across multiple Availability Zones in order to maintain high availability during the deployment
Application and Deployment groups described in YAML-formatted files
Deployment groups identify EC2 instances by tags & can also reference Auto Scaling Groups
Managed via AWS Management Console, CLI or APIs
Can be used in conjunction with Chef recipes or Puppet scripts
Deploy configuration from a variety of repositories (S3, GitHub, etc)
https://aws.amazon.com/codedeploy/
![Page 16: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/16.jpg)
Successful projects use NGINX on AWS
![Page 17: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/17.jpg)
INTRODUCING NGINX AND NGINX PLUS
![Page 18: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/18.jpg)
Amazon web applicationreference architecture
• Route53 DNS
• Elastic Load Balancer
• Autoscaling web and app tiers
• Active/standby databases
![Page 19: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/19.jpg)
Refactoring the architecture with NGINX
NGINX provides basic load balancing for:
– HTTP
– FastCGI
– uWSGI
– SCGI
– memcache
![Page 20: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/20.jpg)
Go further with NGINX Plus
NGINX F/OSS
WebserverAccelerating ProxyApplication Gateway
NGINX Plus
Advanced load balancing featuresHealth checks, Session Persistence
Ease-of-managementDynamic Configuration, Extended Status
Commercial support
![Page 21: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/21.jpg)
regionregion
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
![Page 22: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/22.jpg)
Relevant NGINX Plus features• Content-based routing• Request Prioritization• Health Checks• Session Persistence• PROXY support• Dynamic Reconfiguration (inc DNS)• Extended Status
![Page 23: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/23.jpg)
Content-based Routing
Full control over request routing for multiple applications
Single front-end ELB service
Multiple front-end domainsMultiple back-end applications
![Page 24: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/24.jpg)
Request Prioritization
Internet
Large spike of traffic risks overwhelming upstream servers
NGINX Plus limits concurrent connections to upstream servers
and queues additional traffic
Upstream servers protected from
effects of traffic spike
max_conns=150
![Page 25: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/25.jpg)
Health Checks
Sophisticated, app-specifichealth checks
Detect application failuresOrchestrate upgrades
![Page 26: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/26.jpg)
Session Persistence
Per-application session persistence rules
Cookie-insertion, rules-based,Learn mode
Consistent-hash load balancing
![Page 27: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/27.jpg)
PROXY protocol
Internet
Amazon ELB (multiple availability zones)Load-balances TCP with PROXY protocol
NGINX proxies WebSockets and terminates SPDY traffic
Allows for support for WebSocket proxyingand SPDY termination
![Page 28: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/28.jpg)
Dynamic Reconfiguration
Control load balancing configuration 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 configuration API
Upstream_conf API gives a simple HTTP API to control configuration
![Page 29: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/29.jpg)
Extended Status
… with CloudWatch integration
GET /status/connections/active 17
GET
/status/upstreams/demoupstream
s/0/server
”192.168.45.2:80"
{
checks: 15375,
fails: 183,
unhealthy: 165,
last_passed: true
}
GET
/status/upstreams/demoupstream
s/0/health_checks
![Page 30: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/30.jpg)
Complementing Amazon ELB
![Page 31: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/31.jpg)
Monitoring with Cloudwatch
Know what is going on with your
environment at all times
![Page 32: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/32.jpg)
Amazon CloudWatch
Default Amazon EC2
metricsCPU 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
![Page 33: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/33.jpg)
NGINX Metrics into Amazon CloudWatchstatus.html CloudWatch
Install Agent$ sudo yum install nginx-cw-agent
$ sudo apt-get install nginx-cw-agent
![Page 34: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/34.jpg)
NGINX Metrics into Amazon CloudWatchstatus.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
![Page 35: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/35.jpg)
NGINX Metrics into Amazon CloudWatchstatus.html CloudWatch
Start Background AgentTest - $ /usr/bin/nginx-cw-agent.py –f start
All in - $ sudo service nginx-cw-agent start
View Metrics
![Page 36: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/36.jpg)
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
![Page 37: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/37.jpg)
NGINX with Amazon CloudWatch Logs
Filter
Alarm
![Page 38: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/38.jpg)
NGINX with Amazon CloudWatch Logs
EC2
EC2EC2
EC2 EC2
EC2
Capture logs from multiple instances in one place
CloudWatch
![Page 39: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/39.jpg)
NEXT STEPS
![Page 41: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/41.jpg)
Finding NGINX Plus on AWShttp://aws.amazon.com/marketplace - search for NGINX
![Page 42: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/42.jpg)
![Page 43: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/43.jpg)
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…?
![Page 44: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/44.jpg)
Check out the NGINX Plus on AWS whitepaper
Partner Whitepapers:http://aws.amazon.com/whitepapers/
http://d0.awsstatic.com/whitepapers/AWS_NGINX_Plus-whitepaper-final_v4.pdf
![Page 45: Delivering High-Availability Web Services with NGINX Plus on AWS](https://reader034.vdocument.in/reader034/viewer/2022050802/55a2b5521a28abe70c8b45f0/html5/thumbnails/45.jpg)
THANK YOU