Upload
amazon-web-services
View
293
Download
10
Embed Size (px)
Citation preview
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
lIan Ward, Mapbox
CTD304
How Mapbox Uses the AWS Edge to
Deliver Fast Maps for Mobile, Cars,
and Web Users Worldwide
Ian Ward, Mapbox Engineering
November 30, 2016
Who am I?
13 people from Mapbox at re:Invent
Check out our booth
What I'll talk about
What is Mapbox?
Cost and performance
Configuration
Operations
Security
What is Mapbox?
A mapping platform for businesses
Mapbox maps power over 5,000 platforms
ranging from social to mobility apps
Design and data tools
Mapbox Studio
APIs and SDKs
/v4/mapbox.streets/z/x/y.png
256 px
256 px 8KB to 25KB
zoom 15 is
1.1 billion tileszoom 17 is
17 billion tiles
/geocoding/v5/mapbox.places/-77.03,38.91.json
~ 3 KB
/directions/v5/mapbox/{profile}/{coordinates}
Map matching API
Uploads API
Dataset API
Distance API
and more...
?access_token=$JWT
API traffic is global
Couple days of
SDK data, 95%
NYC road
coverage
Where is our infrastructure?
6 to 9 regions
60+ edge locations
Over 200 million MAU
Billions of requests a day
Cost and performance
Started in us-east-1,
with Amazon CloudFront
Client
GLOBAL 9 REGIONS 2 REGIONS
DNS
CDN
Route 53
Cloudfront
DNSRoute 53
ELB
App
servers
Cache
Object store
Database
S3
Dynamodb
Cache
Why use both max-age and s-maxage?
Cost: cache hit versus miss
For 1,000,000 requests
Origin Edge
EC2: $6.24 Requests: $1.00
ELB: $0.80 Transfer: $2.13
RDS: $6.96
Edge: $3.13
Total: $17 Total: $3
82% cheaper
Performance: cache hit versus miss
Hits are 96% faster
than misses
ex. 12 ms versus 300 ms
Conditional Requests
Origin
ETag
LastModified
CloudFront
If-Match with ETag
If-None-Match with Etag
If-Modified-Since
1,000,000,000 Conditional GETs
524 bytes at $54
25,000 bytes at $2125
Takeaways
CDN from the start
Know your content
Tune over time
Configuration
60 behaviors and 13 origins
Order matters.
Options matter.
Test it. Automate it.
Takeaways
CloudFront has flexible options
Find ways to manage this complexity
Operations
9 regions
Name Region
origin-maps.mapboxapi.com us-east-1
origin-maps.mapboxapi.com us-west-2
origin-maps.mapboxapi.com eu-west-1
…
…
...
Amazon Route 53 latency-based routing
What could go wrong?
Bad code
Bad deploy
Regional network issues
Automatic failover is not always such
Manual failover is error prone
Automated manual failover
https://github.com/mapbox/cfn-config
$ cfn-config update geocoder-production
Did it work?
Other ways we check edge status
CloudFront logs in Amazon Redshift
Takeaways
Tools for manual processes
Use familiar tools and workflows
Learn from your logs
Security
Scraping and DDoS
Fingerprint your bad traffic
Lots of traffic behind single IP
Unknown proxy
Single user agent
Irregular content profile
AWS WAF:
a web application firewall service
WAF CloudFront
Origin
Good users
Bad users
How to update?
$ cfn-update waf-production
Single computers and data centers
Takeaways
Ability to detect abnormal traffic
Keep log data accessible
Be familiar with your options to block
Conclusions
Thank you!
Remember to complete
your evaluations!